Hello,
I just installed the plugin to help me display google maps in my rails
application. I checked out the site, but am having trouble understanding
what is what etc…(im slow in the head)
i am going through the code and know that my ruby skills is infant
compared to what is going on. my main question is does YM4R have a
function that i can use to pass in an address and return me a google
map?
if not, i can use another example i found online that fetches the
latitude and longitude after giving it a address, and then i can just
pass the lat and long to YM4R to get the google map.
Hello,
I just installed the plugin to help me display google maps in my rails
application. I checked out the site, but am having trouble understanding
what is what etc…(im slow in the head)
i am going through the code and know that my ruby skills is infant
compared to what is going on. my main question is does YM4R have a
function that i can use to pass in an address and return me a google
map?
No, you need to geocode the address first, although Ym4r does come
with google/yahoo geocoding methods.
Hello,
I just installed the plugin to help me display google maps in my rails
application. I checked out the site, but am having trouble understanding
what is what etc…(im slow in the head)
i am going through the code and know that my ruby skills is infant
compared to what is going on. my main question is does YM4R have a
function that i can use to pass in an address and return me a google
map?
No, you need to geocode the address first, although Ym4r does come
with google/yahoo geocoding methods.
hi snacks, what does one do with these geocoding methods that are
available with the plugin?
There are samples in the documentation. I don’t have a sample handy
as I used it once but we are using the perl version now.
Here is a sample where I pass a zip code only:
geocode = Geocoding::get(order.zip_code)
#Check to see if it was a good result or not!
if geocode.status == Geocoding::GEO_SUCCESS then
...
#Get the coords and store them or create a marker with
them.
order.latitude = geocode[0].latitude
order.longitude = geocode[0].longitude
order.save
…
else #You may have a bad zip/address
…
end
You then can create your markers with the lat/long coords. I think you
need the Gem for the geocode functions (separate from the plugin)
Hope this helps. On his website (YM4R) he has two tutorials that are
extremely helpful.
Michael
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.