Author: Lars Michelsen <[email protected]>
Date: Thu Jun 14 13:22:34 2012 +0200
Committer: Lars Michelsen <[email protected]>
Commit-Date: Thu Jun 14 13:22:34 2012 +0200
geomap: better error handling
---
TODO | 8 +++-----
docs/en_US/geomap.html | 12 ++++++++++--
share/server/core/sources/geomap.php | 10 ++++++++++
3 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/TODO b/TODO
index 343b0c2..675f839 100644
--- a/TODO
+++ b/TODO
@@ -11,11 +11,6 @@ Offene Punkte:
Eine Möglichkeit wäre die Objekte einfach zu verstecken, die nicht
angezeigt
werden sollen. Das würde dann zu leeren flecken auf der Map führen.
- - Geomap:
- - Max. resolution (limit of OSM/API?)
- - bbox Limit?
- - CSV Quelle und geomap aufteilen
-
- Doku:
- Alte zu neuen Automap Parametern
- Automap Migration
@@ -33,6 +28,9 @@ Relative Koordinaten:
-------------------------------------------------------------------------------
+- Geomap:
+ - CSV Quelle und geomap aufteilen
+
- User Defined Coords:
- Speichern testen (Nur nötigste Attribute schreiben)
- Werden die korrekt übernommen?
diff --git a/docs/en_US/geomap.html b/docs/en_US/geomap.html
index 2309e79..0fa535f 100644
--- a/docs/en_US/geomap.html
+++ b/docs/en_US/geomap.html
@@ -80,10 +80,18 @@ muc-srv1;Munich Server1;48.1448353;11.5580067</pre>
<td>The name of the file CSV file to use as source for rendering
the geomap.</td>
</tr>
<tr>
- <td>width</td><td></td><td> width of the geomap in pixels </td>
+ <td>width</td>
+ <td></td>
+ <td>Defines the width of the geomap in pixels. The maximum size of
the geomap is limited by
+ the queried webservice. geomap.nagvis.org supports up to 50 tiles
per map which should make
+ 1920x1080 resolutions possible. Please contact us if you need
more.</td>
</tr>
<tr>
- <td>height</td><td></td><td> height of the geomap in pixels </td>
+ <td>height</td>
+ <td></td>
+ <td>Defines the height of the geomap in pixels. The maximum size
of the geomap is limited by
+ the queried webservice. geomap.nagvis.org supports up to 50 tiles
per map which should make
+ 1920x1080 resolutions possible. Please contact us if you need
more.</td>
</tr>
</table>
</body>
diff --git a/share/server/core/sources/geomap.php
b/share/server/core/sources/geomap.php
index 80178ca..9fb87a8 100644
--- a/share/server/core/sources/geomap.php
+++ b/share/server/core/sources/geomap.php
@@ -203,8 +203,18 @@ function process_geomap($MAPCFG, $map_name, &$map_config) {
// 2.373046875,54.239550531562,18.8525390625,50.499452103968
$data_url = $url . '&bboxReturnFormat=csv';
$contents = geomap_get_contents($data_url);
+
+ if(ord($contents[0]) == 137 &&
+ ord($contents[1]) == 80 &&
+ ord($contents[2]) == 78) {
+ // Got an png image as answer - catch this!
+ throw new NagVisException(l('Got invalid response from "[U]". This
is mostly caused by an unhandled request.',
+ array('U' => $data_url)));
+ }
+
if(!preg_match('/^-?[0-9]+\.?[0-9]*,-?[0-9]+\.?[0-9]*,-?[0-9]+\.?[0-9]*,-?[0-9]+\.?[0-9]*$/i',
$contents))
throw new NagVisException(l('Got invalid data from "[U]": "[C]"',
array('U' => $data_url, 'C' => var_dump($contents))));
+
file_put_contents($data_path, $contents);
$parts = explode(',', $contents);
} else {
------------------------------------------------------------------------------
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