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

Only A Map Displayed #294

Closed murtyk closed 11 years ago

murtyk commented 11 years ago

Rails 3.2.7 Postgres

Instead of User, I am using Address model:

Followed the instructions and the view displays a map. I am having 2 issues:

  1. The map is zoomed out so much the I have to zoom in couple of times to see it. It first shows Africa. I need it to be centered NJ USA to show the locations in Address table.
  2. No markers displayed. Checked the address table and found that longitude and latitude are null for all addresses.

Code in controller:

def map_homes
    @json = Address.all.to_gmaps4rails
end

in view:

<%= gmaps4rails(@json) %>

Please help.

apneadiving commented 11 years ago

Can't tell.

What's the js produced within html source?

Sent from my iPhone

On 17 nov. 2012, at 23:33, murtyk notifications@github.com wrote:

Rails 3.2.7 Postgres

Instead of User, I am using Address model:

Followed the instructions and the view displays a map. I am having 2 issues:

The map is zoomed out so much the I have to zoom in couple of times to see it. It first shows Africa. I need it to be centered NJ USA to show the locations in Address table.

No markers displayed. Checked the address table and found that longitude and latitude are null for all addresses.

Code in controller:

def map_homes @json = Address.all.to_gmaps4rails end in view:

<%= gmaps4rails(@json) %>

Please help.

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

murtyk commented 11 years ago

here is the html code from the browser. Sorry for the lengthy code. I am a noob and don't know which part you are interested in.

<!DOCTYPE html>

School | Teachers

Student Locations

Number of Homes:
```
``` Powered By Tiny Circles
```
--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
```

action: map_homes
controller: schools
id: '1'
murtyk commented 11 years ago

I would like to close this. Here is the explanation:

  1. The address table already has data before using the gem. The existing addresses were not geocoded.
  2. Updated all the addresses and it started working.

May be I missed this aspect in the documentation. It might help others if it is clearly mentioned.

apneadiving commented 11 years ago

Ok, please consider uodating doc then!

Sent from my iPhone

On 18 nov. 2012, at 04:02, murtyk notifications@github.com wrote:

I would like to close this. Here is the explanation:

The address table already has data before using the gem. The existing addresses were not geocoded.

Updated all the addresses and it started working.

May be I missed this aspect in the documentation. It might help others if it is clearly mentioned.

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

murtyk commented 11 years ago

I am a noob and never done it. But will give it a try.