@cercalia/sdk
    Preparing search index...

    Class GeomentService

    GeomentService - Downloads polygon geometries of administrative/geographic elements

    Supported elements:

    • Municipalities (munc)
    • Regions/Subregions (subregc)
    • Postal Codes (pcode)
    • Points of Interest (poic)

    Following Golden Rules:

    • Direct mapping from API response (no fallbacks)
    • Code suffix for identifiers (@id -> code)
    • Transparency of geometry type via level field
    • Strict coordinate handling (no defaults)

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Configuration for the Cercalia API connection.

    Methods

    • Get geometry for a municipality or region

      Parameters

      Returns Promise<GeographicElementResult>

      GeographicElementResult with WKT polygon

      // Madrid municipality
      const result = await service.getMunicipalityGeometry({
      munc: 'ESP280796',
      tolerance: 0
      });

      // Madrid region
      const region = await service.getMunicipalityGeometry({
      subregc: 'ESP28',
      tolerance: 0
      });
    • Get geometry for a Point of Interest

      Parameters

      Returns Promise<GeographicElementResult>

      GeographicElementResult with WKT polygon/point

      // POI geometry
      const result = await service.getPoiGeometry({
      poic: 'POI123456',
      tolerance: 0
      });
    • Get geometry for a postal code

      Parameters

      Returns Promise<GeographicElementResult>

      GeographicElementResult with WKT polygon

      // US postal code
      const result = await service.getPostalCodeGeometry({
      pcode: '06405',
      ctryc: 'USA',
      tolerance: 0
      });
    • Executes a generic request to the Cercalia API.

      Type Parameters

      • T

      Parameters

      • params: Record<string, string>

        Query parameters for the API request.

      • operationName: string = 'Cercalia Request'

        Human-readable name for logging and debugging.

      • OptionalbaseUrl: string

        Optional override for the base API URL.

      Returns Promise<T>

      A promise resolving to the parsed API response.

      Error with code '30006' when no results are found.

      Error for HTTP errors or invalid JSON responses.

      const response = await this.request<MyResponse>(
      { cmd: 'cand', adr: 'Gran Via 1' },
      'Geocoding'
      );