/selection resource
The /selection resource represents the selection capabilities of Weave. In Weave, selections are a set of unique identifiers against an entity.
E.g.: For property entity (corresponding to addresspoi layer), a selection may consist of the entityId ('property') and a list of unique featureids, each denoting a single property.
The /selection resource supports stateful operations, i.e. for an authenticated user session, Weave will add, delete or modify selections and perform other operations based on the selections that are stored in the user session.
For /selection resource to function properly, the server must support user sessions. Additionally, the following parameter must be set:
-Dcom.cohga.server.stateless=false
Sub-resources
1. /selection/sizes
Provides the current selection size of all available entities.
Example 1
curl -X GET --header 'Accept: application/json' 'http://localhost:8080/weave/services/v1/selection/sizes'
Output
2. /selection/size/{entity}
Provides the current size of the selection for the specified entity, i.e. number of features selected for the given entity.
Example 2
curl -X GET --header 'Accept: application/json' 'http://localhost:8080/weave/services/v1/selection/size/property?includeids=true'
Output
{ "count": 1, "entity": "property", "ids": [ "1048996_11_Smith_Avenue_106_Albion_Park_DP793040" ] }
3. /selection/clear
Clear the current selection for all available entities.
Example 3
curl -X GET --header 'Accept: application/json' 'http://localhost:8080/weave/services/v1/selection/clear/property'
Output
4. /selection/clear/{entity}
Clear the current selection for the entity.
Example 4
curl -X GET --header 'Accept: application/json' 'http://localhost:8080/weave/services/v1/selection/clear/property'
Output
{ "count": 0, "entity": "property", "ids": [] }
5. /selection/envelope/{entityId}
Return the envelope for the current selection of an entity.
Example 5
curl -X GET --header 'Accept: application/json' 'http://localhost:8080/weave/services/v1/selection/envelope/property?crs=EPSG%3A3857'
Output
[ 1.6834772405E7, -4014396.738, 1.6834849184E7, -4014320.354 ]
6. /selection/centroid/{entityId}
Return the centroid for the current selection of an entity.
Example 6
curl -X GET --header 'Accept: application/json' 'http://localhost:8080/weave/services/v1/selection/centroid/property?crs=EPSG%3A3857'
Output
[16834811.92234551,-4014360.4169504736]
7. /selection/put/{entityId}/{featureId}
Manipulate selection by Feature Id.
Example 7
curl -X GET --header 'Accept: application/json' 'http://localhost:8080/weave/services/v1/selection/put/property/19064_Unit_16_70-78_Cook_Road___Centennial_Park?crs=EPSG%3A3857&operator=REPLACE'
Output
{ "centroid": { "crs": "EPSG:3857", "x": 16834811.92234551, "y": -4014360.4169504736 }, "count": 1, "entity": "property", "ids": [] }
8. /selection/put
Allows the manipulation of selections by specifying geometrical shapes.
Parameters:
POST body parameter example:
{ "operator": "REPLACE", "shapeType": 0, "x": 16830987.54667605, "y": -4009701.4948807703, "entities": "property,lot_size", "crs": "EPSG:3857", "includeids": true }
operator - selection operation
type: String constant
accepted values:
- REPLACE - replaces any existing selections, if none exists, creates a new selection
- ADD - adds the specified selections to the current selection
- REMOVE - removes the specified selections from the current selection
- REFINE - Keeps only those items found in the current selection that are contained in the specified selections
- EXCHANGE - Implements the XOR operator between the current selection and the specified selection, "one or the other but not both"
shapeType - geometrical shape
type: integer constant
accepted values:
- 0 - Point
- 1 - Polygon with 4 vertices
- 2 - Line connecting 2 points
- 3 - Point with an optional buffer around it
- 4 - Linestring - a line connecting 2 or more points
- 5 - Linear ring - a closed linestring with 4 or more points
<map coordinate parameters> - depending on the shapeType, various map coordinate parameters may be provided
E.g. x, y for Point,
x,y,radius for Point with buffer
entities - comma-separated list of strings - entities whose features are to be selected
crs - string - coordinate reference system that any coordinates are provided in
includeids - boolean - indicates whether to include feature ids in the response from the server
Return value
Accept header | Return value example | Description |
---|---|---|
application/json | JSON object containing a 'path' describing the current selection |
Example 1
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ \ "operator": "REPLACE", \ "shapeType": 0, \ "x": 16830987.54667605, \ "y": -4009701.4948807703, \ "entities": "property,lot_size", \ "crs": "EPSG:3857", \ "includeids": true \ }' 'http://localhost:8080/weave/services/v1/selection/put'
Output
{ "results": [ { "count": 1, "entity": "property", "ids": [ "1933692_3_Paul_Street__A_Balmain_East_DP450005" ] }, { "count": 1, "entity": "lot_size", "ids": [ "36299" ] } ] }