As per #457822: Latitude and Longitude set to 180, 360, sometimes Location data needs additional latitude/longitude validation, beyond just checking that it is not empty. I added this validation to the Location module's location_has_coordinates() function, but that function is not currently being leveraged by gmap_plugin_style_gmap->render().

My current fix is to change the foreach() loop that renders the markers as follows:

if ((!empty($lat) && !empty($lon))
		 && ($lat != 0 && $lon != 0)
		 && ($lat != 180 && $lon != 360)) {

(That comes in around line 99 of gmap_plugin_style_gmap.inc.)

Once I have added this code, all the problems I previously experienced with GMap centering have disappearing. It would be great if someone can test this code to see whether it resolves issues for them.

Let me know if you need me to roll a proper patch. I'm swamped with work right now, but I may get around to it soon.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

EvanDonovan’s picture

Title: GMap Views Plugin needs Additional Validation for Adding Markers » Autozoom Fix: GMap Views Plugin needs Additional Validation for Adding Markers

Clarifying title.

EvanDonovan’s picture

Title: Autozoom Fix: GMap Views Plugin needs Additional Validation for Adding Markers » Autozoom Fix: GMap Views Plugin needs Additional Latitude/Longitude Validation for Adding Markers
Version: 6.x-1.1-rc1 » 6.x-1.x-dev
FileSize
600 bytes

Attached the patch against latest dev. (Needs to be applied from within gmap directory.)

podarok’s picture

Version: 6.x-1.x-dev » 7.x-2.x-dev
Status: Needs review » Needs work

please, provide patch against latest dev

Jerenus’s picture

podarok’s picture

Status: Needs work » Needs review

We should bump needs review for testbot working )

Status: Needs review » Needs work

The last submitted patch, gmap-validation_for_adding_markers-457828-4.patch, failed testing.

podarok’s picture

Undefined index: user_latitude Notice location.module line 692
from test
needs work

johnv’s picture

Status: Needs work » Needs review
podarok’s picture

Status: Needs review » Fixed

#4 commited pushed to 7.x-2.x
thanks!!!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

brandy.brown’s picture

patch did not fix anything for me.

^ doesn't matter; upgraded to latest version and everything works great yay!