avoid warnings when geometry of object cannot be determined

This commit is contained in:
Sarah Hoffmann
2012-02-06 23:14:21 +00:00
parent 3abbeb5f08
commit 7239687e5b
3 changed files with 4 additions and 2 deletions

View File

@@ -74,10 +74,12 @@ body {
var proj_map = map.getProjectionObject(); var proj_map = map.getProjectionObject();
var latlon; var latlon;
<?php <?php
if (isset($aPolyPoints)) {
foreach($aPolyPoints as $aPolyPoint) foreach($aPolyPoints as $aPolyPoint)
{ {
echo " pointList.push(new OpenLayers.Geometry.Point(".$aPolyPoint[1].",".$aPolyPoint[2]."));\n"; echo " pointList.push(new OpenLayers.Geometry.Point(".$aPolyPoint[1].",".$aPolyPoint[2]."));\n";
} }
}
?> ?>
var linearRing = new OpenLayers.Geometry.LinearRing(pointList).transform(proj_EPSG4326, proj_map);; var linearRing = new OpenLayers.Geometry.LinearRing(pointList).transform(proj_EPSG4326, proj_map);;
var polygonFeature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon([linearRing]),null,style); var polygonFeature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon([linearRing]),null,style);

View File

@@ -42,7 +42,7 @@
echo ','.$aResult['aBoundingBox'][3]; echo ','.$aResult['aBoundingBox'][3];
echo '"'; echo '"';
if ($bShowPolygons) if ($bShowPolygons && isset($aResult['aPolyPoints']))
{ {
echo ' polygonpoints=\''; echo ' polygonpoints=\'';
echo javascript_renderData($aResult['aPolyPoints']); echo javascript_renderData($aResult['aPolyPoints']);

View File

@@ -1161,7 +1161,7 @@
} }
// Output data suitable for display (points and a bounding box) // Output data suitable for display (points and a bounding box)
if ($bShowPolygons) if ($bShowPolygons && isset($aPolyPoints))
{ {
$aResult['aPolyPoints'] = array(); $aResult['aPolyPoints'] = array();
foreach($aPolyPoints as $aPoint) foreach($aPolyPoints as $aPoint)