In my Ruby on Rails website, I have a tool that lets users create a driving route with Google Maps API V3. My goal is to give the user an option of clicking a "Show Nearby Points-of-Interest" checkbox before loading the map. If he does, I want the map to show POIs along the route.
I've implemented RouteBoxer, which I believe is my best option for finding Points of Interest along the route. Routeboxer is working for me; it draws boxes around any route I create. This is where I'm stuck, however. I've just got my route and a bunch of boxes on the screen. How can I actually get the latitude and longitude bounds from RouteBoxer?
I'm fairly new to both Ruby and Google Maps API V3, so sorry if I'm blowing past an obvious way of doing this. Any detail or code you can provide / link to would be fantastic! Thanks again for your time!
as part of myfunction calcRoute() {I wanted to see if this was working. So, at the very end of my script, I added:document.getElementById("south").innerHTML = longsouth;document.getElementById("west").innerHTML = latwest;
I don't know Ruby, but maybe the missing link is you need to use a
'AJAX' style programming model
http://en.wikipedia.org/wiki/Ajax_(programming)
Maybe:
http://guides.rubyonrails.org/ajax_on_rails.html
?
The actual database querying happens in a server script accessed from
the webpage. The demo I showed queries an API from the Geograph
website (the host of the images being displayed) - so you needs your
server to expose a similar API.
Source for one, I made a long time ago...
http://nearby.org.uk/google/googleMaps.xml.phps
I am trying to follow along here, but don't understand where you moved the code to. I don't see "varsouth" anywhere. Can you post your code? Here is mine...trying to follow along:
// Perform search over this bounds
}
//Get the Lat and Long of the RouteBoxer
getNorthEast(bounds);
getSouthWest(bounds);
var northeast = bounds.getNorthEast();
var southwest = bounds.getSouthWest();
var lateast = northeast.lat();
var longnorth = northeast.lng();
var latwest = southwest.lat();
var longsouth = southwest.lng();
--