apneadiving / Google-Maps-for-Rails

Enables easy Google map + overlays creation in Ruby apps
https://apneadiving.github.io/
MIT License
2.26k stars 382 forks source link

Map shown is off by few miles #284

Closed andeepak closed 11 years ago

andeepak commented 11 years ago

This is the same issue #170, when I use Geocoder gem and use the Google static map It works fine. When I render using gmaps4rails its off by a few miles. What should I do be doing ? How are rest of the folks using this ?

apneadiving commented 11 years ago

Mmmm, ok.

I close this one and reopen the first

andeepak commented 11 years ago

Thanks that was really fast

apneadiving commented 11 years ago

Actually, your issue is different from #170:

So I'm still wondering from where your problem could stem.

apneadiving commented 11 years ago

Could I have lat/lng from one of the mismatched positions?

andeepak commented 11 years ago

The issue #170 was raised by one of the folks who worked on my code base. I have used Geocoder Gem and your gem in the same model now. I pass the same venue, street and city to both the gems, i render the other one with static image which points to the exact location and in the gmaps4rails its off by a few miles

apneadiving commented 11 years ago

So it's a geocodung issue too? You're not using the coordinates you got from Geocoder?

Sent from my iPhone

On 4 nov. 2012, at 16:01, andeepak notifications@github.com wrote:

The issue #170 was raised by one of the folks who worked on my code base and i have used Geocoder Gem and your gem in the same model now. I pass the same venue, street and city to both the gems, i render the other one with static image which points to the exact location and in the gmaps4rails its off by a few miles

— Reply to this email directly or view it on GitHub.

andeepak commented 11 years ago

Venue: Ravindra Kalakshetra Street: Jayachamarajendra Road City: Bangalore

from geocoder gem this is the coordinates : [ 77.5848457, 12.9627892 ], which is right and from your gem longitude : 77.5945627 , latitude : 12.9715987, which is a few miles off

apneadiving commented 11 years ago
Gmaps4rails.geocode 'Ravindra Kalakshetra, Jayachamarajendra Road, Bangalore'
 => [{:lat=>12.9627892, :lng=>77.5848457, :matched_address=>"Jayachamaraja Rd, Bangalore, Karnataka, India", :bounds=>{"northeast"=>{"lat"=>12.9639446, "lng"=>77.5853178}, "southwest"=>{"lat"=>12.9614188, "lng"=>77.5840862}}, :full_data=>{"address_components"=>[{"long_name"=>"Jayachamaraja Rd", "short_name"=>"Jayachamaraja Rd", "types"=>["route"]}, {"long_name"=>"Bangalore", "short_name"=>"Bangalore", "types"=>["locality", "political"]}, {"long_name"=>"Bengaluru Urban", "short_name"=>"Bengaluru Urban", "types"=>["administrative_area_level_2", "political"]}, {"long_name"=>"Karnataka", "short_name"=>"KA", "types"=>["administrative_area_level_1", "political"]}, {"long_name"=>"India", "short_name"=>"IN", "types"=>["country", "political"]}], "formatted_address"=>"Jayachamaraja Rd, Bangalore, Karnataka, India", "geometry"=>{"bounds"=>{"northeast"=>{"lat"=>12.9639446, "lng"=>77.5853178}, "southwest"=>{"lat"=>12.9614188, "lng"=>77.5840862}}, "location"=>{"lat"=>12.9627892, "lng"=>77.5848457}, "location_type"=>"GEOMETRIC_CENTER", "viewport"=>{"northeast"=>{"lat"=>12.9640306802915, "lng"=>77.5860509802915}, "southwest"=>{"lat"=>12.9613327197085, "lng"=>77.5833530197085}}}, "types"=>["route"]}}] 

u = User.create(name: 'foo', address: 'Ravindra Kalakshetra, Jayachamarajendra Road, Bangalore')
u.longitude
=>  77.5848457 
u.latitude
=> 12.9627892 
andeepak commented 11 years ago

hmmm ok my bad, i think that was the reverse geocoding, looks like only rendering is the issue then from gmaps4rails, could be an issue in the JS ?

apneadiving commented 11 years ago

The rounding is a source of imprecision but as demonstrated before, it's not a big deal.

I'll look at the js later. Could you confirm the lat/lng of in your model are what you expect them to be?

Sent from my iPhone

On 4 nov. 2012, at 16:49, andeepak notifications@github.com wrote:

hmmm ok my bad, i think that was the reverse geocoding, looks like only rendering is the issue then from gmaps4rails, could be an issue in the JS ?

— Reply to this email directly or view it on GitHub.

andeepak commented 11 years ago

Well the the latitude and longtitude same as above 77.5848457, 12.9627892. I have seen some inconsistency in the rendering. thats when the issue #170 was opened. Thanks for patiently answering all my questions. Let me do some more playing around with this issue, I will close it as of now and reopen it if I see any issues during the course of this week. Once again thanks a ton

apneadiving commented 11 years ago

Ok, will reread js again.

thanks for feedback, it's always useful.