seven1m/onebody

Directory Map Not Showing All Families/Profiles

Closed this issue · 21 comments

For some reason the first few people I put into the system showed up on the Directory Map. This was cool as I got to see the "footprint" of our members. However as I kept adding new members, the map wasn't changing. I can go into the members and select "View on map" and it brings up the map location and all looks right, but they still don't show on the overall Directory Map.

Additionally, when viewing the Family screen, for people not showing up in the Directory Map, they aren't getting the map image at the top of their "Family" page either. However, I can click on "View on Map" and it take me directly to their map location.

I've run through the address information in the families table of the DB and can't find any garbage or hidden characters that would be causing an issue.

This gets stranger and stranger, I can't figure out any pattern on what is happening... However, I entered in two different families that live on the same street, just a few doors down from each other. One is showing on the map and the other isn't.

By the way these are all being manually keyed into the system, no imports...

The banner uses open street map and the View on map link uses Google Maps.

It is quite common for new neighborhoods not to show up in OpenStreetMap/Map Quest/etc and be seen inside of Google Maps. I think this may be the case here. OpenStreetMap is community driven whereas people are paid to work on Google Maps.

I think this is a case of address not found on open street map.

The issue isn't so much about the OpenStreet banner, as much as it is about Google Maps... I just happened to notate there is a correlation. If I click on "View on Map" the pointer comes up showing the location. However, when I click on the Directory Map, the location isn't showing.

@ViperSBT this seems to be related to Google rate limiting geocoding requests. If you edit the family and click save, does the map update?

No luck. I went in and edited a family and saved them. Still no map showing in the banner, I can click on the View on Map link and Google Maps takes me right there, but when I go to find them on the Map Directory, they are not showing.

Search for their address on Google maps - the pointer goes to the right location.

Search for their address on OpenStreeMap - pointer is in the same spot for both addresses.


I still don't think this is a bug with Onebody.

Whatever is generating the Directory Map is having a problem. Where the "bug" is I can't say, but it is definitely not work... I am more than happy to provide whatever assistance I can to help track this down and resolve it.

@ViperSBT both of those addresses should geocode just fine.

[18] pry(main)> Geocoder.search('334 Garey Loop, Savannah, TN 38372').first.data['geometry']['location']
=> {"lat"=>35.2427485, "lng"=>-88.23056350000002}
[19] pry(main)> Geocoder.search('245 Garey Loop, Savannah, TN 38372').first.data['geometry']['location']
=> {"lat"=>35.241467, "lng"=>-88.230142}

I don't know what the problem is! Can you try this in a console?

fam = Family.find(123)
fam.geocode
fam.latitude
fam.longitude

(where 123 is the ID number of the family record, which you can get from the URL on the family page)

...and then paste the results here?

Here is what I got, but don't think it is what you were looking for:

