How to display map of a U.S. zip code?

I am new to the tomtom maps API and was wondering if there was a way to display a map of a zip code? Something similar to the photo below.

Hey :slight_smile:

It is possible, although you need to use two different services from TomTom Web SDK services library, one after another.

For Geography type of results, (including countries, municipalities and other administrative units like zip code areas) TomTom Geocode services add IDs of geometries with boundaries for this area. And to get such geometry, you need to send a request with such ID that can be fetched from the AdditionaData service. Once you have the actual geometry, you can display it on the map :slight_smile:

Therefore I recommend having a look at these two examples here

  • Structured Geocode - you can make a request with a country code & postal code. This way you will get info about the zip code area in the response, including this geometryId
  • Polygons for reverse geocoder results - this example will show you how to retrieve geometryID from geocode response and how to use it to get the actual geometry with additionalDataService

Documentation for both services:

Here’s a simplified code snippet with such flow:{
  key: 'YOUR_API_KEY',
  countryCode: 'US',
  postalCode: '60612'
}).then(function(response) {
   const zipCodeGeometryId = response.results[0];{
     key: 'YOUR_API_KEY',
     geometries: [ zipCodeGeometryId ],
     geometryZoom: 11
   }).then(function (response) {
      const geometryData = response...;
      // display the geometry on the map
         // ...