Geospatial
In Cognite Data Fusion (CDF), the geospatial endpoint is the base entry point for many resource types that enable storing and querying item collections that have a geospatial nature. Those items, features in Geographic Information System (GIS) terminology, are grouped in feature types. Features of the same type share several properties (a name, a type, and a value) and have more than one spatial representation stored in configurable properties.
In addition, and following the Open Geospatial Consortium recommendations, each spatial representation should have an associated Coordinate Reference System (CRS), but this isn't mandatory. The Geospatial API also enables feature search using filters of arbitrary complexity, with a boolean expression of conditions on the properties. Defining a feature type is up to the client, and CDF geospatial doesn't come with pre-configured schemas and provides excellent flexibility for modeling the client problem domain.
See the Geospatial API documentation for more information.
See Geospatial Examples for Python SDK examples.
Authentication and authorization
All HTTP endpoints served by the Geospatial API require a valid ticket from the Auth service.
Feature type and feature related endpoints require the GEOSPATIAL capability (READ or WRITE).
CRS related endpoints require the GEOSPATIAL_CRS capability to be enabled (READ or WRITE). Note that reading the predefined CRSs is possible with the GEOSPATIAL capability.
Data sets
Feature types and Features support using data sets. Since feature types define the specification of features, you must set these access capabilities:
READ
access for the feature type to do any operations (create, update, get by ids, search, and aggregate) on the corresponding features.WRITE
access for all features of a feature type to delete the feature type.
However, there are no constraints on data set specified on a feature and its corresponding feature type. Features of a feature type can belong to different data sets.
Example
Assuming that
- data set 1234 isn't write-protected
- data set 5678 is write-protected
- feature type FT1 has data set ID 1234
- feature type FT2 has data set ID 5678
- feature type FT3 doesn't have data set ID.
geospatial:read:1234
indicates READ capability of geospatial objects within data set ID 1234.
geospatial:read:all
indicates READ capability of geospatial objects within all scopes.
dataset:owner:5678
indicates OWNER capability of data set ID 5678.
Scenario | Required access |
---|---|
Read feature type FT1 | geospatial:read:1234 or geospatial:read:all |
Read feature type FT3 | geospatial:read:all |
Create feature type FT4 with data set id 1234 | geospatial:write:1234 or geospatial:write:all |
Create feature type FT4 with data set id 5678 | dataset:owner:5678 and (geospatial:write:5678 or geospatial:write:all ) |
Create feature type FT4 without data set id | geospatial:write:all |
Read feature X (data set id 5678) of feature type FT1 | (geospatial:read:1234 and geospatial:read:5678 ) or geospatial:read:all |
Read feature X (data set id 1234) of feature type FT3 | geospatial:read:all |
Create feature Y (data set id 1234) of feature type FT1 | (geospatial:read:1234 or geospatial:read:all ) and (geospatial:write:1234 or geospatial:write:all ) |
Create feature Y (data set id 5678) of feature type FT1 | (geospatial:read:1234 or geospatial:read:all ) and (geospatial:write:5678 or geospatial:write:all ) and dataset:owner:5678 |
Create feature Y without data set id of feature type FT1 | (geospatial:read:1234 or geospatial:read:all ) and (geospatial:write:all ) |
CRSs don't support data sets.
Feature types
A CDF feature type defines a class of spatial features with a common specification. The specification defines the property names and their types and the indexes to support to fulfill performance requirements a client might have. Indexing properties come at a price when creating features, and it's crucial to consider whether an index is necessary or not. The choice depends on the size and number of entries for a given feature type and the frequency of access to that particular property.
Features
A feature is an item following the specification given by its corresponding feature type. A parallel with a class and an object is valid.
Properties
Default properties
Feature types predefined properties
Feature types have predefined properties that enable close integration with the rest of the CDF. These properties are:
Name | Type | Description |
---|---|---|
externalId | String | The standard CDF external id. |
createdTime | Timestamp | The standard CDF resource item created time. |
lastUpdatedTime | Timestamp | The standard CDF resource item last update time. |
dataSetId | Long | The standard CDF data set id. |
Feature predefined properties
Features have the same predefined properties and in addition the assetIds
property which has a list of internal asset ids of linked assets:
Name | Type | Description |
---|---|---|
externalId | String | The standard CDF external id. |
createdTime | Timestamp | The standard CDF resource item created time. |
lastUpdatedTime | Timestamp | The standard CDF resource item last update time. |
dataSetId | Long | The standard CDF data set id. |
assetIds | Array[Long] | The standard CDF internal asset ids (links). |
Reserved property names
The following property names are reserved for future use:
- id
- metadata
- defaultGeometry
- defaultRaster
- labels
Property types
You can find the GeoJSON specification at GeoJSON and the Well-Known-Text specification at Open Geospatial Consortium.
2D
The Geospatial service supports the following vector types, located in a 2-dimensional space, each as an X and a Y coordinate:
Type | Description | Example WKT | Example Geojson |
---|---|---|---|
POINT | A simple point . | POINT(1 -1) | {"type": "Point", "coordinates": [1, -1]} |
LINESTRING | A simple linestring specified by two or more distinct POINTs. | LINESTRING(0 0, 1 1, 1 -1, 3 4) | {"type": "LineString", "coordinates": [[0, 0], [1, 1], [1, -1], [3, 4]]} |
POLYGON | A set of closed LINESTRINGs. A polygon must have exactly one exterior ring and can have one or more inner rings. | POLYGON(
| {"type": "Polygon", "coordinates": [[[35, 10], [45, 45], [15, 40], [10, 20], [35, 10]], [[20, 30], [35, 35], [30, 20], [20, 30]]]} |
MULTIPOINT | A set of POINTs. | MULTIPOINT(-1 1, 0 0, 2 3) | |
MULTILINESTRING | A set of LINESTRINGs. | MULTILINESTRING((0 0,0 1,1 1), (-1 1,-1 -1)) | |
MULTIPOLYGON | A set of POLYGONs. | MULTIPOLYGON(((2.25 0,1.25 1,1.25 -1,2.25 0)),((1 -1,1 1,0 0,1 -1))) |
3D
The Geospatial service supports the following vector types, located in a 3-dimensional space, each as an X, Y, and Z coordinate. The GeoJSON notation don't support the following vector types:
Type | Description | Example WKT |
---|---|---|
POINTZ | A simple point. | POINTZ(1 -1 1) |
LINESTRINGZ | A linestring in 2D specified by two or more distinct POINTZs | LINESTRINGZ(0 0 2, 1 1 3, 1 -1 4, 3 4 5) |
POLYGONZ | A set of closed LINESTRINGZ. A polygon must have exactly one exterior ring and can have one or more inner rings. | POLYGONZ(((35 10 3, 45 45 4, 15 40 4, 10 20 5, 35 10 3), (20 30 3, 35 35 4, 30 20 5, 20 30 3)) |
MULTIPOINTZ | A set of POINTZs. | MULTIPOINTZ(-1 1 1, 0 0 3, 2 3 2) |
MULTILINESTRING | A set of LINESTRINGZs. | MULTILINESTRINGZ((0 0 1, 0 1 2, 1 1 3), (-1 1 2, -1 -1 2)) |
MULTIPOLYGON | A set of POLYGONZs. | MULTIPOLYGONZ(((2.25 0,1.25 1,1.25 -1,2.25 0)),((1 -1,1 1,0 0,1 -1))) |
The fact that a geometry has a Z coordinate doesn't make it a volumetric geometry. It remains a planar 2D geometry described in a 3D space.
2D + measurement / time
The Geospatial service supports the following vector types, located in a 2-dimensional space plus an extra measure, each as an X, Y, and M coordinates. The GeoJSON notation doesn't support the below vector types:
Type | Description | Example WKT |
---|---|---|
POINTM | A simple point. | POINTM(1 -1 1122) |
LINESTRINGM | A linestring in 2D specified by two or more distinct POINTMs. | LINESTRINGM(0 0 2, 1 1 3, 1 -1 4, 3 4 5) |
POLYGONM | A set of closed LINESTRINGMs. A polygon must have exactly one exterior ring and can have one or more inner rings. | POLYGONM(((35 10 3, 45 45 4, 15 40 4, 10 20 5, 35 10 3), (20 30 3, 35 35 4, 30 20 5, 20 30 3)) |
MULTIPOINTM | A set of points. | MULTIPOINTM(-1 1 1, 0 0 3, 2 3 2) |
MULTILINESTRINGM | A set of LINESTRINGMs. | MULTILINESTRINGM((0 0 1, 0 1 2, 1 1 3), (-1 1 2, -1 -1 2)) |
MULTIPOLYGONM | A set of POLYGONMs. | MULTIPOLYGONM(((2.25 0,1.25 1,1.25 -1,2.25 0)),((1 -1,1 1,0 0,1 -1))) |
The M coordinate is convenient to associate a measure with a point in space. Without the M coordinate, you'd require an extra property (of array type, not supported by the service) to store the measurement. The M coordinate doesn't require a spatial interpretation, and its unit isn't related to the X, Y, and Z coordinates. The M coordinate remains unchanged when the geometry gets transformed.