This is technically an issue for GMAP (and perhaps should be moved). However, the context for the issue lives here so that's where I'm filing the issue.

Anyway, the array structure returned by geo_wkb_get_data($wkb, 'array') is expected to be an array with numeric keys. For clarity, the array is now using the keys 'lat' and lon'. This completely breaks the simplification routine!

I am attaching a patch that may fix this issue, though I'm still seeing an abberation on polygons and linestrings.

CommentFileSizeAuthor
gmap_polyutil_latlon.patch558 bytesallie micka

Comments

becw’s picture

I also found I have to patch gmap_geo.module -- patch in progress:


diff -r 2f5ac468b256 gmap_geo.module
--- a/gmap_geo.module	Thu Apr 16 13:44:35 2009 -0500
+++ b/gmap_geo.module	Tue Jun 02 13:10:11 2009 -0500
@@ -162,7 +162,6 @@
  * Encoded polylines reveal more complexity as the map is zoomed.
  */
 function theme_gmap_geo_formatter($element) {
-  module_load_include('inc', 'geo', 'includes/geo.wkb');
   module_load_include('inc', 'gmap', 'gmap_polyutil');
 
   foreach (element_children($element) as $i) {
@@ -182,10 +181,12 @@
         $map['shapes'][] = $polyline;
         break;
       case 'polygon':
-        $polyline = gmap_polyutil_polyline($feature['value']);
+        foreach ($feature['value'] as $points) {
+          $polylines[] = gmap_polyutil_polyline($points);
+        }
         $map['shapes'][] = array(
           'type' => 'encoded_polygon',
-          'polylines' => array($polyline),
+          'polylines' => $polylines,
         );
         break;
     }

But there's a lingering issue, the encoded polylines might be malformed or something? Anyway, even with these two fixes applied they're not showing up on the map. I'll poke at it some more tonight.

becw’s picture

Status: Active » Fixed

Fixed in http://drupal.org/cvs?commit=220396 except for the lingering issue I mention here: http://drupal.org/node/429654#comment-1660822

Also, I think it makes sense to patch gmap_geo to deal with the lat/lon vs. 0/1 array keys, since GMap and the Google Maps API (v2 at least) always use 0/1 for lines and polygons.

Status: Fixed » Closed (fixed)

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