Closed niuage closed 12 years ago
You can get the bounds of the map in js, if I recall well: Gmaps.map.serviceObject.getBounds()
So you can send it through ajax to your server.
Then use geocoder to get the markers only included within the bounds.
On 20 oct. 2012, at 00:19, niuage notifications@github.com wrote:
I'd like a way to keep all the cool features of gmaps4rails, but on a subset of the map.
Basically, I wanted to copy the layout of the great "explore" page on foursquare: https://foursquare.com/explore?cat=topPicks&near=New%20York%20NY
You can see that the map takes the whole page, but the markers are displayed on a subset.
Any simple way I could achieve that with the current features provided by the gem?
Thanks.
— Reply to this email directly or view it on GitHub.
I was thinking more of something like that:
A bit like we currently have with the auto zoom. The difference being that the autozoom wouldn't take into account the whole map, but a subset.
Actually, what you proposed might be better...
Still not sure how to get the bounds of the visible part of the map, but that's another problem not related to the gem ;)
Yes almost the same principle.
If you have auto_adjust enabled, the map, replace the markers and the map will fit your markers.
Sent from my iPhone
On 20 oct. 2012, at 00:39, niuage notifications@github.com wrote:
I was thinking more of something like that:
user search for a location get the objects near this location (server side) find a way to auto zoom so that the markers are within the visible part of the map. — Reply to this email directly or view it on GitHub.
In other words, use:
Gmaps.map.replaceMarkers(json)
To have everything handled for you.
Sent from my iPhone
On 20 oct. 2012, at 00:47, niuage notifications@github.com wrote:
Sorry, I don't see what you mean in this last sentence...
— Reply to this email directly or view it on GitHub.
Thanks.
I'd like a way to keep all the cool features of gmaps4rails, but on a subset of the map.
Basically, I wanted to copy the layout of the great "explore" page on foursquare: https://foursquare.com/explore?cat=topPicks&near=New%20York%20NY
You can see that the map takes the whole page, but the markers are displayed on a subset.
Any simple way I could achieve that with the current features provided by the gem?
Thanks.