Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

plot choropleth using google maps

I have a data set of {zip code, value} pairs and would like to visualize it on a map.

Let's say my data set structure is:

{
"pageType": "ZIP",
"ZIP": {
    "90638": {
        "OVERALL": "320.00"
    },
    "75594": {
        "OVERALL": "2985.02"
    },
    "10997": {
        "OVERALL": "55554.2"
    }
  }
}

I want to plot this set of zip codes on Google Maps using a colored area corresponding to the zip codes, like on the screenshot below.

d3js or highcharts will not work because they have a location file for a country for plotting the graph. In my case I want to implement it for any country in the world, so I need to use Google Maps.

Any idea heatmap

like image 877
Saurabh Sinha Avatar asked Jan 20 '26 12:01

Saurabh Sinha


1 Answers

Have you considered using OpenStreetMap shapefiles or perhaps their Nominatim service to get polygon data for administrative boundaries? This is way, way easier than trying to wring that data out of Google Maps, and you can then display it however you want.

For instance, here are the state boundaries of Gujarat in GeoJSON format, and the equivalent HTML view from the Nominatim service.

like image 175
candu Avatar answered Jan 23 '26 02:01

candu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!