[Schmitzm-commits] r768 - in trunk: . dist src/schmitzm/geotools
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Mar 18 11:31:23 CET 2010
Author: alfonx
Date: 2010-03-18 11:31:23 +0100 (Thu, 18 Mar 2010)
New Revision: 768
Modified:
trunk/dist/schmitzm-2.0.x.jar
trunk/pom.xml
trunk/src/schmitzm/geotools/JTSUtil.java
Log:
Neue Utility funktion in JTSUtil to parse WTK
Modified: trunk/dist/schmitzm-2.0.x.jar
===================================================================
(Binary files differ)
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-03-15 21:41:59 UTC (rev 767)
+++ trunk/pom.xml 2010-03-18 10:31:23 UTC (rev 768)
@@ -147,12 +147,15 @@
<dependency>
+ <!--
+ Logging with log4j. Die MVN dependency fuer 1.2.15 ist defekt.
+ downgraded to 1.2.14 http://jira.codehaus.org/browse/MEV-649
+ -->
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
- <type>jar</type>
- <scope>compile</scope>
</dependency>
+
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Modified: trunk/src/schmitzm/geotools/JTSUtil.java
===================================================================
--- trunk/src/schmitzm/geotools/JTSUtil.java 2010-03-15 21:41:59 UTC (rev 767)
+++ trunk/src/schmitzm/geotools/JTSUtil.java 2010-03-18 10:31:23 UTC (rev 768)
@@ -32,9 +32,12 @@
import java.awt.Rectangle;
import org.apache.log4j.Logger;
+import org.geotools.factory.Hints;
import org.geotools.geometry.jts.JTS;
+import org.geotools.geometry.jts.JTSFactoryFinder;
import org.geotools.geometry.jts.ReferencedEnvelope;
import org.geotools.referencing.CRS;
+import org.geotools.referencing.crs.DefaultGeographicCRS;
import org.opengis.geometry.DirectPosition;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
@@ -45,6 +48,9 @@
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Envelope;
import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.GeometryFactory;
+import com.vividsolutions.jts.io.ParseException;
+import com.vividsolutions.jts.io.WKTReader;
/**
* Diese Klasse enthaelt allgemeine Funktionen fuer die Arbeit mit den in
@@ -317,5 +323,23 @@
return re;
}
+
+ /**
+ * TODO doku
+ * @param wkt
+ * @param crs
+ * @return
+ * @throws ParseException
+ */
+ public static Geometry parseWKT(String wkt, CoordinateReferenceSystem crs) throws ParseException {
+ Hints hints = new Hints( Hints.CRS, crs != null ? crs : DefaultGeographicCRS.WGS84 );
+ GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory( hints );
+ WKTReader reader = new WKTReader( geometryFactory );
+ Geometry geometry = (Geometry) reader.read(wkt);
+
+ return geometry;
+
+ }
+
}
More information about the Schmitzm-commits
mailing list