[MXD2map-commits] r246:87e92debc53f
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Aug 10 15:00:59 CEST 2011
details: http://hg.intevation.org/geospatial/mxd2map/rev/87e92debc53f
changeset: 246:87e92debc53f
user: raimund renkert <raimund.renkert at intevation.de>
date: Wed Aug 10 13:18:53 2011 +0200
description:
Added extent and projection as ows metadata to the mapfile.
diffstat:
ChangeLog | 9 ++++++
src/java/de/intevation/mxd/reader/FeatureLayerReader.java | 22 +++++++++++++++
src/java/de/intevation/mxd/writer/MapScriptWriter.java | 22 +++++++++++++++
3 files changed, 53 insertions(+), 0 deletions(-)
diffs (101 lines):
diff -r 2eeeae07aaa2 -r 87e92debc53f ChangeLog
--- a/ChangeLog Tue Aug 09 17:42:31 2011 +0200
+++ b/ChangeLog Wed Aug 10 13:18:53 2011 +0200
@@ -1,3 +1,12 @@
+2011-08-09 Raimund Renkert <raimund.renkert at intevation.de>
+
+ * src/java/de/intevation/mxd/reader/FeatureLayerReader.java:
+ Read layer extent from mxd.
+
+ * src/java/de/intevation/mxd/writer/MapScriptWriter.java:
+ Write layer extent, map extent and projection as metadata to
+ the mapfile.
+
2011-08-09 Raimund Renkert <raimund.renkert at intevation.de>
* src/java/de/intevation/mxd/writer/MapScriptWriter.java:
diff -r 2eeeae07aaa2 -r 87e92debc53f src/java/de/intevation/mxd/reader/FeatureLayerReader.java
--- a/src/java/de/intevation/mxd/reader/FeatureLayerReader.java Tue Aug 09 17:42:31 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/FeatureLayerReader.java Wed Aug 10 13:18:53 2011 +0200
@@ -29,6 +29,8 @@
import com.esri.arcgis.geodatabase.FeatureClassName;
import com.esri.arcgis.system.IName;
import com.esri.arcgis.system.IPropertySet;
+import com.esri.arcgis.geometry.Envelope;
+
import org.w3c.dom.Element;
import de.intevation.mxd.utils.MapToXMLUtils;
@@ -209,6 +211,26 @@
}
try {
+ Envelope rect = (Envelope)layer.getExtent();
+ layerElement.setAttribute(
+ "extent_min_x",
+ String.valueOf(rect.getXMin ()));
+ layerElement.setAttribute(
+ "extent_max_x",
+ String.valueOf(rect.getXMax()));
+ layerElement.setAttribute(
+ "extent_y_min",
+ String.valueOf(rect.getYMin()));
+ layerElement.setAttribute(
+ "extent_y_max",
+ String.valueOf(rect.getYMax()));
+ }
+ catch(IOException ioe) {
+ logger.warn(
+ "Could not read extent from layer "
+ + layer.getName() + ".");
+ }
+ try {
String datatype = layer.getDataSourceType();
if(layer.getWorkspace().getType() == 0) {
layerElement.setAttribute("connection_type", "local");
diff -r 2eeeae07aaa2 -r 87e92debc53f src/java/de/intevation/mxd/writer/MapScriptWriter.java
--- a/src/java/de/intevation/mxd/writer/MapScriptWriter.java Tue Aug 09 17:42:31 2011 +0200
+++ b/src/java/de/intevation/mxd/writer/MapScriptWriter.java Wed Aug 10 13:18:53 2011 +0200
@@ -162,6 +162,13 @@
Double.parseDouble(mapNode.getAttribute("extent_max_x")),
Double.parseDouble(mapNode.getAttribute("extent_max_y")));
+ map.setMetaData(
+ "ows_extent",
+ mapNode.getAttribute("extent_min_x") + ", " +
+ mapNode.getAttribute("extent_min_y") + ", " +
+ mapNode.getAttribute("extent_max_x") + ", " +
+ mapNode.getAttribute("extent_max_y"));
+
//Set the units and projection.
int proj = Integer.parseInt(mapNode.getAttribute("projection"));
if(proj != 0) {
@@ -196,6 +203,10 @@
units = MS_UNITS.MS_METERS;
}
map.setUnits(units);
+
+ String srs = map.getMetaData("ows_srs");
+ srs += " EPSG:" + mapNode.getAttribute("projection");
+ map.setMetaData("ows_srs", srs);
}
/**
@@ -243,6 +254,17 @@
}
layer.setMetaData("wms_title", ulname);
+ if(layerElement.hasAttribute("extent_min_x") &&
+ layerElement.hasAttribute("extent_max_x") &&
+ layerElement.hasAttribute("extent_min_y") &&
+ layerElement.hasAttribute("extent_max_y")) {
+ layer.setMetaData(
+ "ows_extent",
+ layerElement.getAttribute("extent_min_x") + ", " +
+ layerElement.getAttribute("extent_min_y") + ", " +
+ layerElement.getAttribute("extent_max_x") + ", " +
+ layerElement.getAttribute("extent_max_y"));
+ }
//The layer status.
String stat = layerElement.getAttribute("status");
if (stat.equals("on")) {
More information about the MXD2map-commits
mailing list