I need to add markers for locations matching a specific keyword on my map. Such as "hotel" for instance.
I need to obtain the sa开发者_运维百科me result as when I search for that keyword on maps.google.com, only I want this search to be done automatically using gmaps4rails. I would add my location with a different marker on top.
cheers,
joel
the process would be:
Ajax version
you already have a map from gmaps4rails displayed
submit a form remotely to your server
create the proper query on your records in your controller, simply respond with
.to_gmaps4rails
use the js
replaceMarkers
function to clear the map and display the markers from the server response.use the geolocation functions of the client browser (beware, not available on all of them) + the js
addMarkers
function to display the user position.I wrote the relevant documentation here
Standard version
get the proper objects from your controller
create the json from them
create your map
add a js callback to create the marker with user's position
精彩评论