This is the documentation of version 1.0.0-rc.2. Go to the latest version, 1.0.0-rc.5.
TomTom Maps for JavaScript
    Preparing search index...

    Type Alias CommonPlacesParams<ApiRequest, ApiResponse>

    CommonPlacesParams: CommonServiceParams<ApiRequest, ApiResponse> & {
        extendedPostalCodesFor?: SearchIndexType[];
        limit?: number;
        mapcodes?: MapcodeType[];
    }

    The parameters the places services share.

    Search, geocoding, and reverse geocoding use them to customise query behaviour, filter results, and control response formatting.

    Type Parameters

    • ApiRequest

      The API request type (typically URL or FetchInput)

    • ApiResponse

      The API response type

    Type Declaration

    • OptionalextendedPostalCodesFor?: SearchIndexType[]

      The indexes for which results include extended postal codes.

      Extended postal codes carry more detailed postal code information, including sub-divisions and hierarchical structures.

      By default, extended postal codes are included for all indexes except Geo. Geographic entities can have very long postal code lists, so you must request them explicitly when needed.

      A regular postal code is "10001" (basic ZIP code), and an extended one "10001-1234" (ZIP+4 format).

      Note that including them for geographies can significantly increase response size.

      // Include for addresses and POIs only
      extendedPostalCodesFor: ['PAD', 'Addr', 'POI']

      // Include for all types including geographies
      extendedPostalCodesFor: ['Geo', 'PAD', 'Addr', 'Str', 'XStr', 'POI']
    • Optionallimit?: number

      The maximum number of results in a single response, which controls pagination.

      Fuzzy search and geocoding page with cursor, as CommonGeocodeAndFuzzySearchParams.cursor describes.

      The range is 1 to 100. Higher limits increase response size and processing time, and lower limits improve performance. For large result sets, use pagination.

      10
      
      limit: 20   // Get 20 results
      limit: 5 // Get only top 5 results
      limit: 100 // Maximum allowed
    • Optionalmapcodes?: MapcodeType[]

      The mapcode representations to request for locations.

      Mapcodes are short, human-friendly location codes that can represent any location on Earth to within a few meters. They're easier to remember and communicate than coordinates.

      The mapcode types are:

      • Local: Short codes valid within a specific territory (e.g., "49.4V" in Netherlands)
      • International: Codes that work globally (e.g., "NLD 49.4V")
      • Alternative: Alternative representations for the same location

      Use them for:

      • Emergency services (shorter than full addresses)
      • Areas without formal addressing systems
      • Easy verbal communication of locations
      • Navigation to precise spots
      // Get all mapcode types
      mapcodes: ['Local', 'International', 'Alternative']

      // Get only local mapcodes
      mapcodes: ['Local']

    They apply to:

    They cover:

    • Result limits and pagination
    • Geographic biasing for location-aware results
    • Additional data inclusion (mapcodes, extended postal codes)
    • Geopolitical view context for disputed territories
    // Search with mapcodes and specific geopolitical view
    const detailedSearch: CommonPlacesParams<URL, Response> = {
    geopoliticalView: 'IN', // India's perspective
    mapcodes: ['Local', 'International'],
    extendedPostalCodesFor: ['PAD', 'POI'],
    limit: 5
    };

    // Address search with extended postal codes
    const addressSearch: CommonPlacesParams<URL, Response> = {
    extendedPostalCodesFor: ['Geo', 'PAD', 'Addr'],
    limit: 15
    };