This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Geographic Element Geometry Download

Downloads polygons of administrative/geographic elements (postal codes, municipalities, census sections, etc.).

    API Access

    The Geographic Element Geometry Download API allows you to retrieve the geometry (in WKT format) for administrative or geographic elements such as postal codes, municipalities, and regions. It is available via HTTP-JSON and XML services.

    Base Service URLs:

    • Supported methods: GET or POST
    • Response formats: JSON / XML

    Download Administrative Boundaries

    Retrieve the polygon geometry (in WKT format) of a municipality, postal code, or region.

    Request Parameters

    Example:

    https://lb.cercalia.com/services/v2/json?cmd=geoment&munc=ESP280796&tolerance=0&cs=4326&key=YOUR_API_KEY
    
    ParameterDescription
    munc / pcode / subregc / poicCode for the element: Municipality / Postal Code / Region / POI.
    ctrycCountry code (ISO 3-character). Mandatory when using &pcode=.
    tolerancePolygon simplification threshold in meters. If 0, returns original high-resolution data.
    csCoordinate system for the output data. Use 4326 for WGS84 (latitude, longitude).

    Request Examples:

    • Zaragoza municipality (Spain): cmd=geoment&munc=ESP502973&tolerance=0&cs=4326
    • London municipality (Westminster, UK): cmd=geoment&munc=GBRE02AP&tolerance=0&cs=4326
    • Madrid region: cmd=geoment&subregc=ESP28&tolerance=0&cs=4326
    • Postal Code 06405 (USA): cmd=geoment&pcode=06405&ctryc=USA&tolerance=0&cs=4326

    Response Structure

    The response contains the element’s metadata and its geometry represented in Well-Known Text (WKT) format.

    Example:

    {
        "cercalia": {
            "@cmd": "geoment",
            "@version": "1",
            "ge": {
                "@id": "ESP280796",
                "@name": "Madrid",
                "@type": "mun",
                "geometry": {
                    "wkt": {
                        "value": "MULTIPOLYGON(((-3.8890049 40.57087399999984,-3.889 40.570939399999844,-3.8889834 40.57101379999984,-3.888878 40.571254799999835,-3.888666 40.57174199999983,-3.888544099999999 40.57199729999983,-3.8884778 40.572142399999834,-3.88844 40.57221399999984,-3.8883928 40.57225699999984,-3.888339599999999 40.572292699999835,-3.888017399999999 40.572529699999826,-3.8876007 40.57280709999983,-3.8875219 40.57285949999983,-3.887027600000001 40.57321699999983,-3.886520199999999 40.57358899999983,-3.886051800000001 40.57392329999984,-3.885863 40.57405119999983,-3.885750899999999 40.574176399999835,-3.8856977 40.57424719999983,-3.8856455 40.57438779999983,-3.8855931 40.57448869999983,-3.885527099999999 40.57461619999983,-3.8854384 40.57480789999983,-3.8853212 40.57503979999983,-3.8852171 40.575236799999836,-3.885102199999999 40.57550639999983,-3.88392 40.578425299999836,-3.8837546 40.57898089999983,-3.883806 40.57907209999982,-3.8838146 40.57908739999982,-3.883810799999999 40.57919579999984,-3.8838043 40.57942889999984,-3.883825 40.57966389999983,-3.8838372 40.580006399999846,-3.883861299999999 40.58024219999983,-3.8839389 40.58033739999983,-3.883991799999999 40.58040569999983,-3.884031599999999 40.580462199999836,-3.8840526 40.580541099999834,-3.8841194 40.580793199999825,-3.8841975 40.581088399999835,-3.8842537 40.58124089999983,-3.884259500000001 40.58126779999982,-3.8842488 40.58130179999983,-3.8842192 40.58134209999984,-3.884190899999999 40.581385999999846,-3.8840865 40.58156459999983,-3.8835642 40.58245909999984,-3.883512 40.58254839999982,-3.8838051 40.58315049999984,-3.883843699999999 40.583239399999826,-3.883852999999999 40.58330299999984,-3.883867 40.58333899999983,-3.8838623 40.58337389999983,-3.8837968 40.58349179999984,-3.883794699999999 40.58369789999982,-3.883799 40.58379289999983,-3.8837961 40.58393789999984,-3.8838027 40.58405079999984,-3.8837879 40.584170899999826,-3.8837694 40.58434639999983,-3.8837559 40.584484299999836,-3.8837282 4..."
                    }
                },
                "capital": {
                    "@id": "ESP0058355L",
                    "@name": "Madrid",
                    "@type": "ct",
                    "name": {
                        "value": "Madrid"
                    },
                    "coord": {
                        "@x": "-3.324E-5",
                        "@y": "3.6552E-4"
                    }
                }
            },
            "server": {
                "value": "lb.cercalia.com"
            },
            "instance": {
                "value": "http://master-cercalia-lbs-both-lines"
            }
        }
    }
    

    Supported WKT Geometry Types

    The geometry is returned using the “Well-Known Text Representation for Geometry” standard.

    Geometry TypeText Literal RepresentationDescription
    PointPOINT(10 10)A single geographic point.
    LineStringLINESTRING(10 10, 20 20, 30 40)A sequence of points forming a line.
    PolygonPOLYGON((10 10, 10 20, 20 20, 10 10))A closed shape (exterior ring).
    MultiPointMULTIPOINT(10 10, 20 20)A collection of points.
    MultiLineStringMULTILINESTRING((10 10, 20 20), (15 15, 30 15))A collection of lines.
    MultiPolygonMULTIPOLYGON(((10 10, 10 20, 20 20, 10 10)), ((60 60, 70 70, 80 60, 60 60)))A collection of polygons.
    GeomCollectionGEOMETRYCOLLECTION(POINT(10 10), LINESTRING(15 15, 20 20))A heterogeneous collection of geometries.

    For more technical details, refer to the OpenGIS Simple Feature Access Specification.


    Download Street Polylines

    Retrieve the polyline geometry (in WKT format) for a specific street based on its ID or a spatial query (coordinate and radius).

    Request Parameters

    Example:

    https://lb.cercalia.com/services/v2/json?&cmd=geoment&rqge=st&mo=37.767951111,-3.790683886&mocs=gdd&cs=4326&tolerance=0&stc=&pcode=23004&rad=500&key=YOUR_API_KEY
    
    ParameterDescription
    moReference coordinate (Y,X). Optional if &stc= is provided.
    mocsCoordinate system for &mo=. Use gdd for decimal degrees.
    csOutput coordinate system. Use 4326 for WGS84.
    tolerancePolyline simplification in meters.
    stcStreet code. This parameter has priority over &mo=.
    pcodePostal code filter. Only segments within this code are returned.
    radSearch radius in meters. Limits segments returned. Priority over &pcode=.
    bufferOptional. Returns a buffer zone around the street (value in meters).

    Response Structure

    Example:

    {
        "cercalia": {
            "@cmd": "geoment",
            "@version": "1",
            "ge": {
                "@id": "ESP23050300000591837",
                "@type": "st",
                "geometry": {
                    "wkt": {
                        "value": "MULTILINESTRING((-3.790649300000001 37.76933319999975,-3.7907137 37.76908119999976,-3.7907311 37.76900819999976,-3.7907682 37.768814399999755),(-3.7907682 37.768814399999755,-3.7907879 37.76862259999975),(-3.7907879 37.76862259999975,-3.7907561 37.76813139999975),(-3.7907561 37.76813139999975,-3.790734 37.76767579999975),(-3.790734 37.76767579999975,-3.790709500000001 37.76739439999975),(-3.790709500000001 37.76739439999975,-3.790698400000001 37.767338999999744),(-3.7904563 37.769669399999756,-3.790649300000001 37.76933319999975))"
                    }
                }
            },
            "server": {
                "value": "lb.cercalia.com"
            },
            "instance": {
                "value": "http://master-cercalia-lbs-both-lines"
            }
        }
    }
    
    Geometry TypeText Literal RepresentationComment
    Point‘POINT (10 10)’ID
    LineString‘LINESTRING ( 10 10, 20 20, 30 40)’a LineString with 3 points
    Polygon‘POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))’a Polygon with 1 exteriorRing and 0 interiorRings
    Multipoint‘MULTIPOINT (10 10, 20 20)’a MultiPoint with 2 points
    MultiLineString‘MULTILINESTRING ((10 10, 20 20), (15 15, 30 15))’a MultiLineString with 2 linestrings
    MultiPolygon‘MULTIPOLYGON ( ((10 10, 10 20, 20 20, 20 15, 10 10)), ((60 60, 70 70, 80 60, 60 60 ) ))’a MultiPolygon with 2 polygons
    GeomCollection‘GEOMETRYCOLLECTION (POINT (10 10), POINT (30 30), LINESTRING (15 15, 20 20))’a GeometryCollection consisting of 2 Point values and a LineString value

    More info: OpenGIS® Implementation Specification for Geographic information - Simple feature access - Part 1: Common architecture

    Download the polyline geometry (in WKT format) of a street

    Get the polyline geometry of a street, from a street ID, or a coordinate + radius/postal code.

    Request

    Example:

    https://lb.cercalia.com/services/v2/json?&cmd=geoment&rqge=st&mo=37.767951111,-3.790683886&mocs=gdd&cs=4326&tolerance=0&stc=&pcode=23004&rad=500&key=YOUR_API_KEY
    

    Where:

    ParameterDescription
    moY,X (optional if &stc= is used).
    mocsGDD coordinate system used in &mo=.
    csCoordinate system used in data. Use 4326 for geographic system (latitude, longitude).
    tolerancePolyline simplification, in meters. If 0, returns the original data.
    stcStreet code (optional if &mo= is used). This parameter has priority over &mo=.
    pcodePostal code (optional). If used, the response includes only the street segments inside the postal code.
    radRadius (optional). If used, the response includes only street segments inside and intersected by the radius. This parameter has priority over &pcode=. Use only with &mo=, not with &stc=.
    bufferReturns a buffer around the street. Value in meters (optional).

    Response

    {
        "cercalia": {
            "@cmd": "geoment",
            "@version": "1",
            "ge": {
                "@id": "ESP23050300000591837",
                "@type": "st",
                "geometry": {
                    "wkt": {
                        "value": "MULTILINESTRING((-3.790649300000001 37.76933319999975,-3.7907137 37.76908119999976,-3.7907311 37.76900819999976,-3.7907682 37.768814399999755),(-3.7907682 37.768814399999755,-3.7907879 37.76862259999975),(-3.7907879 37.76862259999975,-3.7907561 37.76813139999975),(-3.7907561 37.76813139999975,-3.790734 37.76767579999975),(-3.790734 37.76767579999975,-3.790709500000001 37.76739439999975),(-3.790709500000001 37.76739439999975,-3.790698400000001 37.767338999999744),(-3.7904563 37.769669399999756,-3.790649300000001 37.76933319999975))"
                    }
                }
            },
            "server": {
                "value": "lb.cercalia.com"
            },
            "instance": {
                "value": "http://master-cercalia-lbs-both-lines"
            }
        }
    }
    

    Response includes a WKT with the route polyline, using standard “Well-known Text Representation for Geometry”.