Plotting zipcodes on a map

Using the Tomtom Javascript Web API, how can a list of zipcodes be plotted on a map?

Would also be nice to increase/decrease the plotted point (pin) size based on a measure associated
with each zipcode - this is optional.

Been able to plot zipcodes on a map (using approx. long/lat for each).

Now after adding a few locations, how can they all be viewed - a bounding region for the locations
must be defined somehow, such that the TT API knows how to fit all locations on a viewable map.

Using the WEB API:

Here is an example:

var bounds = new tt.LngLatBounds();
locations.forEach(function(point) {
map.fitBounds(bounds, { duration: 0, padding: 50 });

Getting back to “increase/decrease the plotted point (pin) size”:
what do you want to place as a pin? a geojson shape or an image?
both can have different sizes, so while drawing them you can specify somehow the size based on available data

Przemek -

Thankyou very much.

The API call ‘tt.LngLat.convert(point)’ expects a geo point ({lng:x,lat:y}).

Is there a conversion offered in web TT API that will take a zipcode and return a geo point {lng:x,lat:y} ?

  • Kevin

Just noticed that the call to ‘map.fitBounds(…)’ is generating an error:

To get coordinates of a zip code you can try with Geocoding:

Just put a zip code in query field.