Proximity search

Geofencing search, real proximity using routing and traffic info.

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
ParameterDescription
moSearch center coordinates (format: lat,lon or ID).
mocsCoordinate system (gdd for WGS84).
rqmolistList of points in format [lat1,lon1|ID1],[lat2,lon2|ID2],... to rank by proximity.
rpoicatsAlternative to rqmolist: POI category codes (comma-separated) to search and rank by proximity.
numMaximum number of results (optional).
radMaximum 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"
        }
    }
}
FieldDescription
distStraight-line distance from center in meters.
posProximity 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
ParameterDescription
moSearch center coordinates (format: lat,lon or ID).
mocsCoordinate system (gdd for WGS84).
rqmolistList of points in format [lat1,lon1|ID1],[lat2,lon2|ID2],... to rank by route distance/time.
numMaximum number of results (optional).
radMaximum radius in meters (optional).
weightRoute optimization: time (fastest), distance (shortest), money (fastest avoiding tolls), realtime (with live traffic).
iweightUse realtime to get current traffic-based route times.
inverseDirection: 0 = center to points, 1 = points to center.

Routing Based on Departure Time:

ParameterDescription
weightsptime (fastest based on departure time) or spmoney (fastest avoiding tolls based on departure time).
departuretimeDeparture 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"
        }
    }
}
FieldDescription
distStraight-line distance in meters.
routedistActual route distance in meters.
routetimeRoute travel time in milliseconds.
routeweightRoute optimization value (based on selected weight).

Get Buffer of Polylines/Polygons (WKT Format)

Request Parameters

Example:

https://lb.cercalia.com/services/xmlgeo?cmd=buffergeoms
ParameterDescription
geomsComma-separated list of geometries in format `[wkt
srsSpatial reference system (default: EPSG:4326 for WGS84).
bufferBuffer distance in meters.
toleranceGeometry 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

ParameterDescription
geomsComma-separated list of geometries in format `[wkt
srsSpatial reference system for geometries (default: EPSG:4326).
molistList of points in format `[x,y
mocsSpatial 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>
Last modified January 5, 2026: fix: syntax error on markdowns (6801857)