Qurben
Qurben

Reputation: 1316

Grouping markers on city in Google Maps Api v3

I have a map with about 50 markers, I am loading the markers from kml with jQuery. I want to create a menu to quickly search for markers based on city.

For instance:

Kentucky
 shop1
 shop2
Los Angeles
 shop1
New York
 shop1
 shop2
 shop3

I my code I can access an array with all the markers.

Is it possible to do batch reverse geocoding or something? Or do I have to put the cities in my kml file so I can read that with jQuery?

Upvotes: 1

Views: 474

Answers (1)

Allan Wintersieck
Allan Wintersieck

Reputation: 873

You could loop through each marker and do a reverse geocoding request for each one, which would theoretically work. However, it will be slow, and you may run a risk of hitting the request per day limit on the Geocoding API.

I would recommend looping through and reverse geocoding on the backend somewhere, and storing the data (either in a database of some kind, or perhaps in your KML file like you mentioned).

Upvotes: 1

Related Questions