Reputation: 23
I am using Geocoder Gem to generate a location's geo-position[latitude, longitude]. I am displaying the searched location as a map in
<%= image_tag "http://maps.google.com/maps/api/staticmap?size=850x300&sensor=false&zoom=16&markers=#{location.latitude}%2C#{location.longitude}" %>
Can anyone help me use a dynamic map for the same??static map's good too but the dynamic map would be even better. Does anyone know how to use a dynamic map for this??
Upvotes: 2
Views: 596
Reputation: 468
You can use <iframe>
tags.
<iframe width="300" height="300" frameborder="0" style="border:0"
src="https://www.google.com/maps/embed/v1/place?
key=YOUR_API_KEY&q=ADDRESS_OR_COORDINATES"
allowfullscreen>
</iframe>
Upvotes: 1
Reputation: 28850
Use the Maps API.
This is a JavaScript API, and you write JavaScript code to use it. There are many examples and tutorials linked on that page, along with the reference docs.
Note that you won't be using Ruby or Rails at all to do this, except for serving up the JavaScript code (likely as a static asset) and generating any dynamic data the JavaScript code needs. Other that that, it's pure JavaScript.
Upvotes: 1