16  REST for Spatial Operations

A spatial operation query is a utility query that creates a new geometry by combining two or more geometries using a spatial operator (intersection, union or extent).

The following steps illustrate how to specify a simple spatial operation, in this case taking two GeoJSON points and combining them with the union operator to return a new GeoJSON multipoint object:

1.  Start with the host, version, and API key (substitute your own key):


2.  Add the query statement:


3.  Add the query definition in the form of a query string, in this case specifying the following properties:
- select={"type": "point", "coordinates": [-122, 37]},{"type": "point", "coordinates": [-123, 36]}: the geometries on which to perform the operation, in this case a set of two points at the specified latitude and longitude coordinates. .
- using=union: the type of spatial operation to perform, in this case a union.

?select={"type": "point", "coordinates": [-122, 37]},{"type": "point", "coordinates": [-123, 36]}&using=union

4.  Put all the pieces together and you have the complete REST path for the query:

http://query.mapfluence.com/2.0/MFDOCS/spatialops.json?select={"type": "point", "coordinates": [-122, 37]},{"type": "point", "coordinates": [-123, 36]}&using=union

This query returns the following GeoJSON structure representing the newly-created Multipoint geometry (to see the complete response body, open a browser window and enter the URL into the address field):

  "type": "MultiPoint",
  "coordinates": [

» An alternative to specifying points with GeoJSON is to use feature IDs (see /catalog/feature/<ID> at http://developer.urbanmapping.com/docs/mapfluence/rest/2.0/reference/catalog/Feature).
» For complete details on the purpose and valid values of spatial query properties, both required and optional, refer to the /spatialops.json page of the Mapfluence REST API Reference at http://developer.urbanmapping.com/docs/mapfluence/rest/2.0/reference/query/SpatialOperation.