CMS MADE SIMPLE FORGE

CGGoogleMaps

 

[#6400] Center problem when using "locale" config

avatar
Created By: Mathieu Muths (airelibre) (airelibre)
Date Submitted: Fri Apr 15 12:00:49 -0400 2011

Assigned To: Robert Campbell (calguy1000)
Version: 2.1.4
CMSMS Version: None
Severity: Critical
Resolution: None
State: Open
Summary:
Center problem when using "locale" config
Detailed Description:
I have a strange problem with the module. I changed the $config['locale'] to
'fr_FR' in my config.php file, in order to get correct {html_select_date}
values.

When I do that, all my GoogleMaps aren't correctly shown : the point is OK (I
can see it when I unzoom), but the map is centered on another part of the
world...very far away

When I go back to : $config['locale'] = ''; the CGGoogleMaps is correctly
displayed.

I tested this on 3 sites with different bunch of modules (one/multi points,
static/dynamic points), and It's always the same..

Thank you :)


History

Comments
avatar
Date: 2011-04-20 05:07
Posted By: Fab (alticom)

Same problem for me. 
It's seems that problem come with the decimal anotation (with locale value
fr_FR). The dot (.) in lat and long is replace with a comma (,).

If you look at code : 
center:new google.maps.LatLng(44,0000,6,00000)
Replace with (and it's work) :
center:new google.maps.LatLng(44.0000,6.00000)

I search how solve this problem in code.

See you !
      
avatar
Date: 2011-04-20 05:18
Posted By: Mathieu Muths (airelibre) (airelibre)

Thank you Fab for the help, I will try this temporary fix :)
      
avatar
Date: 2011-04-20 05:25
Posted By: Mathieu Muths (airelibre) (airelibre)

Can you tell me where is that code ? I didn't find it... Thanks
      
avatar
Date: 2011-06-07 14:56
Posted By: Jonathan Schmid (Foaly*)

i've figured it out:
lib/class.cggm_map_generator.php#68-73, use number_format in the following way:

$this->_meta['min_lat'] = number_format($min_lat, 6, '.', ',');
$this->_meta['min_lon'] = number_format($min_lon, 6, '.', ',');
$this->_meta['max_lat'] = number_format($max_lat, 6, '.', ',');
$this->_meta['max_lon'] = number_format($max_lon, 6, '.', ',');
$this->_meta['center_lat'] = number_format($center_lat, 6, '.', ',');
$this->_meta['center_lon'] = number_format($center_lon, 6, '.', ',');
      
avatar
Date: 2011-06-07 16:56
Posted By: Jonathan Schmid (Foaly*)

for better understanding: the config var triggers setlocale() which leads to a
change of decimal and thousands delimiter in php. min() and max() just above the
mentioned lines make that appear.
      
avatar
Date: 2011-10-04 04:07
Posted By: Mathieu Muths (airelibre) (airelibre)

Thank you, it works well - Would be nice to fix it in the core module  ;) Thank
you
      
avatar
Date: 2011-11-22 22:05
Posted By: Robert Campbell (calguy1000)

should be fixed in 2.1.5
      
avatar
Date: 2011-11-23 04:21
Posted By: Mathieu Muths (airelibre) (airelibre)

Thanks Robert !
      
avatar
Date: 2011-12-22 02:40
Posted By: Mathieu Muths (airelibre) (airelibre)

I think you can mark this bug as fixed, it seems to work fine now :)
      
Updates

Updated: 2011-11-22 22:05
resolution_id: => 5
cmsms_version_id: => -1