Mercurial > dive4elements > river
changeset 8816:f5e126739c36
min and max must not be equal in LAYER EXTENT in mapfile.
(issue1879) In passing some whitespace cosmetics.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Tue, 09 May 2017 18:42:56 +0200 (2017-05-09) |
parents | c4ce25093953 |
children | 8927ec8a3c32 |
files | artifacts/src/main/java/org/dive4elements/river/exports/MapGenerator.java artifacts/src/main/java/org/dive4elements/river/utils/ArtifactMapfileGenerator.java |
diffstat | 2 files changed, 12 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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) {
--- 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");