tags:

views:

678

answers:

4

hello to all, i have the following scenario: 1. i will keep a list of stores locations (coordinates and info) 2. will "feed' relevant info from that list to Google map object 3. the user can search for stores around a given radius from their home 4. the generated map will display markers of stores if any are found.

so far, i'm good.. NOW: after such a map has been generated and markers placed in it, how can i retrieve (hopefully from the Google object) a list of all included stores/markers ? -- the idea here is that my client wants to store the users' address along with the stores close to their home.

any help would be highly appreciated, thanx in advance

A: 

http://stackoverflow.com/questions/1349442/google-maps-api-create-a-store-locator seems to be the same question. I'm still working through a similar problem myself. I'll contribute on the other question if I'm able to add anything after working through the documentation and other answers.

Step
A: 

eventually i tackled the issue from another direction: 1. get lat & lng of user's address using geo.getLocations 2. check distance from all stores in Db (lat lng already stored in Db) using a php function 3. write link in html for each store that's within desired radius 4. link opens a window with google map containing address and store location as markers

long story short: First crate the list, THEN display maps.. = no need to try extract data from the map.

i guess there are better ways to go about it - this one did it for me.. i will gladly submit the code in detail to anyone interested. it involves combination of js, php and some jquery ajax.

samoyed
A: 

samoyed

I am faced with the same problem you had, If you have a fix I would be interested in seeing the code in detail.

Thanks

jlevy

Jlevy
eventually i used i different approach - see my own answer above yours. i will gladly help if there is some way to contact you - couldn't find such option in stackoverflow..
samoyed
A: 

I would do this:

//points is an array of LatLng items

var bounds = map.getBounds()

for (i=0,len=points.length;i<len;i++) {
  if (bounds.contains(points[i])) {
    //do your stuff with the visible item
  }
}
Yves De Bruyne