Author:   Lars Michelsen <[email protected]>
Date:     Wed Sep  3 11:36:25 2014 +0200
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Wed Sep  3 11:36:25 2014 +0200

FIX: Tried to fix geomap_zoom parameter, but does still not work with all zoom 
levels

---

 ChangeLog                            |    2 ++
 share/server/core/sources/geomap.php |   22 ++++++++++++----------
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 31f4583..de3d47d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,8 @@ Automap:
 
 Geomap:
   * FIX: Removed map editing options from menus which make no sense
+  * FIX: Removed not working geomap types osmarender and cycle
+  * FIX: Tried to fix geomap_zoom parameter, but does still not work with all 
zoom levels
 
 1.8b6:
 Geomap:
diff --git a/share/server/core/sources/geomap.php 
b/share/server/core/sources/geomap.php
index 88ba590..ebcbb3c 100644
--- a/share/server/core/sources/geomap.php
+++ b/share/server/core/sources/geomap.php
@@ -139,9 +139,7 @@ function geomap_get_contents($url) {
 
 function list_geomap_types() {
     return array(
-        'osmarender' => 'Osmarender',
         'mapnik'     => 'Mapnik',
-        'cycle'      => 'Cycle',
     );
 }
 
@@ -184,7 +182,7 @@ $configVars = array(
     'geomap_type' => array(
         'must'       => false,
         'default'    => 'mapnik',
-        'match'      => '/^(osmarender|mapnik|cycle)$/i',
+        'match'      => '/^(mapnik)$/i',
         'field_type' => 'dropdown',
         'list'       => 'list_geomap_types',
     ),
@@ -308,22 +306,26 @@ function process_geomap($MAPCFG, $map_name, &$map_config) 
{
 
     // FIXME: Too small min/max? What is the minimum bbox size?
 
-    $mid_lat  = ($min_lat + $max_lat) / 2;
-    $mid_long = ($min_long + $max_long) / 2;
-
     //echo $min_lat . ' - ' . $max_lat. ' - '. $mid_lat.'\n';
     //echo $min_long . ' - ' . $max_long. ' - ' . $mid_long;
 
     // Using this API: http://pafciu17.dev.openstreetmap.org/
     $url = cfg('global', 'geomap_server')
-          .'?module=map&center='.$mid_long.','.$mid_lat
+          .'?module=map'
           .'&width='.$params['width'].'&height='.$params['height']
           .'&type='.$params['geomap_type'];
-          //.'&points='.$min_long.','.$max_lat.';'.$max_long.','.$min_lat;
+
     // The geomap zoom seems to be something different than the nagvis zoom. 
Use
     // the dedicated geomap_zoom parameter
-    if(isset($params['geomap_zoom']) && $params['geomap_zoom'] != '')
-        $url .= '&zoom='.$params['geomap_zoom'];
+    if(isset($params['geomap_zoom']) && $params['geomap_zoom'] != '') {
+        $mid_lat  = ($min_lat + $max_lat) / 2;
+        $mid_long = ($min_long + $max_long) / 2;
+        $url .= '&zoom='.$params['geomap_zoom']
+               .'&center='.$mid_long.','.$mid_lat;
+    }
+    else {
+        $url .= '&bbox='.$min_long.','.$max_lat.','.$max_long.','.$min_lat;
+    }
     //file_put_contents('/tmp/123', $url);
 
     // Fetch the background image when needed


------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to