### Geometry Transformation Example Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/infoj/infoj/aggregate-filter.md This example demonstrates how to transform the geometry of 'table_a' to match the EPSG of 'table_b' using ST_Transform and ST_SetSRID. This is crucial for accurate spatial comparisons when coordinate systems differ. ```json "geom_a": "ST_Transform(ST_Setsrid(a.geom, 4326), 3857)" ``` -------------------------------- ### Text Type Example Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/infoj/infoj.md Specifies a property to be displayed as plain text. This is the default content format. ```json "type" : "text" ``` -------------------------------- ### Key Type Example Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/infoj/infoj.md Specifies a property type that displays the layer name in the location view. ```json "type": "key" ``` -------------------------------- ### Tooltip Example Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/infoj/infoj.md Adds a tooltip to the info entry label, displayed when the cursor hovers over it. ```json "title" : "I am a tooltip" ``` -------------------------------- ### Prefix Example Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/infoj/infoj.md Adds a prefix string to the beginning of the displayed value, useful for units or currency symbols. ```json "prefix" : "$ " ``` -------------------------------- ### Geometry Type Example Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/infoj/infoj.md Configures an entry to display a location's geometry on the map control. ```json "type" : "geometry" ``` -------------------------------- ### Postfix Example Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/infoj/infoj.md Appends a postfix string to the end of the displayed value, commonly used for units. ```json "postfix" : " %" ``` -------------------------------- ### Workspace Get Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/workspace.md Retrieves information about the workspace. ```APIDOC ## GET /workspace/get ### Description Retrieves information about the workspace. ### Method GET ### Endpoint /workspace/get ``` -------------------------------- ### HTML Type Example Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/infoj/infoj.md Sets the type to HTML, which will render the field value as HTML content instead of plain text. ```json "type" : "html" ``` -------------------------------- ### Run Application with PM2 on Ubuntu Source: https://geolytix.gitbook.io/xyz-developer-guide/deploying.md Use PM2 to start your application using a JSON configuration file. This is useful for running multiple instances on different ports. ```bash pm2 start myapplication.json ``` -------------------------------- ### Define a Base Map Layer Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/layers.md Example of a 'base' layer configuration, including group, display status, name, attribution, format, and URI. ```javascript "layers": { "base": { "group": "Base maps", "display": true, "name": "Mapbox Baselayer", "attribution": { "© Mapbox" : "https://www.mapbox.com/about/maps", "© OpenStreetMap": "http://www.openstreetmap.org/copyright" }, "format": "tiles", "URI": "https://api.mapbox.com/styles/v1/dbauszus/ciozrimi3002bdsm8bjtn2v1y/tiles/256/{z}/{x}/{y}?&provider=MAPBOX" } } ``` -------------------------------- ### Textarea Type Example Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/infoj/infoj.md Configures a multi-line input for editable text areas. If not editable, it displays like a simple text type. ```json "type" : "textarea" ``` -------------------------------- ### Infoj withSelect Example Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/infoj/infoj/withselect.md Demonstrates how to define fields using the 'withSelect' property for on-the-fly calculations. Use 'fieldfx' to specify the calculation and 'withSelect: true' to enable it. This is useful for creating derived metrics like ratios. ```json { "label": "Population", "field": "pop__17", // known value "type": "numeric" }, { "label": "Competitors", "field": "comp", // known value "type": "integer" }, { "label": "Population per competitor", "field": "field_withSelect", // PostgreSQL calculation result alias "fieldfx": "pop__17 / comp", // calcutation to perform "type": "integer", "withSelect": true } ``` -------------------------------- ### Integer Type Example Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/infoj/infoj.md Sets the data type to integer, which will be rounded and displayed with comma delimiters. ```json "type" : "integer" ``` -------------------------------- ### Group Type Example Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/infoj/infoj.md Designates an entry as a group, allowing subsequent entries to be organized within this group. ```json "type" : "group" ``` -------------------------------- ### Define Locales Configuration Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/locales.md This example shows all possible options for configuring locales, including name, bounds, view settings, and layer definitions. Use this structure to define multiple regional settings for your application. ```javascript "locales": { "Global": {...} "UK": { "name": "United Kingdom", "gazetteer": {...}, "bounds": { "north": 62, "east": 5, "south": 48, "west": -13 }, "showScaleBar": true, "maskBounds": true, "view": { "lat": 45, "lng": 60, "z": 3 }, "minZoom": 6, "maxZoom": 17, "layers": {...} } } ``` -------------------------------- ### Get Workspace Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/workspace/workspace-get.md Requests a public workspace or a private workspace using an access token. ```APIDOC ## GET /workspace/get ### Description This endpoint will request a public workspace if available or a private workspace at the access level of the provided token. ### Method GET ### Endpoint geolytix.xyz/workspace/get #### Query Parameters - **token** (string) - Optional - A token is required in order to request a private workspace. #### Response ##### Success Response (200) - **title** (string) - The title of the workspace. - **locales** (object) - An object containing locale-specific data. ##### Response Example ```json { "title": "XYZ dev", "locales": { "GB": {...} } } } ``` #### Error Response (401) - **message** (string) - Returned when trying to access a private endpoint with an invalid or missing token. #### Error Response Example ``` 'Invalid token.' ``` ``` -------------------------------- ### Images Type Example Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/infoj/infoj.md Configures an entry to display as a scrollable array of images. Requires `edit` to be true for uploads and the database field to be `TEXT[]`. ```json "type" : "images" ``` -------------------------------- ### Streetview Type Example Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/infoj/infoj.md Sets the entry type to display a Google Streetview image for the location. Requires a Google API key. ```json "type" : "streetview" ``` -------------------------------- ### Boolean Type Example Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/infoj/infoj.md Configures a boolean data type, displayed as a checkbox and stored as a boolean in the database. ```json "type": "boolean" ``` -------------------------------- ### Inline Display Example Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/infoj/infoj.md Forces text values to be displayed inline with their labels, overriding the default behavior of displaying text on a new line. ```json "inline" : true ``` -------------------------------- ### Successful Workspace Retrieval (200 OK) Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/workspace/workspace-get.md Example of a successful response when retrieving a workspace. This JSON object contains details about the workspace, such as its title and locale information. ```javascript { "title": "XYZ dev", "locales": { "GB": {...} } } } ``` -------------------------------- ### Compile SASS to CSS Source: https://geolytix.gitbook.io/xyz-developer-guide/infrastructure/dependencies/sass.md Use this command to compile SASS stylesheets into CSS. Ensure SASS is installed and run this from the application root directory. ```bash sass -update public/css ``` -------------------------------- ### Label Type Example Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/infoj/infoj.md Defines an entry that acts as a label header, used to split data rows. Text will appear on a new line below the label. ```json "type" : "label" ``` -------------------------------- ### Level Class Example Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/infoj/infoj.md Assigns a CSS class to the table row holding the entry, useful for hierarchical styling. ```json "level" : 1 ``` -------------------------------- ### Get Place Details from Google Places API Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/api/gazetteer/api-gazetteer-googleplaces.md Proxies a request for place details to the Google Places API. A KEY_GOOGLE entry is required in the environment settings. ```APIDOC ## GET geolytix.xyz/api/gazetteer/googleplaces ### Description Proxies a request for place details to the Google Places API. A **KEY_GOOGLE** entry is required in the environment settings. ### Method GET ### Endpoint /api/gazetteer/googleplaces ### Query Parameters #### Query Parameters - **id** (string) - Required - The Google Place ID. - **token** (string) - Optional - Required for private endpoints. ### Response #### Success Response (200) Returns the coordinates of the Google Place. ```json { "type":"Point", "coordinates":[ -0.1277583, 51.5073509 ] } ``` #### Error Response (401) Returned when trying to access a private endpoint with an invalid or missing token. ``` 'Invalid token.' ``` #### Error Response (500) When provided with an invalid Google Place ID. ```json { "statusCode":500, "error":"Internal Server Error", "message":"Cannot read property 'geometry' of undefined" } ``` ``` -------------------------------- ### Date Type Example Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/infoj/infoj.md Defines a date type, which is stored internally as a Unix timestamp and displayed as a formatted string. The database field must be `bigint`. ```json "type" : "date" ``` -------------------------------- ### Get API Key Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/auth/token/auth-token-api.md Retrieves an API key by calling the /auth/token/api endpoint with a valid admin token. If the token is invalid or the user is not enabled for API keys, an error is returned. ```APIDOC ## GET /auth/token/api ### Description Calling the endpoint without a valid access token will redirect the client to the login view. A successful /login post will redirect to this endpoint with a temporary token which should resolve into an API key. ### Method GET ### Endpoint geolytix.xyz/auth/token/api #### Query Parameters - **token** (string) - Required - An admin token is required to request an API key. #### Response ##### Success Response (200) An API key is returned when called with a valid token for an admin user account which has API keys enabled. ``` eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImRlbm5pcy5iYXVzenVzQGdlb2x5dGl4LmNvLnVrIiwiYWNjZXNzIjoiYXBpIiwiaWF0IjoxNTQxODU2NzEwfQ.fFQxuYls5560CWdnIO13vwOa229TJYSDxYCVD56y*** ``` ##### Error Response (401) Returned if the token is not an admin token or if the user account has not been enabled to have API keys. ``` 'Invalid token.' ``` ``` -------------------------------- ### Deploy XYZ with Zeit Now (Zero Configuration) Source: https://geolytix.gitbook.io/xyz-developer-guide/deploying.md Deploys the XYZ master branch from GitHub with zero configuration. Requires Zeit Now CLI and Node/npm. ```bash now geolytix/xyz ``` -------------------------------- ### Deploy XYZ with Zeit Now and Environment Variables Source: https://geolytix.gitbook.io/xyz-developer-guide/deploying.md Deploys XYZ with custom environment variables set using the -e option. These variables configure the deployment environment. Requires Zeit Now CLI and Node/npm. ```bash now geolytix/xyz \ -e DIR="/demo" \ -e ALIAS=”geolytix.xyz” \ -e PRIVATE="postgres://user:***@pg.xyz.geolytix.net:5432/xyz|demo.users" \ -e SECRET="***" \ -e TRANSPORT="smtps:xyz%40geolytix.co.uk:***@smtp.gmail.com" \ -e WORKSPACE="postgres://user:***@pg.xyz.geolytix.net:5432/xyz|demo.settings" \ -e DBS_XYZ="postgres://user:***@pg.xyz.geolytix.net:5432/xyz" \ -e KEY_MAPBOX="access_token=**.***.***" ``` -------------------------------- ### Field Function Example Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/infoj/infoj.md Defines a calculated field that computes a value from other fields. These fields are not editable. ```json "fieldfx" : "(field_a + field_b)" ``` -------------------------------- ### Query Documentation Index with a Question Source: https://geolytix.gitbook.io/xyz-developer-guide/llms.txt Use this method to ask specific questions about the documentation. The `ask` parameter is required for the question, and `goal` is optional for tailoring the answer. ```http GET https://geolytix.gitbook.io/xyz-developer-guide/master.md?ask=&goal= ``` -------------------------------- ### Layer Attribution Configuration Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/layers.md Shows how to configure attribution for a layer, including multiple key/value pairs for text and links. ```json "attribution": { "© Mapbox" : "https://www.mapbox.com/about/maps", "© OpenStreetMap": "http://www.openstreetmap.org/copyright" } ``` -------------------------------- ### Get Vector Tile Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/api/layer/api-mvt-get-z-x-y-1.md Retrieves a vector tile for a specific zoom level, x, and y coordinate. ```APIDOC ## GET /layer/api-mvt-get-z-x-y/{z}/{x}/{y} ### Description This endpoint retrieves a vector tile for a specified zoom level (z), x-coordinate, and y-coordinate. The tiles are in the Mapbox Vector Tile format. ### Method GET ### Endpoint /layer/api-mvt-get-z-x-y/{z}/{x}/{y} ### Parameters #### Path Parameters - **z** (integer) - Required - The zoom level of the tile. - **x** (integer) - Required - The x-coordinate (column) of the tile. - **y** (integer) - Required - The y-coordinate (row) of the tile. ### Response #### Success Response (200) - The response is a binary payload containing the vector tile data in Mapbox Vector Tile format. ``` -------------------------------- ### Get Vector Tile Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/api/layer/api-mvt-get-z-x-y-1.md Retrieve a vector tile for a specific zoom level, column, and row. ```APIDOC ## GET /layer/api-mvt-get-z-x-y ### Description This endpoint retrieves a vector tile for a given zoom level (z), column (x), and row (y). ### Method GET ### Endpoint `/layer/api-mvt-get-z-x-y/{z}/{x}/{y}` ### Parameters #### Path Parameters - **z** (integer) - Required - The zoom level. - **x** (integer) - Required - The column index. - **y** (integer) - Required - The row index. #### Query Parameters None ### Request Example GET /layer/api-mvt-get-z-x-y/12/1000/1500 ### Response #### Success Response (200) - **Content-Type**: application/vnd.mapbox-vector-tile - The response body contains the vector tile data in MVT format. ``` -------------------------------- ### Get Nearest Locations by LatLng Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/api/location/select/api-location-select_ll_nnearest.md Retrieves information and geometry for the n nearest locations to a specified coordinate. ```APIDOC ## GET /latlng/nnearest ### Description Returns the location info and geometry for the n nearest locations to a coordinate. ### Method GET ### Endpoint geolytix.xyz/api/location/select/latlng/nnearest ### Parameters #### Query Parameters - **locale** (string) - Required - The locale (key) for the layer. - **layer** (string) - Required - The layer (key). - **table** (string) - Optional - The PostGIS table to be queried. Defaults to layer table or tables array if not specified in request. - **geom** (string) - Optional - A geometry field must be provided if the layer has no geometry definition. Will override layer geom definition. - **nnearest** (string) - Optional - The n nearest locations to return. Defaults to 3. - **token** (string) - Optional - A token is required to access private endpoints. ### Response #### Success Response (200) - **geomj** (string) - The geometry of the location. - **infoj** (array) - An array of information fields for the location. - **label** (string) - The label for the information field. - **field** (string) - The field name. - **type** (string) - The data type of the field. - **value** (any) - The value of the information field. #### Response Example (200) ```json { "geomj": "{...}", "infoj": [ { "label": "Population '11", "field": "pop_11", "type": "integer", "value": 304 } ] } ``` #### Success Response (204) Returned when the database query was successful but no records were returned. #### Response Example (204) ``` 'No rows returned from table.' ``` #### Error Response (401) Returned when trying to access a private endpoint with an invalid or missing token. #### Response Example (401) ``` 'Invalid token.' ``` #### Error Response (406) Will be returned if parameters are missing or don't match the workspace in memory. #### Response Example (406) ``` 'Invalid locale.' ​ 'Invalid layer.' ​ 'Missing lng.' ​ 'Missing lat.' ​ 'Missing geom (SRID 4326) field on layer.' ​ 'Invalid parameter.' ``` #### Error Response (500) Backend failed to fetch results from database table. #### Response Example (500) ``` 'Failed to query PostGIS table.' ``` ``` -------------------------------- ### PostgreSQL Workspace Connection String Source: https://geolytix.gitbook.io/xyz-developer-guide/environment-settings/workspace.md Define a workspace using a PostgreSQL connection string. The server will create the table if it doesn't exist. ```shell "WORKSPACE": "postgres://username:password@123.123.123.123:5432/database|schema.table" ``` -------------------------------- ### GET /api/layer/cluster Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/api/layer/api-cluster-get.md Requests an array of cluster locations for the given viewport. Parameters can be used to filter and aggregate the results. ```APIDOC ## GET /api/layer/cluster ### Description Request an array of cluster locations for the given view port. ### Method GET ### Endpoint /api/layer/cluster ### Query Parameters - **locale** (string) - Optional - The locale key. - **layer** (string) - Optional - The layer key. - **table** (string) - Required - The PostGIS table with cluster locations. - **kmeans** (string) - Optional - The factor for the PostGIS kmeans algorithm. - **dbscan** (string) - Optional - The factor for the PostGIS dbscan algorithm. - **west** (string) - Optional - The western bounds of the view port. - **south** (string) - Optional - The southern bounds of the view port. - **east** (string) - Optional - The eastern bounds of the view port. - **north** (string) - Optional - The northern bounds of the view port. - **cat** (string) - Optional - The cat field to be used for cluster aggregation. - **size** (string) - Optional - The size field to be used for cluster aggregation. - **theme** (string) - Optional - The theme type (categorized, graduated, competition). - **filter** (string) - Optional - Stringified filter object to be applied to table query. - **token** (string) - Optional - Required for private endpoints. ### Response #### Success Response (200) An array of features with coordinates of the cluster location and properties that describe the cluster. #### Response Example ```json [ { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ -4.94003973494868, 50.3960153464407 ] }, "properties": { "count": 112, "size": 112, "cat": null } }, {...} ] ``` #### Error Response (406) Missing or invalid parameter. #### Error Response Example ``` 'Invalid locale.' 'Invalid layer.' 'Missing table.' 'Invalid parameter.' ``` #### Error Response (500) Please check backend error logs for more details. #### Error Response Example ``` 'Failed to query PostGIS table.' ``` ``` -------------------------------- ### Workspace Loading Checks Output Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/workspace-checks.md This output shows the results of checks performed when a workspace is loaded. It verifies tile retrieval, MVT cache status, and geometry/query ID fields. 'A-ok' indicates success, while '!!!' or '¡No bueno!' signals errors. ```bash ------Checking Workspace------ NE.OSM (tiles) => 'A-ok' NE.COUNTRIES | dev.natural_earth_countries.geom_3857 (mvt) => 'A-ok' NE.COUNTRIES | dev.natural_earth_countries.id (mvt) => 'A-ok' NE.COUNTRIES | dev.natural_earth_countries__mvts (mvt cache) => 'A-ok' GB.OSM (tiles) => 'A-ok' GB.edit_layer | dev_edit.geom_3857 (mvt) => 'A-ok' GB.edit_layer | dev_edit.id (mvt) => 'A-ok' GB.edit_layer | dev_edit__mvts (mvt cache) => Cache table created GB.oa | dev_oa.geom_3857 (mvt) => 'A-ok' GB.oa | dev_oa.id (mvt) => 'A-ok' GB.oa | dev_oa__mvts (mvt cache) => Cache table has been truncated !!! GB.retail_places | dev_retailplaces.geom_3857_ (mvt) => column "geom_3857_" does not exist GB.retail_points | dev_retailpoints.geom (cluster) => 'A-ok' !!! GB.retail_points | dev_retailpoints.___id (cluster) => '¡No bueno!' GB.grid | gb_hx_64k.geomcntr (grid) => 'A-ok' GB.grid | gb_hx_32k.geomcntr (grid) => 'A-ok' GB.grid | gb_hx_16k.geomcntr (grid) => 'A-ok' GB.grid | gb_hx_8k.geomcntr (grid) => 'A-ok' GB.grid | gb_hx_4k.geomcntr (grid) => 'A-ok' GB.grid | gb_hx_2k.geomcntr (grid) => 'A-ok' GB.grid | gb_hx_1k.geomcntr (grid) => 'A-ok' GB.grid | gb_hx_1k.geomcntr (grid) => 'A-ok' GB.Mapbox Base (tiles) => 'A-ok' ----------------------------- ``` -------------------------------- ### Numeric Type Example Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/infoj/infoj.md Specifies a numeric data type, rounded to two decimal places and displayed with comma delimiters. ```json "type" : "numeric" ``` -------------------------------- ### GET /latlng/contains Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/api/location/select/api-location-select_ll.md Retrieves information about locations that contain the specified latitude and longitude coordinates. This endpoint is useful for point-in-polygon queries. ```APIDOC ## GET /latlng/contains ### Description This endpoint returns the info of locations which contain the input latitude and longitude. ### Method GET ### Endpoint geolytix.xyz/api/location/select/latlng/contains ### Parameters #### Query Parameters - **locale** (string) - Optional - The locale (key) for the layer. - **layer** (string) - Optional - The layer (key). - **table** (string) - Optional - The PostGIS table to be queried. Will be taken from layer table or table array if not specified in request. - **geom** (string) - Optional - A geometry field must be provided if the layer has no geometry definition. Will override layer geom definition. - **token** (string) - Optional - A token is required to access private endpoints. ### Response #### Success Response (200) A JSON array of locations. - **pop_11** (integer) - Example population data. - **geomj** (string) - Example geometry data in JSON format. #### Response Example (200) ```json [ { "pop_11": 304, "geomj": "{\"type\":\"MultiPolygon\",\"coordinates\":[...] }" }, {...} ] ``` #### Success Response (204) Returned when the database query was successful but no records were returned. #### Response Example (204) ``` 'No rows returned from table.' ``` #### Error Response (401) Returned when trying to access a private endpoint with an invalid or missing token. #### Response Example (401) ``` 'Invalid token.' ``` #### Error Response (406) Will be returned if parameter are missing or don't match the workspace in memory. #### Response Example (406) ``` 'Invalid locale.' ​ 'Invalid layer.' ​ 'Missing lng.' 'Missing lat.' 'Missing geom (SRID 4326) field on layer.' ​ 'Invalid parameter.' ``` #### Error Response (500) Backend failed to fetch results from database table. #### Response Example (500) ``` 'Failed to query PostGIS table.' ``` ``` -------------------------------- ### Get Min and Max Values Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/api/location/field-range.md Returns the minimum and maximum values for a table field. This is a successful response when data is found. ```json {"min":50,"max":4140} ``` -------------------------------- ### Gazetteer Configuration Object Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/locales/gazetteer.md Defines the gazetteer settings, including the provider, placeholder text, and a list of datasets to use for searches. ```json { "gazetteer": { "provider": "MAPBOX", "placeholder": "e.g. London", "datasets": [ { "layer": "sprawls", "table": "glx_cities_of_the_world", "qterm": "name", "label": "nameascii", "leading_wildcard": true } ] } } ``` -------------------------------- ### POST /workspace/load Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/workspace/workspace-load.md Loads a workspace into the XYZ backend memory. The workspace is checked and returned with marks to exclude invalid entries from being processed by the client. ```APIDOC ## POST /workspace/load ### Description This endpoint allows to post a workspace to be loaded into the XYZ backend memory. The workspace will checked and returned with marks to exclude invalid entries from being processed by the client. ### Method POST ### Endpoint geolytix.xyz/workspace/load #### Query Parameters - **token** (string) - Required - An admin token is required to access this endpoint. ### Response #### Success Response (200) The posted workspace will verified and returned with marks in regard to the validity of entries. #### Response Example ```json { "title": "XYZ dev", "locales": { "GB": {...} } } } ``` #### Error Response (401) Returned when trying to access a private endpoint with an invalid or missing token. #### Response Example ``` 'Invalid token.' ``` ``` -------------------------------- ### GET /api/layer/geojson Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/api/layer/api-geojson-get.md Requests a GeoJSON collection for the specified viewport. Requires parameters like layer, table, and viewport bounds. ```APIDOC ## GET /api/layer/geojson ### Description Request a geojson collection for the given viewport. ### Method GET ### Endpoint `/api/layer/geojson` ### Query Parameters - **locale** (string) - Optional - The locale key. - **layer** (string) - Optional - The layer key. - **table** (string) - Optional - The PostGIS table. - **west** (string) - Optional - The western bounds of the view port. - **south** (string) - Optional - The southern bounds of the view port. - **east** (string) - Optional - The eastern bounds of the view port. - **north** (string) - Optional - The northern bounds of the view port. - **cat** (string) - Optional - The cat field to be used in themes. - **filter** (string) - Optional - The theme type (categorized, graduated). - **token** (string) - Optional - Required for private endpoints. ### Response #### Success Response (200) An array of geojson features. #### Response Example ```json [ { "type": "Feature", "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -2.04831614791702, 52.599116590136 ], [...] ] ] ] }, "properties": { "id": 259, "cat": "61059" } }, {...} ] ``` #### Error Response (406) Query with missing or invalid parameter. #### Error Response (500) Please check backend error logs for more details. ``` -------------------------------- ### Define Infoj Group and Add Entries Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/infoj/infoj/groups.md Define a group by setting 'type' to 'group' and assign subsequent entries to it using the 'group' key. Groups must have unique labels. ```json "infoj": [ { "label": "Group A", "type": "group", "expanded": true }, { "group": "Group A", "label": "Size", "field": "size_sqm", "type": "integer" }, {"..."} ] ``` -------------------------------- ### Deploy Updates to AWS Elastic Beanstalk Instance Source: https://geolytix.gitbook.io/xyz-developer-guide/deploying.md For subsequent deployments, use the 'eb deploy' command followed by the name of your instance. ```bash eb deploy {name_of_instance} ``` -------------------------------- ### Get Layer Extent Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/api/layer/extent.md Queries the extent of the PostGIS geometry field in a layer table or the topmost table in a layer tables array. ```APIDOC ## GET /api/layer/extent ### Description Queries the extent of the PostGIS geometry field in a layer table or the topmost table in a layer tables array. ### Method GET ### Endpoint /api/layer/extent ### Parameters #### Query Parameters - **locale** (string) - Optional - The layers locale. - **layer** (string) - Optional - The layer key. - **token** (string) - Optional - Required for private endpoints. ### Response #### Success Response (200) Returns comma separated min longitude, min latitude, max longitude, max latitude. #### Response Example ```javascript -6.69424629211426,49.1409187316895,1.79668128490448,57.7356452941895 ``` #### Success Response (204) Returns 'No bounds.' #### Error Response (401) Returned when trying to access a private endpoint with an invalid or missing token. #### Error Response (406) Returned when a parameter is missing or does not match the loaded workspace. #### Error Response (500) The node postgres module fails to perform query. ``` -------------------------------- ### POST /register Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/auth/register.md Allows the creation of a new user account or the reset of an existing account's password. ```APIDOC ## POST /register ### Description This endpoint allows to create a new user account in the ACL or reset the password of an existing account. ### Method POST ### Endpoint geolytix.xyz/register ### Parameters #### Request Body - **email** (string) - Required - The email address associated with an user account. - **password** (string) - Required - The user account password. ### Response #### Success Response (301) This response is a redirect. If valid credentials were provided, the redirect will point to the login view with a message regarding additional instructions. If invalid credentials were provided, the redirect will point to the login view with a message regarding the registration failure. ``` -------------------------------- ### Registration Endpoint Behavior Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/auth/register.md This describes the expected redirect behavior for the /register POST request. If valid credentials are provided, it redirects to the login view with success instructions. If invalid credentials are provided, it redirects to the login view with failure information. ```text If valid credentials were provided the redirect will redirect to the login view with a message in regard to additional instructions. If invalid credentials were provided the redirect will redirect to the login view with a message in regard to the registration failure. ``` -------------------------------- ### Get MVT Layer Tile Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/api/layer/api-mvt-get-z-x-y-1.md Retrieves a map tile in Mapbox Vector Tile format for a given zoom level, x-coordinate, and y-coordinate. ```APIDOC ## GET /layer/mvt/{z}/{x}/{y} ### Description Fetches a map tile in Mapbox Vector Tile format. ### Method GET ### Endpoint /layer/mvt/{z}/{x}/{y} ### Parameters #### Path Parameters - **z** (integer) - Required - The zoom level. - **x** (integer) - Required - The x-coordinate of the tile. - **y** (integer) - Required - The y-coordinate of the tile. ### Response #### Success Response (200) - **content-type** (string) - The content type of the response, typically 'application/vnd.mapbox-vector-tile'. - **body** (binary) - The binary data of the Mapbox Vector Tile. ``` -------------------------------- ### Get Vector Tile Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/api/layer/api-mvt-get-z-x-y-1.md Retrieves a vector tile for a specific zoom level, x, and y coordinate. This is the primary endpoint for accessing map data. ```APIDOC ## GET /layer/api/mvt/{z}/{x}/{y} ### Description Retrieves a vector tile for a specific zoom level (z), x-coordinate (x), and y-coordinate (y). ### Method GET ### Endpoint /layer/api/mvt/{z}/{x}/{y} ### Parameters #### Path Parameters - **z** (integer) - Required - The zoom level of the tile. - **x** (integer) - Required - The x-coordinate (column) of the tile. - **y** (integer) - Required - The y-coordinate (row) of the tile. ### Response #### Success Response (200) - **Content-Type**: application/vnd.mapbox-vector-tile - The response body contains the vector tile data in the Mapbox Vector Tile format. ``` -------------------------------- ### GET /latlng/intersects Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/api/location/select/api-location-select_ll_intersect.md Retrieves locations that intersect with a specified geographic coordinate. This endpoint is useful for point-in-polygon queries or finding features at a precise location. ```APIDOC ## GET /latlng/intersects ### Description This endpoint returns locations which intersect a location at the given coordinate. ### Method GET ### Endpoint geolytix.xyz/api/location/select/latlng/intersects ### Parameters #### Query Parameters - **locale** (string) - Optional - The locale (key) for the layer. - **layer** (string) - Optional - The layer (key). - **table** (string) - Optional - The PostGIS table to be queried. Defaults to layer table or tables array if not specified in request. - **geom** (string) - Optional - A geometry field must be provided if the layer has no geometry definition. Will override layer geom definition. - **token** (string) - Optional - A token is required to access private endpoints. ### Response #### Success Response (200) - **geomj** (string) - The geometry of the intersecting location. - **infoj** (array) - An array of information objects, each containing label, field, type, and value. #### Response Example (200) ```json { "geomj": "{...}", "infoj": [ { "label": "Population '11", "field": "pop_11", "type": "integer", "value": 304 } ] } ``` #### Success Response (204) Returned when the database query was successful but no records were returned. #### Response Example (204) ``` 'No rows returned from table.' ``` #### Error Response (401) Returned when trying to access a private endpoint with an invalid or missing token. #### Response Example (401) ``` 'Invalid token.' ``` #### Error Response (406) Will be returned if parameters are missing or don't match the workspace in memory. #### Response Example (406) ``` 'Invalid locale.' ​ 'Invalid layer.' ​ 'Missing lng.' ​ 'Missing lat.' ​ 'Missing geom (SRID 4326) field on layer.' ​ 'Invalid parameter.' ``` #### Error Response (500) Backend failed to fetch results from database table. #### Response Example (500) ``` 'Failed to query PostGIS table.' ``` ``` -------------------------------- ### Competition Cluster Theme Configuration Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/layers/cluster-layer.md Sets up a competition theme for cluster layers, useful for visualizing the composition of categories within a cluster. The 'cat' property defines the categories and their associated styling. ```javascript "Tesco/Sainsbury's": { "type": "competition", "field": "retailer", "other": true, "cat": { "Tesco": { "label": "Tesco", "fillColor": "#0055a8" }, "Sainsburys": { "label": "Sainsbury's", "fillColor": "#ee8a00" } } } ``` -------------------------------- ### Get Field Range Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/api/location/field-range.md Retrieves the minimum and maximum values for a specified field in a table. It also provides average and standard deviation if available. ```APIDOC ## GET /api/location/field/range ### Description Get the min and max, avg and standard deviation values for a table field. ### Method GET ### Endpoint `/api/location/field/range` ### Query Parameters - **locale** (string) - Optional - The locale key. - **layer** (string) - Optional - The layer key. - **table** (string) - Required - The table name. - **field** (string) - Required - The field name. - **token** (string) - Optional - Required for private endpoints. ### Response #### Success Response (200) - **min** (number) - The minimum value of the field. - **max** (number) - The maximum value of the field. #### Response Example (200) ```json { "min": 50, "max": 4140 } ``` #### Success Response (200 - No rows) - **message** (string) - 'No rows returned from table.' #### Response Example (200 - No rows) ``` 'No rows returned from table.' ``` #### Error Response (406) - **message** (string) - Indicates an invalid or missing parameter. - 'Invalid locale.' - 'Invalid layer.' - 'Missing table.' - 'Missing field.' - 'Invalid parameter.' #### Error Response (500) - **message** (string) - 'Failed to query PostGIS table.' ``` -------------------------------- ### 406 Missing or invalid parameters Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/api/location/select/api-cluster-select.md This response is returned when required parameters are missing or do not match the expected format or workspace configuration. ```text 'Invalid locale.' 'Invalid layer.' 'Missing table.' 'Missing lnglat.' 'Invalid parameter.' ``` -------------------------------- ### Open Deployed AWS Elastic Beanstalk Application Source: https://geolytix.gitbook.io/xyz-developer-guide/deploying.md After a successful deployment, use this command to open your application in a web browser. ```bash eb open ``` -------------------------------- ### Invalid Parameter Error Messages Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/api/location/select/api-location-aggregate.md Examples of error messages returned when query parameters are missing or invalid. These indicate issues with locale, layer, or table. ```text 'Invalid locale.' 'Layer not found.' 'Table not found.' ``` -------------------------------- ### File-Based Workspace Definition Source: https://geolytix.gitbook.io/xyz-developer-guide/environment-settings/workspace.md Specify a workspace to be loaded from a JSON file within the repository's workspaces directory. This configuration is immutable once loaded. ```shell "WORKSPACE": "file:demo.json" ``` -------------------------------- ### Webpack Configuration Source: https://geolytix.gitbook.io/xyz-developer-guide/infrastructure/dependencies/webpack-babel.md This is the main Webpack configuration file for the XYZ application. It specifies entry points, output paths, source maps, module rules, and optimization settings. ```javascript const path = require('path'); module.exports = { entry: { xyz: ['./public/js/xyz_entry.js'] }, output: { path: path.resolve(__dirname, 'public/js/build'), filename: '[name]_bundle.js' }, devtool: 'source-map', module: { rules: [{ test: /\.js$/, exclude: /node_modules/ }] }, optimization: { concatenateModules: true }, stats: { maxModules: Infinity, optimizationBailout: true } }; ``` -------------------------------- ### Successful Gazetteer Autocomplete Response Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/api/gazetteer/api-gazetteer-autocomplete.md An example of a successful response containing an array of gazetteer results. The exact entries may vary depending on the geocoder provider. ```javascript [ { "label":"L9 8AQ", "id":2102, "table":"dev_cluster", "layer":"cluster", "marker":"-2.970027988,53.462788997", "source":"glx" }, {"..."} ] ``` -------------------------------- ### Raster Tile Layer with Provider Proxy Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/layers/base-layer.md Append a provider tag to the URI to proxy requests through the XYZ backend. The tag will be replaced with the matching provider key from environment settings. ```url https://.../{z}/{x}/{y}/256/png8?&provider=HERE ``` -------------------------------- ### Create a New AWS Elastic Beanstalk Instance Source: https://geolytix.gitbook.io/xyz-developer-guide/deploying.md Use the EB CLI to create a new instance of your application on AWS Elastic Beanstalk. Replace {name_of_instance} with your desired instance name. ```bash eb create {name_of_instance} ``` -------------------------------- ### Workspace Load Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/workspace.md Loads data into the workspace. ```APIDOC ## POST /workspace/load ### Description Loads data into the workspace. ### Method POST ### Endpoint /workspace/load ``` -------------------------------- ### POST /login Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/auth/login.md This endpoint checks user credentials. Upon successful authentication, it redirects to the client interface with a temporary access token. If credentials are invalid, it redirects to the login view with an error message. ```APIDOC ## POST /login ### Description Checks user credentials and redirects to the client interface with a temporary access token upon success, or to the login view with an error message upon failure. ### Method POST ### Endpoint geolytix.xyz/login ### Query Parameters - **email** (string) - Required - The email address associated with an user account. - **password** (string) - Required - The user account password. ### Response #### Success Response (Redirect) If valid credentials were provided, the redirect will access the client interface with a temporary access token. #### Failure Response (Redirect) If invalid credentials were provided, the redirect will open the login view with a message in regard to the login failure. ``` -------------------------------- ### Get Location Info and Geometry by ID Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/api/location/select/api-location-select.md Retrieves a location's information and geometry using its ID. The `infoj` parameter, which defines the fields to be queried, is taken from the workspace in memory. ```APIDOC ## GET /api/location/select/id ### Description Request a location's info and geometry by its ID. The infoj which defines the fields to be queried will be taken from the workspace in memory. ### Method GET ### Endpoint geolytix.xyz/api/location/select/id ### Parameters #### Query Parameters - **locale** (string) - Required - The locale (key) which contains the location layer. - **layer** (string) - Required - The layer (key) which contains the location table. - **table** (string) - Required - The table which holds the locations. - **id** (string) - Required - The layer qID ID of the location. - **token** (string) - Optional - A token is required to access private endpoints. ### Response #### Success Response (200) - **geomj** (string) - GeoJSON representation of the location's geometry. - **infoj** (array) - An array containing location information, including fields and their values. #### Response Example (200 OK) ```json { "geomj": "{\"type\":\"Point\",\"coordinates\":[-1.80310353310663,52.5013484988118]}", "infoj": [ { "type": "streetview" }, { "label": "ID", "field": "retailpoint_id", "type": "text", "inline": true, "value": 1010004483 }, {...} ] } ``` #### Error Response (204 No Content) Returned when the database query was successful but no records were returned. This is the case if the token does not grant access to the location. ``` 'No rows returned from table.' ``` #### Error Response (401 Unauthorized) Returned when trying to access a private endpoint with an invalid or missing token. ``` 'Invalid token.' ``` #### Error Response (406 Not Acceptable) Will be returned if parameters are missing or don't match the workspace in memory. ``` 'Invalid locale.' 'Invalid layer.' 'Missing table.' 'Missing id.' 'Invalid parameter.' ``` #### Error Response (500 Internal Server Error) Backend failed to fetch results from database table. ``` 'Failed to query PostGIS table.' ``` ``` -------------------------------- ### Generic Ordered List Configuration Source: https://geolytix.gitbook.io/xyz-developer-guide/workspaces/infoj/infoj/ordered-list.md A generic configuration for an orderedList entry, specifying the data source, geometry column, and an empty list for table columns. ```json { "type": "orderedList", "title": "Nearest competitors", // tab title "display": true, "table": "public.food_beverage", // data source "geom": "geom", // geometry column "columns": [] // holder for table columns } ``` -------------------------------- ### Aggregate GeoJSON Feature Response Source: https://geolytix.gitbook.io/xyz-developer-guide/routes/api/location/select/api-location-aggregate.md Example of a successful response containing an aggregate GeoJSON feature. The 'geomj' field holds the geometry, and 'infoj' contains aggregate data like counts. ```javascript { "geomj": "{\"type\":\"Polygon\",\"coordinates\":[[[-0.179857004199384,51.5217345604859],[-0.182423511339462,51.5218918437182],[-0.18489138904946,51.5223576459222],[-0.187165798172985,51.5231140575055],[-0.189159334442924,51.5217345604859]]]", "infoj": [ { "label": "ID count", "field": "id_count", "type": "integer", "inline": true, "fieldfx": "count(retailpoint_id)", "value": "82" } ] } ```