Author:   Lars Michelsen <[email protected]>
Date:     Mon May  7 15:53:04 2012 +0200
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Mon May  7 15:53:04 2012 +0200

Several geomap improvements

* Added parameter geomap_zoom (Geomap zoom is not given as percentage zoom
  (http://wiki.openstreetmap.org/wiki/Zoom_levels)
* Added main config option geomap_server to configure the url to the mapping
  webservice (Default is now http://geomap.nagvis.org/)
* Default geomap type is now Mapnik (Had problems in the past with others)

---

 ChangeLog                                        |    7 +++++++
 docs/en_US/geomap.html                           |    3 ++-
 docs/en_US/nagvis_config_format_description.html |   19 +++++++++++++++++++
 share/server/core/classes/GlobalMainCfg.php      |   12 ++++++++++--
 share/server/core/sources/geomap.php             |   17 ++++++++++++-----
 5 files changed, 50 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index bc525eb..a25fd47 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -21,6 +21,13 @@ Frontend
   * Improved scrolling eventhandler
   * Bugfix: Fixed page/background scaling on open sidebar menu
 
+Geomap
+  * Added parameter geomap_zoom (Geomap zoom is not given as percentage zoom
+    (http://wiki.openstreetmap.org/wiki/Zoom_levels)
+  * Added main config option geomap_server to configure the url to the mapping
+    webservice (Default is now http://geomap.nagvis.org/)
+  * Default geomap type is now Mapnik (Had problems in the past with others)
+
 1.6.6
 Frontend
   * Bugfix: Fixed JS error in template object management dialog
diff --git a/docs/en_US/geomap.html b/docs/en_US/geomap.html
index 6a58a0e..b19b9c0 100644
--- a/docs/en_US/geomap.html
+++ b/docs/en_US/geomap.html
@@ -56,8 +56,9 @@ muc-srv1;Munich Server1;48.1448353;11.5580067</pre>
         the fourth then LONG coordinate.</p>
         
         <h2>Configuring geomaps</h2>
-        <p>There are no special map attributes for the geomaps. The geomap 
source uses view parameters for
+        <p>There are no special map config attributes for the geomaps. The 
geomap source uses view parameters for
         configuration. For details take a look at the modify view dialog which 
can be opened using the header
         menu "Actions -> Modify view".</p>
+        <p>The view parameters can also be given as map configuration 
attributes in the global section of the maps.</p>
     </body>
 </html>
diff --git a/docs/en_US/nagvis_config_format_description.html 
b/docs/en_US/nagvis_config_format_description.html
index 50e97c8..07c7d8f 100644
--- a/docs/en_US/nagvis_config_format_description.html
+++ b/docs/en_US/nagvis_config_format_description.html
@@ -75,6 +75,25 @@
         <tr>
         
<td><strike>displayheader</strike></td><td><strike>1</strike></td><td><strike>Show
 header menu in maps</strike>. <font color="#ff0000">(Deprecated in 1.4. Moved 
as option &quot;headermenu&quot; to default and index section.)</font></td>
         </tr>
+
+        <tr>
+          <td>geomap_server <font color="#ff0000">(new in 1.7)</font></td>
+         <td>http://geomap.nagvis.org/</td>
+         <td>The server to use as source for the NagVis geomaps. Must 
implement the API which can be found <a 
href="http://pafciu17.dev.openstreetmap.org/";>here</a></td>
+        </tr>
+
+        <tr>
+          <td>http_proxy<font color="#ff0000">(new in 1.6)</font></td>
+         <td></td>
+         <td>The proxy server to use for external HTTP request.</td>
+        </tr>
+
+        <tr>
+          <td>http_timeout<font color="#ff0000">(new in 1.6)</font></td>
+         <td>10</td>
+         <td>The timeout in seconds for external HTTP requests.</td>
+        </tr>
+
         <tr>
         <td>language</td><td>en_US</td><td>Select default language to use in 
NagVis. There are several translations delivered by default: en_US (English), 
de_DE (German), fr_FR (French) and pt_BR (Brazilian Portuguese; since 1.4.4). 
Since NagVis 1.4 you have to select the languages in a new format 
(&quot;en_US&quot; instead of &quot;english&quot;) </td>
         </tr>
diff --git a/share/server/core/classes/GlobalMainCfg.php 
b/share/server/core/classes/GlobalMainCfg.php
index 1c5e3f3..4693ad9 100644
--- a/share/server/core/classes/GlobalMainCfg.php
+++ b/share/server/core/classes/GlobalMainCfg.php
@@ -91,9 +91,17 @@ class GlobalMainCfg {
                 'file_group' => Array('must' => 0,
                     'default' => '',
                     'match' => MATCH_STRING),
-                'file_mode' => Array('must' => 1,
+                'file_mode' => Array(
+                    'must'    => 1,
                     'default' => 660,
-                    'match' => MATCH_INTEGER_EMPTY),
+                    'match'   => MATCH_INTEGER_EMPTY
+                ),
+
+                'geomap_server' => array(
+                    'must'    => 1,
+                    'default' => 'http://geomap.nagvis.org/',
+                    'match'   => MATCH_STRING_URL,
+                ),
 
                 'http_proxy' => array(
                     'must'    => 0,
diff --git a/share/server/core/sources/geomap.php 
b/share/server/core/sources/geomap.php
index 4834fd7..f2300f0 100644
--- a/share/server/core/sources/geomap.php
+++ b/share/server/core/sources/geomap.php
@@ -65,6 +65,7 @@ global $viewParams;
 $viewParams = array(
     'geomap' => array(
         'geomap_type',
+        'geomap_zoom',
         'source_file',
     )
 );
@@ -74,11 +75,16 @@ global $configVars;
 $configVars = array(
     'geomap_type' => array(
         'must'       => false,
-        'default'    => 'osmarender',
+        'default'    => 'mapnik',
         'match'      => '/^(osmarender|mapnik|cycle)$/i',
         'field_type' => 'dropdown',
         'list'       => 'list_geomap_types',
     ),
+    'geomap_zoom' => Array(
+        'must'       => false,
+        'default'    => '',
+        'match'      => MATCH_INTEGER,
+    ),
     'source_file' => array(
         'must'       => false,
         'default'    => '',
@@ -167,14 +173,15 @@ function process_geomap($MAPCFG, $map_name, &$map_config) 
{
     //echo $min_long . ' - ' . $max_long. ' - ' . $mid_long;
 
     // Using this API: http://pafciu17.dev.openstreetmap.org/
-    $url = 'http://dev.openstreetmap.org/~pafciu17/'
+    $url = cfg('global', 'geomap_server')
           
.'?module=map&bbox='.$min_long.','.$max_lat.','.$max_long.','.$min_lat
           .'&width='.$params['width'].'&height='.$params['height']
           .'&type='.$params['geomap_type'];
           //.'&points='.$min_long.','.$max_lat.';'.$max_long.','.$min_lat;
-    // FIXMEL: The geomap zoom seems to be something different than the nagvis 
zoom
-    if($params['zoom'] != '')
-        $url .= '&zoom='.$params['zoom'];
+    // 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 .= '&geomap_zoom='.$params['geomap_zoom'];
     //file_put_contents('/tmp/123', $url);
 
     // Fetch the background image when needed


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to