Expressions

Expressions have been substantially updated and are used extensively within the HTTP API to perform analysis. Expressions can be built in SIS Desktop for testing.

You can run an expression on a map SWD or overlay (an overlay within an SWD) because different expressions require different input; some such as ST_Intersects can use a user-defined search polygon and can then return results from all overlays while other expressions such as the result of the expression will be created as a cursor.

The request below returns the parameters required to create a cursor.

http://server:port/geognosis/9/sessions/session_id/cursors.json?

{
"Operations": {
"GET": [
{
"UriTemplate": "cursors.json{?n,start,callback}",
"Description": "Get Content",
"Parameters": [
{
"Name": "n",
"Description": "Elements per page"
},
{
"Name": "start",
"Description": "Page start"
},
{
"Name": "callback",
"Description": "JSONP callback"
}
]
}
],
"OPTIONS": [
{
"UriTemplate": "cursors.json{?format,callback}",
"Description": "Get Operations",
"Parameters": [
{
"Name": "format",
"Description": "Result Representation Format"
},
{
"Name": "callback",
"Description": "JSONP callback"
}
]
}
],
"POST": [
{
"UriTemplate": "cursors.json{?source,fields,f,bbox,crs}",
"Description": "Create Cursor",
"Parameters": [
{
"Name": "source",
"Description": "Source Overlay",
"Mandatory": true
},
{
"Name": "fields",
"Description": "Cursor Fields"
},
{
"Name": "f",
"Description": "Filter Expression"
},
{
"Name": "bbox",
"Description": "Bounding Box"
},
{
"Name": "crs",
"Description": "Co-ordinate Reference System"
}
]
}
]
}
}

The required Filter Expression allows any SIS expression to be used for the creation of the cursor.

An example using POST is shown below. This uses the ST_Intersect expression to find all features in all layers of the SWD that intersect the polygon feature defined by the WKT.

POST
http://server:port/geognosis/9/sessions/sessions_id/Cursors.json?source=OverlayNumber&f=ST_Intersects(geometry,ST_GeomFromText("POLYGON((523421 223234,523449 223330,523517223241,523493223206,523421223234)),"27700")&CRS=EPSG%3A27700&BBOX=412712.12299740634,
151810.93502807253,637437.9709991355,296919.11871404136

TIP: We recommend using the BBOX (Bounding Box) parameter as this forces queries to be run in the database if the overlay is a spatial database table stored in PostGIS, SQL Server or Oracle.