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

    Type Alias GeometrySearchParams

    GeometrySearchParams: CommonSearchParams<
        GeometrySearchRequestAPI,
        GeometrySearchResponseAPI,
    > & { geometries: SearchGeometryInput[] }

    Parameters for searching places within specific geographic areas (geometry search).

    Geometry search finds places that fall within or near the boundaries of one or more geometric shapes (polygons, circles, or multipolygons). Use it for area-based searches such as "restaurants in this neighborhood" or "hotels within these city boundaries".

    Type Declaration

    • geometries: SearchGeometryInput[]

      List of geometries to search within.

      It can mix polygons, multipolygons, circles, or geometry feature collections from previous search results. The search returns places that fall within or near these geometries.

      The API documentation calls it "geometryList".

      The supported types are:

      • Circle - Circular search area with radius
      • Polygon - Custom polygon boundary (GeoJSON)
      • MultiPolygon - Multiple polygon areas (GeoJSON)
      • PolygonFeatures - Feature collection with polygon geometries

      Only a polygon's outer ring is sent, so holes are ignored. The ring is sampled down to 50 vertices, and a MultiPolygon of more than 50 polygons keeps its 50 largest. Any other geometry type rejects with a plain Error.

      // Multiple geometries
      geometries: [
      { type: 'Circle', coordinates: [4.9, 52.3], radius: 500 },
      { type: 'Polygon', coordinates: [[...]] }
      ]

    Pass these to discoverPlaces, which picks the request variant from the params you give it. A route property selects along-route search, a geometries property selects geometry search, and neither selects fuzzy search.

    Geometry search searches within multiple geometries at once and supports polygons, multipolygons and circles. It can use geometries from previous search results, and combines with text queries for filtered results. Use it to find POIs within administrative boundaries, search within custom areas drawn on the map, filter results to specific neighbourhoods or regions, or run proximity searches with circles.

    // Search within a circular area
    const results = await discoverPlaces({
    query: 'restaurant',
    geometries: [{
    type: 'Circle',
    coordinates: [4.9041, 52.3676],
    radius: 1000 // meters
    }]
    });
    // Search within a polygon
    const results = await discoverPlaces({
    query: 'parking',
    geometries: [{
    type: 'Polygon',
    coordinates: [[
    [4.88, 52.36],
    [4.90, 52.36],
    [4.90, 52.38],
    [4.88, 52.38],
    [4.88, 52.36]
    ]]
    }]
    });