This section describes how this API works. You may want to try it out with a Free Trial Account.
- HTTP Request
- URL Composition
- Base URL: https://api.cloud.precisely.com
- Spatial summary : /v1/spatial/summary
- Supported Methods: POST only
- Rate Limit (Transactions per second): 100
-
Authentication and Input Fields: Data Integrity Suite's APIs provide multiple authentication methods. Whether you want to pass the API Key and Secret directly as part of the Basic Authentication header or use bearer tokens, you can do either using the same header. The two ways of authentication are:
- Basic Authentication (Using API Key and secret)
- Bearer Token Authentication
For more information about authentication, see How to Authenticate and follow the instructions.
- URL Composition
- Response
- Content-type: application/geo+json
Description
The Spatial Summary endpoint performs calculations on geospatial data by aggregating numerical and date fields based on spatial queries. Users can perform proportional calculations and return aggregated results for a given geometry.
POST URL Format
The following format is used for HTTP POST requests:
HTTP POST:
https://api.cloud.precisely.com/v1/spatial/summarize
POST BODY:
{
"spatialOperation": "String",
"tableName": "String",
"aggregateColumns": Array { "column1": ["attribute_1", "attribute_2", "attribute_3"] },
"location": {
"format": "String",
"value": "Collection (Object_1 (longitude1 latitude1, longitude2 latitude2), Object_2 (longitude1 latitude1, longitude2 latitude2))"
},
"proportionalCalculation": Boolean
} Request Body Parameters
This operation takes these request body parameters.
| Parameter | Type | Required | Description |
|---|---|---|---|
| tableName | String | Yes | Name of the table containing the spatial data. |
| location.format | String | Yes | Format of the input geometry.
Possible values are:
|
| location.value | Object | Yes |
Input geometry or address for proximity search.
|
| location.country | String | No | Country of the address given.
This parameter is mandatory if
location.format is set to
address. |
| attributeFilter | String | No | Specifies a filter expression
to refine results based on scalar attribute
values. The filter supports logical operators
(AND, OR,
NOT) and comparison
operators such as =,
<>,
<,
<=, >,
>=, IS
NULL, LIKE,
BETWEEN, and
IN. For example,
Note: Only queryable
fields can be used in the filter expression.
|
| proportionalCalculation | Boolean | No | Determines if proportional
calculations should be applied. This parameter
is only applicable where the
spatialOperation parameter is
specified as "intersects". Possible values are:
|
| spatialOperation | String | No | The type of spatial query.
Possible values are:
|
| aggregateColumns | Array | Yes | Columns to be aggregated, grouped by additional properties. Possible values are: min, max, avg, sum |
| bufferDistance | String | No | The buffered distance around
the input geometry. If specified, the parameter
must include the value and the measurement unit.
For example, specify 100 m to
buffer the input geometry by 10 meters before
performing the spatial operation. This
parameter supports positive, zero, or
negative values for polygon input
geometries. Negative values apply an inward
buffer, which shrinks the polygon by the
specified distance (for example,
For example: |
Examples
Request
https://api.cloud.precisely.com/v1/spatial/summarize
{
"tableName": "demographics/crime_index",
"location": {
"format": "WKT",
"value": "LINESTRING (-122.430097 37.746535, -122.428817 37.744189)"
},
"spatialOperation": "intersects",
"aggregateColumns": {
"murder_idx": [
"min",
"max",
"avg",
"sum",
"median"
]
},
"bufferDistance": "2 km",
"attributeFilter": "composite_crime_idx > 50 AND composite_crime_idx < 100"
} https://api.cloud.precisely.com/v1/spatial/summarize
{
"tableName": "risks/wildfire_risk_fire_perimeter",
"location": {
"format": "WKT",
"value": "POLYGON ((-99.480306 31.989442, -101.853979 30.902225, -99.744048 30.107118, -98.117643 30.789037, -99.480306 31.989442))"
},
"spatialOperation": "within",
"proportionalCalculation": false,
"aggregateColumns": {
"acres": [
"min",
"MAX",
"avg",
"sum"
],
"objectId": [
"min",
"max",
"SUM",
"avg"
]
},
"attributeFilter": "year IN ('2020', '2021', '2024')"
}https://api.cloud.precisely.com/v1/spatial/summarize
{
"spatialOperation": "INTERSECTS",
"tableName": "risks/flood_risk",
"location": {
"format": "address",
"value": "1 Global View Troy NY",
"country": "USA"
},
"aggregateColumns": {
"id": [
"min",
"max",
"avg",
"sum"
]
},
"proportionalCalculation": true,
"bufferDistance": "10 km"
}https://api.cloud.precisely.com/v1/spatial/summarize
{
"tableName": "risks/wildfire_risk",
"location": {
"format": "address",
"value": "1 Global View Troy NY",
"country": "USA"
},
"spatialOperation": "within",
"proportionalCalculation": false,
"bufferDistance": "10 km",
"aggregateColumns": {
"INTENSITY": [
"min",
"MAX",
"avg",
"sum",
"MEDIAN"
],
"DAMAGE": [
"min",
"max",
"SUM",
"avg",
"MEDIAN"
]
}
}Response
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"murder_idx_MIN": 24,
"murder_idx_MAX": 74,
"murder_idx_AVG": 46.5,
"murder_idx_SUM": 279.0,
"murder_idx_MEDIAN": 45,
"count": 6
},
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
-122.4060706353,
37.744189
],
[
-122.4068456989,
37.7488442334
],
[
-122.4091180703,
37.7531822203
],
[
-122.4103980703,
37.7555282203
],
[
-122.4140128913,
37.7592533341
],
[
-122.4187238176,
37.7621117145
],
[
-122.4242098076,
37.7639085675
],
[
-122.430097,
37.7645214406
],
[
-122.4359841924,
37.7639085675
],
[
-122.4414701824,
37.7621117145
],
[
-122.4461811087,
37.7592533341
],
[
-122.4497959297,
37.7555282203
],
[
-122.4520683011,
37.7511902334
],
[
-122.4528433647,
37.746535
],
[
-122.4520683011,
37.7418797666
],
[
-122.4497959297,
37.7375417797
],
[
-122.4485159297,
37.7351957797
],
[
-122.4449011087,
37.7314706659
],
[
-122.4401901824,
37.7286122855
],
[
-122.4347041924,
37.7268154325
],
[
-122.428817,
37.7262025594
],
[
-122.4229298076,
37.7268154325
],
[
-122.4174438176,
37.7286122855
],
[
-122.4127328913,
37.7314706659
],
[
-122.4091180703,
37.7351957797
],
[
-122.4068456989,
37.7395337666
],
[
-122.4060706353,
37.744189
]
]
]
]
}
}
]
}{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"acres_MIN": 0.94228249,
"acres_MAX": 4354.67074478,
"acres_AVG": 710.5979324177778,
"acres_SUM": 6395.38139176,
"objectid_MIN": 2894,
"objectid_MAX": 20710,
"objectid_SUM": 51092.0,
"objectid_AVG": 5676.888888888889,
"count": 9
},
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
-99.480306,
31.989442
],
[
-101.853979,
30.902225
],
[
-99.744048,
30.107118
],
[
-98.117643,
30.789037
],
[
-99.480306,
31.989442
]
]
]
]
}
}
]
}{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"id_MIN": 5.9378700849883534,
"id_MAX": 1342434.0000000305,
"id_AVG": 1188182.2011939029,
"id_SUM": 1.47096956508E9,
"count": 1238,
"geocoding_longitude": -73.704443,
"geocoding_latitude": 42.682242
},
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
-73.82677898627004,
42.682242
],
[
-73.82261048862279,
42.705518166888766
],
[
-73.81038907190688,
42.72720810146974
],
[
-73.79094760547468,
42.74583367054555
],
[
-73.76561099313503,
42.76012557236389
],
[
-73.73610588314808,
42.769109837434314
],
[
-73.704443,
42.77217420293948
],
[
-73.67278011685191,
42.769109837434314
],
[
-73.64327500686498,
42.76012557236389
],
[
-73.61793839452531,
42.74583367054555
],
[
-73.59849692809311,
42.72720810146974
],
[
-73.58627551137721,
42.705518166888766
],
[
-73.58210701372995,
42.682242
],
[
-73.58627551137721,
42.65896583311124
],
[
-73.59849692809311,
42.63727589853026
],
[
-73.61793839452531,
42.618650329454454
],
[
-73.64327500686497,
42.604358427636114
],
[
-73.67278011685191,
42.59537416256569
],
[
-73.704443,
42.59230979706052
],
[
-73.73610588314808,
42.59537416256569
],
[
-73.76561099313503,
42.604358427636114
],
[
-73.79094760547468,
42.618650329454454
],
[
-73.81038907190688,
42.63727589853026
],
[
-73.82261048862279,
42.65896583311124
],
[
-73.82677898627004,
42.682242
]
]
]
]
}
}
]
}{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"intensity_MIN": 0,
"intensity_MAX": 19,
"intensity_AVG": 8.419753086419753,
"intensity_SUM": 4774.0,
"intensity_MEDIAN": 9,
"damage_MIN": 0,
"damage_MAX": 0,
"damage_SUM": 0.0,
"damage_AVG": 0.0,
"damage_MEDIAN": 0,
"count": 567,
"geocoding_longitude": -73.704443,
"geocoding_latitude": 42.682242
},
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
-73.82677898627004,
42.682242
],
[
-73.82261048862279,
42.705518166888766
],
[
-73.81038907190688,
42.72720810146974
],
[
-73.79094760547468,
42.74583367054555
],
[
-73.76561099313503,
42.76012557236389
],
[
-73.73610588314808,
42.769109837434314
],
[
-73.704443,
42.77217420293948
],
[
-73.67278011685191,
42.769109837434314
],
[
-73.64327500686498,
42.76012557236389
],
[
-73.61793839452531,
42.74583367054555
],
[
-73.59849692809311,
42.72720810146974
],
[
-73.58627551137721,
42.705518166888766
],
[
-73.58210701372995,
42.682242
],
[
-73.58627551137721,
42.65896583311124
],
[
-73.59849692809311,
42.63727589853026
],
[
-73.61793839452531,
42.618650329454454
],
[
-73.64327500686497,
42.604358427636114
],
[
-73.67278011685191,
42.59537416256569
],
[
-73.704443,
42.59230979706052
],
[
-73.73610588314808,
42.59537416256569
],
[
-73.76561099313503,
42.604358427636114
],
[
-73.79094760547468,
42.618650329454454
],
[
-73.81038907190688,
42.63727589853026
],
[
-73.82261048862279,
42.65896583311124
],
[
-73.82677898627004,
42.682242
]
]
]
]
}
}
]
}