API Access
The Proximity Search API provides geofencing capabilities, real-time proximity calculations using routing and traffic data, and geometric buffer operations. It is available via HTTP-JSON and XML services.
Base Service URLs:
- Supported methods: GET or POST
- Response formats: JSON / XML
Get the N Nearest Points
Request Parameters
Example:
https://lb.cercalia.com/services/v2/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
| Parameter | Description |
|---|---|
mo | Search center coordinates (format: lat,lon or ID). |
mocs | Coordinate system (gdd for WGS84). |
rqmolist | List of points in format [lat1,lon1|ID1],[lat2,lon2|ID2],... to rank by proximity. |
rpoicats | Alternative to rqmolist: POI category codes (comma-separated) to search and rank by proximity. |
num | Maximum number of results (optional). |
rad | Maximum search radius in meters (optional). |
Response Structure
{
"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": {
"value": "lb.cercalia.com"
},
"instance": {
"value": "http://master-cercalia-lbs-both-lines"
}
}
}
| Field | Description |
|---|---|
dist | Straight-line distance from center in meters. |
pos | Proximity ranking (1 = closest). |
Get the N Nearest Points Using Routing
Request Parameters
Example:
https://lb.cercalia.com/services/v2/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
| Parameter | Description |
|---|---|
mo | Search center coordinates (format: lat,lon or ID). |
mocs | Coordinate system (gdd for WGS84). |
rqmolist | List of points in format [lat1,lon1|ID1],[lat2,lon2|ID2],... to rank by route distance/time. |
num | Maximum number of results (optional). |
rad | Maximum radius in meters (optional). |
weight | Route optimization: time (fastest), distance (shortest), money (fastest avoiding tolls), realtime (with live traffic). |
iweight | Use realtime to get current traffic-based route times. |
inverse | Direction: 0 = center to points, 1 = points to center. |
Routing Based on Departure Time:
| Parameter | Description |
|---|---|
weight | sptime (fastest based on departure time) or spmoney (fastest avoiding tolls based on departure time). |
departuretime | Departure date/time in ISO 8601 format (e.g., 2019-10-16T07:30:12Z). Required when using sptime/spmoney. |
Response Structure
{
"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": {
"value": "lb.cercalia.com"
},
"instance": {
"value": "http://master-cercalia-lbs-both-lines"
}
}
}
| Field | Description |
|---|---|
dist | Straight-line distance in meters. |
routedist | Actual route distance in meters. |
routetime | Route travel time in milliseconds. |
routeweight | Route optimization value (based on selected weight). |
Get Buffer of Polylines/Polygons (WKT Format)
Request Parameters
Example:
https://lb.cercalia.com/services/xmlgeo?cmd=buffergeoms
| Parameter | Description |
|---|---|
geoms | Comma-separated list of geometries in format `[wkt |
srs | Spatial reference system (default: EPSG:4326 for WGS84). |
buffer | Buffer distance in meters. |
tolerance | Geometry simplification distance in meters (default: 0). Optional. |
Response Structure
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 Points Within Geometries
Request Parameters
| Parameter | Description |
|---|---|
geoms | Comma-separated list of geometries in format `[wkt |
srs | Spatial reference system for geometries (default: EPSG:4326). |
molist | List of points in format `[x,y |
mocs | Spatial reference system for points (default: EPSG:4326). |
Response Structure
For each geometry, returns the list of points located inside it.
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>