-
Notifications
You must be signed in to change notification settings - Fork 11
Layer Descriptor Geometry Section
In order to configure the connector to work with geospatial data in different formats, we need to use the layer descriptor sections of the service descriptor to specify what the geometry data looks like and what indexes to uses.
Note: The only coordinate system currently supported is "wgs84" or "wgs84/double" as Koop requires the results to be in WGS84 so additional logic will be required to translate from the other coordinate reference systems.
Geometry data are used for two purposes: 1) Limiting the features that are returned when a client uses a geometry to query for features and, 2) Returning the geometry part of the features to clients.
To support this, the connector uses the geometry
property of each layer descriptor to determine what indexes to use to query as well as how to "extract" the geometry data to return. The geometry
property is made up of the following properties:
"geometry" : {
"type" : "<Point|Polygon>",
"format" : "<geojson|wkt|gml|kml|rss|mcgm|custom|any|cts>", // The format of the geometry data the connector must deal with
"coordinateSystem" : "wgs84",
"source" : {
"xpath" : "<the XPath to the geometry data that should be extracted from the document>"
OR
"column" : "<the column in the result row that is a string containing the serialized geometry>"
"format" : "<geojson|wkt|gml|kml|rss|mcgm|custom|any|cts>", // Optional: If the format of geometry data that will be extracted is different than the indexed format, override it using format at this level
},
"indexes" : {
// The indexes that should be used to query for features. See below for more details.
}
}
The layer descriptor can have a geometry
property with one of the following configurations. The type
should be set to "Point" for documents with single or multiple points.
Note: If no
geometry
property is present the connector will assume the point data are formatted as GeoJSON.
"geometry" : {
"type" : "Point",
"format" : "geojson",
"coordinateSystem" : "wgs84|wgs84/double|etrs89|etrs89/double|raw|raw/double"
}
When this format is specified, the following geospatial query will be used
const geojson = require('/MarkLogic/geospatial/geojson');
geojson.geospatialQuery(regions, ["coordinate-system=" + coordinateSystem]);
See https://docs.marklogic.com/geojson.geospatialQuery for more details.
And the following XPath will be used to select the point geometry data
//geometry
"geometry" : {
"type" : "Point",
"format" : "gml",
"pointFormat" : "point|long-lat-point",
"coordinateSystem" : "wgs84|wgs84/double|etrs89|etrs89/double|raw|raw/double"
}
When this format is specified, the following geospatial query will be used
const geojson = require('/MarkLogic/geospatial/geogml');
geogml.geospatialQuery(regions, ["coordinate-system=" + coordinateSystem]);
See https://docs.marklogic.com/geogml.geospatialQuery for more details.
And the following XPath will be used to select the point geometry data
//Q{http://www.opengis.net/gml/3.2}Point/Q{http://www.opengis.net/gml/3.2}pos/xs:string()
"geometry" : {
"type" : "Point",
"format" : "kml",
"coordinateSystem" : "wgs84|wgs84/double|etrs89|etrs89/double|raw|raw/double"
}
"geometry" : {
"type" : "Point",
"format" : "rss",
"coordinateSystem" : "wgs84|wgs84/double|etrs89|etrs89/double|raw|raw/double"
}
"geometry" : {
"type" : "Point",
"format" : "mcgm",
"coordinateSystem" : "wgs84|wgs84/double|etrs89|etrs89/double|raw|raw/double"
}
"geometry" : {
"type" : "Point",
"format" : "any",
"coordinateSystem" : "wgs84|wgs84/double|etrs89|etrs89/double|raw|raw/double"
}
When this format is specified, the following geospatial query will be used
const geo = require('/MarkLogic/geospatial/geospatial');
geo.geospatialQuery(regions, ["coordinate-system=" + coordinateSystem]);
See https://docs.marklogic.com/geojson.geospatialQuery for more details.
And the following XPath will be used to select the point geometry data
TBD
If the geospatial data is not in one of the above common formats, use the "custom" type and list the index(es) that should be used.
"geometry" : {
"type" : "Point",
"format" : "custom",
"coordinateSystem" : "wgs84|wgs84/double|etrs89|etrs89/double|raw|raw/double",
"indexes" : {
"element" : [
{
"namespaceUri" : "",
"localname" : "location",
"coordinateSystem" : "wgs84",
"pointFormat" : "point|lon-lat-point"
}
],
"elementChild" : [
{
"parentNamespaceUri" : "",
"parentLocalname" : "location",
"namespaceUri" : "",
"localname" : "point",
"coordinateSystem" : "wgs84",
"pointFrmat" : "point"
}
],
"elementPair" : [
{
"parentNamespaceUi": "",
"parentLocalname": "location",
"latitudeNamespaceUri": "",
"latitudeLocalname": "lat",
"longitudeNamespaceUri": "",
"longitudeLocalname": "lon",
}
],
"elementAttributePair" : [
{
"parentNamespaceUri" : "",
"parentLocalname" : "location",
"latitudeNamespaceUri" : "",
"latitudeLocalname" : "lat",
"longitudeNamespaceUri" : "",
"longitudeLocalname" : "lon",
"coordinateSystem" : "wgs84"
}
],
"path" : [
{
"pathExpression" : "//geometry[type = \"Point\"]//array-node(\"coordinates\")",
"coordinateSystem" : "wgs84",
"pointFormat" : "long-lat-point"
}
]
}
}