[Schmitzm-commits] r1331 - trunk/src/schmitzm/geotools

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Dec 7 01:02:37 CET 2010


Author: alfonx
Date: 2010-12-07 01:02:36 +0100 (Tue, 07 Dec 2010)
New Revision: 1331

Modified:
   trunk/src/schmitzm/geotools/GTUtil.java
Log:


Modified: trunk/src/schmitzm/geotools/GTUtil.java
===================================================================
--- trunk/src/schmitzm/geotools/GTUtil.java	2010-12-06 22:14:36 UTC (rev 1330)
+++ trunk/src/schmitzm/geotools/GTUtil.java	2010-12-07 00:02:36 UTC (rev 1331)
@@ -58,7 +58,6 @@
 import org.opengis.feature.simple.SimpleFeature;
 import org.opengis.feature.simple.SimpleFeatureType;
 import org.opengis.geometry.Envelope;
-import org.opengis.metadata.Identifier;
 import org.opengis.referencing.FactoryException;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.opengis.referencing.operation.MathTransform;
@@ -531,18 +530,11 @@
 	 * Tries to determin the EPSG:XXXX definition of a CRS.
 	 */
 	public static String getEPSG(CoordinateReferenceSystem crs) {
-		if (!crs.getIdentifiers().isEmpty()) {
-			Object next = crs.getIdentifiers().iterator().next();
-			if (next instanceof Identifier) {
-				Identifier identifier = (Identifier) next;
-				if (identifier.getAuthority().getTitle().toString()
-						.equals("European Petroleum Survey Group")
-						|| identifier.toString().startsWith("EPSG:")) {
-					return "EPSG:" + identifier.getCode();
-				}
-			}
+		try {
+			return "EPSG:" + CRS.lookupEpsgCode(crs, true);
+		} catch (FactoryException e) {
+			throw new RuntimeException(e);
 		}
-		return null;
 	}
 
 }



More information about the Schmitzm-commits mailing list