Highlighting borders of state and cities of US in Google Map API 3

True. Google does not provide this feature. So what we can do… we can have the lat/long of the borders of the state. And we have to draw polygons ourselves.

I used this JS object. And changed it to Google map object (google.maps.LatLng).

For example:

var statesobj = {"AK": [new google.maps.LatLng(70.0187, -141.0205),
new google.maps.LatLng(70.1292, -141.7291),
new google.maps.LatLng(70.4515, -144.8163)]}

So, it’s easy now. Loop on these lat/longs. And you can draw the polygons on every state of US.

So this is the solution I came up. If you guys know some better idea to do it. Please share.

Leave a Comment