[PATCH 2 of 2] min and max must not be equal in LAYER EXTENT in mapfile

Wald Commits scm-commit at wald.intevation.org
Tue May 9 18:45:03 CEST 2017


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1494348176 -7200
# Node ID f5e126739c36fcdff11585af648cb639da74ce85
# Parent  c4ce250939539cc1c8d977a2c0220138eee2e606
min and max must not be equal in LAYER EXTENT in mapfile.

(issue1879) In passing some whitespace cosmetics.

diff -r c4ce25093953 -r f5e126739c36 artifacts/src/main/java/org/dive4elements/river/exports/MapGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/MapGenerator.java	Tue May 09 17:58:10 2017 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/MapGenerator.java	Tue May 09 18:42:56 2017 +0200
@@ -258,7 +258,7 @@
         appendMapInformation(root, c);
 
         XMLUtils.toStream(response, out);
-            }
+    }
 
 
     protected void appendLayers(Element parent) {
diff -r c4ce25093953 -r f5e126739c36 artifacts/src/main/java/org/dive4elements/river/utils/ArtifactMapfileGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/utils/ArtifactMapfileGenerator.java	Tue May 09 17:58:10 2017 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/utils/ArtifactMapfileGenerator.java	Tue May 09 18:42:56 2017 +0200
@@ -29,6 +29,8 @@
 import org.geotools.data.shapefile.shp.ShapefileHeader;
 import org.geotools.data.shapefile.shp.ShapefileReader;
 
+import com.vividsolutions.jts.geom.Envelope;
+
 public class ArtifactMapfileGenerator extends MapfileGenerator {
 
     private static Logger log = Logger.getLogger(ArtifactMapfileGenerator.class);
@@ -224,8 +226,15 @@
         layerinfo.setData(wms.getData());
         layerinfo.setTitle(wms.getDescription());
         layerinfo.setStyle(style);
-        if(wms.getExtent() != null) {
-            layerinfo.setExtent(GeometryUtils.jtsBoundsToOLBounds(wms.getExtent()));
+
+        Envelope env = wms.getExtent();
+        if (env != null) {
+            if (env.getArea() <= 0) {
+                /* For MapServer min and max must not be equal. EXTENT has no
+                   effect on Layerzoom, thus expand arbitrarily by 1. */
+                env.expandBy(1d);
+            }
+            layerinfo.setExtent(GeometryUtils.jtsBoundsToOLBounds(env));
         } else {
             log.error("Layer without extent. Probably no geometry at all.");
             layerinfo.setExtent("0 0 1 1");


More information about the Dive4Elements-commits mailing list