开发者

gmaps4rails: HOW TO automatically add makers for locations matching a key word

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

  1. you already have a map from gmaps4rails displayed

  2. submit a form remotely to your server

  3. create the proper query on your records in your controller, simply respond with .to_gmaps4rails

  4. use the js replaceMarkers function to clear the map and display the markers from the server response.

  5. use the geolocation functions of the client browser (beware, not available on all of them) + the js addMarkers function to display the user position.

  6. I wrote the relevant documentation here

Standard version

  1. get the proper objects from your controller

  2. create the json from them

  3. create your map

  4. add a js callback to create the marker with user's position

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