@bryson:/var/www/onebody$ irb
irb(main):001:0> fam = Family.find(13)
NameError: uninitialized constant Family
        from (irb):1
        from /usr/bin/irb:11:in `<main>'
irb(main):002:0> fam.geocode
NoMethodError: undefined method `geocode' for nil:NilClass
        from (irb):2
        from /usr/bin/irb:11:in `<main>'
irb(main):003:0> fam.latitude
NoMethodError: undefined method `latitude' for nil:NilClass
        from (irb):3
        from /usr/bin/irb:11:in `<main>'
irb(main):004:0> fam.longitude
NoMethodError: undefined method `longitude' for nil:NilClass
        from (irb):4
        from /usr/bin/irb:11:in `<main>'

@ViperSBT sorry about that, I wasn't very clear at all!

You need to run the Rails console, like this:

onebody run console

...then you can type the commands I gave:

fam = Family.find(13)
fam.geocode
fam.latitude
fam.longitude

Newsflash, I'm not proficient in Rails... :)

@bryson:/var/www/onebody$ onebody run console
onebody: command not found
@bryson:/var/www/onebody$ irb
irb(main):001:0> onebody run console
NameError: undefined local variable or method console' for main:Object from (irb):1 from /usr/bin/irb:11:in

'
irb(main):002:0> exit

OH! I'm sorry, I assumed you installed via the Debian package. Instead of onebody run console try bin/rails console or just rails console.

We'll get there enventually.. :)

@bryson:/var/www/onebody$ rails console /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/mysql2-0.4.3/lib/mysql2/client.rb:87:inconnect': Access denied for user 'onebody'@'localhost' to database 'onebody_dev' (Mysql2::Error)
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/mysql2-0.4.3/lib/mysql2/client.rb:87:in initialize' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/mysql2_adapter.rb:18:innew'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/mysql2_adapter.rb:18:in mysql2_connection' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:innew_connection'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in checkout_new_connection' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:inacquire_connection'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in block in checkout' from /usr/lib/ruby/2.3.0/monitor.rb:214:inmon_synchronize'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in checkout' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:inblock in connection'
from /usr/lib/ruby/2.3.0/monitor.rb:214:in mon_synchronize' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:inconnection'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:571:in retrieve_connection' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_handling.rb:113:inretrieve_connection'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_handling.rb:87:in connection' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/model_schema.rb:230:intable_exists?'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/attribute_methods/primary_key.rb:97:in get_primary_key' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/attribute_methods/primary_key.rb:85:inreset_primary_key'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/attribute_methods/primary_key.rb:73:in primary_key' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/core.rb:132:infind'
from /var/www/onebody/lib/console.rb:3:in block in <class:ConsoleRailtie>' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/railtie.rb:224:inblock in run_console_blocks'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/railtie.rb:245:in each' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/railtie.rb:245:ineach_registered_block'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/railtie.rb:224:in run_console_blocks' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:472:inblock in run_console_blocks'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/engine/railties.rb:13:in each' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/engine/railties.rb:13:ineach'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:472:in run_console_blocks' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/engine.rb:438:inload_console'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/commands/console.rb:58:in initialize' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/commands/console.rb:9:innew'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/commands/console.rb:9:in start' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:68:inconsole'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in run_command!' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/commands.rb:17:in<top (required)>'
from bin/rails:4:in require' from bin/rails:4:in

'
@bryson:/var/www/onebody$ bin/rails console
/var/www/onebody/vendor/bundle/ruby/2.3.0/gems/mysql2-0.4.3/lib/mysql2/client.rb:87:in connect': Access denied for user 'onebody'@'localhost' to database 'onebody_dev' (Mysql2::Error) from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/mysql2-0.4.3/lib/mysql2/client.rb:87:ininitialize'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/mysql2_adapter.rb:18:in new' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/mysql2_adapter.rb:18:inmysql2_connection'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in new_connection' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:incheckout_new_connection'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in acquire_connection' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:inblock in checkout'
from /usr/lib/ruby/2.3.0/monitor.rb:214:in mon_synchronize' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:incheckout'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in block in connection' from /usr/lib/ruby/2.3.0/monitor.rb:214:inmon_synchronize'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in connection' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:571:inretrieve_connection'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_handling.rb:113:in retrieve_connection' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_handling.rb:87:inconnection'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/model_schema.rb:230:in table_exists?' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/attribute_methods/primary_key.rb:97:inget_primary_key'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/attribute_methods/primary_key.rb:85:in reset_primary_key' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/attribute_methods/primary_key.rb:73:inprimary_key'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/core.rb:132:in find' from /var/www/onebody/lib/console.rb:3:inblock in class:ConsoleRailtie'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/railtie.rb:224:in block in run_console_blocks' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/railtie.rb:245:ineach'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/railtie.rb:245:in each_registered_block' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/railtie.rb:224:inrun_console_blocks'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:472:in block in run_console_blocks' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/engine/railties.rb:13:ineach'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/engine/railties.rb:13:in each' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:472:inrun_console_blocks'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/engine.rb:438:in load_console' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/commands/console.rb:58:ininitialize'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/commands/console.rb:9:in new' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/commands/console.rb:9:instart'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:68:in console' from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:inrun_command!'
from /var/www/onebody/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/commands.rb:17:in <top (required)>' from bin/rails:4:inrequire'
from bin/rails:4:in <main>' @bryson:/var/www/onebody$

Uggg, ok try RAILS_ENV=production rails console.

Sorry!

@ViperSBT thanks for sending the output. (I deleted the comment because it contained personal information.)

I believe you used the wrong family ID. Try the same thing with the proper family ID and see if the latitude and longitude comes back. Thanks!

(And next time, you can scrub the personal identifying info from your paste. Thanks!)

While it is a different family, it suffers the same problem. There are probably over 20 families that this is affecting.

Here is another....
console.txt

So this tells me that geocoding is working just fine. Both of your example addresses were turned into latitude and longitudes.

If you go and look at those families in OneBody now, do they show a map?

Nope, still not working. Look at these two images. One shows the Directory Map and the other shows View On Map from the family page.
screenshot_2
screenshot_3

As far as I can tell, this works perfectly when I use those addresses. I cannot find anything wrong with the geocoder.

My one last thought on the subject is that maybe there is some confusion about who should show up on the map and how privacy settings affect the map display.

Here are the reasons someone's marker may not show on a map:

  • Person visible attribute is set to false. This is set on the "privacy" page.
  • Family visible attribute is set to false. This is also set on the "privacy" page.
  • Person is not "active". If their status is "inactive" or "pending", then they will not show on the map.