Proximity search
Geofencing search, real proximity using routing and traffic info.
Web Services
Proximity search API documentation,
URL base service:
- HTTP requests in GET or POST
- Response in JSON / XML format
Get the N nearest points
Request
Example:
https://lb.cercalia.com/services/json?cmd=prox&mo=42.369140,-3.489919|CENTER&mocs=gdd&rqmolist=%5b40.369140,-3.589919|A%5d,%5b40.367223,-3.583056|B%5d&num=2&key=YOUR_API_KEY
Where:
Parameter | Description |
---|---|
mo | Search center, format: lat, lon |
mocs | gdd Coordinate system (gdd = geographical - lat, long) |
rqmolist | List of points (coordinates) to be ordered by proximity, in format `[lat1,lon1 |
rpoicats | (Alternative to rqmolist ) List of POIs categories (separated by commas) to be searched, ordered by proximity |
num | Maximum number of points to return (optional) |
rad | Maximum radius, in meters (optional) |
Response
{
"cercalia": {
"cmd": "prox",
"version": "1",
"proximity": {
"center": "-3.48991895,42.369141",
"num": "2",
"type": "mo",
"molist": {
"num": "2",
"mo": [
{
"dist": "222546",
"id": "A",
"pos": "1",
"coord": {
"x": "-3.5899194",
"y": "40.36914023"
}
},
{
"dist": "222739",
"id": "B",
"pos": "2",
"coord": {
"x": "-3.58305627",
"y": "40.36722322"
}
}
]
}
},
"server": {
"$valor": "lb.cercalia.com"
},
"instance": {
"$valor": "http://cercalia-lbs-both-lines"
}
}
}
Where:
Parameter | Description |
---|---|
dist | Projected straight-line distance, in meters |
pos | Proximity order (from closest to least) |
Get the N nearest points, using routing
Request
Example:
https://lb.cercalia.com/services/json?cmd=prox&mo=42.369140,-3.489919|CENTRO&mocs=gdd&rqmolist=%5b40.369140,-3.589919|A%5d,%5b40.367223,-3.583056|B%5d&weight=time&num=2&key=YOUR_API_KEY
Where:
Parameter | Description |
---|---|
mo | Search center, format: lat, lon |
mocs | gdd Coordinate system (gdd = geographical - lat, long) |
rqmolist | List of points (coordinates) to be ordered by proximity, in format `[lat1,lon1 |
num | Maximum number of points to return (optional) |
rad | Maximum radius, in meters (optional) |
weight | Route type: |
time : faster | |
distance : shortest | |
money : faster, avoiding tolls | |
realtime : quickest, considering real-time traffic data | |
iweight | realtime : Complementary to &weight= . Use this parameter to obtain the route time, based on the current traffic state, keeping the route path. |
inverse | If |
0 : Route times are from the center to the point list | |
1 : Route times are from the list of points to the center |
Routing based on departure time:
Parameter | Description |
---|---|
weight | Route type: |
sptime : quickest, based on departure time | |
spmoney : quickest, based on departure time and avoiding toll roads | |
departuretime | Departure date and time, in ISO 8601 format. Example: 2019-10-16T07:30:12Z (UTC time). Mandatory to include the &weight= parameter. |
Response
{
"cercalia": {
"cmd": "prox",
"version": "1",
"proximity": {
"center": "-3.48991895,42.369141",
"inverse": "0",
"num": "2",
"type": "mo",
"weight": "time",
"molist": {
"num": "2",
"mo": [
{
"dist": "222739",
"id": "B",
"pos": "1",
"routedist": "267696",
"routerealtime": "8705039",
"routetime": "8705039",
"routeweight": "8705039",
"coord": {
"x": "-3.58305627",
"y": "40.36722322"
}
},
{
"dist": "222546",
"id": "A",
"pos": "2",
"routedist": "267294",
"routerealtime": "8725122",
"routetime": "8725122",
"routeweight": "8725122",
"coord": {
"x": "-3.5899194",
"y": "40.36914023"
}
}
]
}
},
"server": {
"$valor": "lb.cercalia.com"
},
"instance": {
"$valor": "http://cercalia-lbs-both-lines"
}
}
}
Where:
Parameter | Description |
---|---|
dist | Projected straight-line distance, in meters. |
routedist | Route distance, in meters. |
routetime | Route time, in milliseconds. |
Get the buffer of one or more polylines / polygons, in WKT format
Request
Call parameters:
https://lb.cercalia.com/services/xmlgeo?cmd=buffergeoms
Parameter | Description |
---|---|
geoms | List of geometries separated by commas. Each geometry has the following format: `[wkt |
srs | Coordinates system. Default: geographical coordinates (EPSG:4326). |
buffer | Buffer, in meters. |
tolerance | Optional. Geometry simplification, in meters (default: 0 meters). |
Response
Example:
<cercalia cmd="buffergeoms" version="1">
<buffergeoms>
<geometry id="1"> POLYGON((-3.708452 40.411246, -3.708434 40.411191, -3.706925 40.411582, -3.705362 40.412022, -3.708362 40.411294, -3.708452 40.411246))</geometry >
<geometry id="2"> POLYGON((-3.708452 40.411246, -3.708434 40.411191, -3.706925 40.411582, -3.705362 40.412022, -3.708362 40.411294, -3.708452 40.411246))</geometry>
</buffergeoms>
</cercalia>
Geofencing: Get the points that are within one or more geometries
Request
Call parameters:
Parameter | Description |
---|---|
geoms | List of geometries separated by commas. Each geometry has the following format: `[wkt |
srs | Coordinates system. Default: geographical coordinates (EPSG:4326). |
molist | List of points, in MO format `[x,y |
mocs | Coordinates system (MOLIST). Default: EPSG:4326. |
Response
Fer each geometry returns the list of points located insinde.
Request example:
https://lb.cercalia.com/services/xmlgeo?cmd=insidegeoms&geoms=[CIRCLE(2.2090 41.4141, 12)|ID1],[CIRCLE(2.3090 41.4141, 5)|ID2]&srs=epsg:4326&molist=[2.2090,41.4141|P1],[2.3090,41.4141|P2]&mocs=gdd
Response
<cercalia cmd="insidegeoms" version="1">
<insidegeoms>
<geometry id=”ID1”>
<wkt> CIRCLE(2.2090 41.4141, 12)</wkt>
<molist num=”1”>
<mo id=”P1”>
<coord x=”2.2090” y=”41.4141”>
</mo>
</molist>
</geometry>
<geometry id=”ID2”>
<wkt> CIRCLE(2.3090 41.4141, 5)</wkt>
<molist num=”1”>
<mo id=”P2”>
<coord x=”2.3090” y=”41.4141”>
</mo>
</molist>
</geometry>
</insidegeoms>
</cercalia>