-1

I have project in which I am trying to display the 20 closest people in a fusion table to the current center of map with the click of a button. I currently have the the lat and long as a static number, need that to change based on the maps current center. A link for what I currently have is http://www.mappingcenter.org/little_flock/littleflock.html>.

I am new to js and I truly am puzzled.

2 Answers2

1

the getCenter()-method returns the center of a google.maps.Map-instance:

orderBy:'ST_DISTANCE(geo_latitude, LATLNG('+map.getCenter().lat()+','+map.getCenter().lng()+'))'
Dr.Molle
  • 116,463
  • 16
  • 195
  • 201
1

You can do this using GViz with order by and limit 20.

Query: "SELECT geometry FROM "+FusionTableID+" ORDER BY ST_DISTANCE(geometry, LATLNG("+map.getCenter().toUrlValue(6)+")) LIMIT 10"

example (with limit 10) which gets the 10 nearest points to a click on the map

geocodezip
  • 158,664
  • 13
  • 220
  • 245