Brian Barthold
Brian Barthold

Reputation: 1623

Google map api v3 markers exclude a city or certain bound

I am using google maps api v3. I have a database of markers with lat and long address that I display on a map and that works fine.

The map is displaying markers for entire state and now I want to know how can exclude markers in a certain city? Say I am displaying a map of Indiana and want to exclude Indianapolis.

I have a rough idea where I can select the points and some how check if they are between a certain range but could someone elaborate on this with a more specific example or is there a better approach to this?

Upvotes: 2

Views: 707

Answers (1)

Rudy
Rudy

Reputation: 7044

What you need is something called Reverse Geocoding, which will give you result of street name, city name and country name, given longitude latitude example.

I will do these steps :

  1. Iterate all the marker and "reverse geocoding" the marker lat-long.
  2. Check city result of the "reverse geocoding".
  3. If the City is not inside your accepted cities, remove the marker.

Upvotes: 1

Related Questions