sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1802136 - /sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java
Date Mon, 17 Jul 2017 13:11:56 GMT
Author: desruisseaux
Date: Mon Jul 17 13:11:56 2017
New Revision: 1802136

URL: http://svn.apache.org/viewvc?rev=1802136&view=rev
Log:
Returns the definition provided by Proj.4 itself if available.

Modified:
    sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java

Modified: sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java?rev=1802136&r1=1802135&r2=1802136&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java
[UTF-8] Mon Jul 17 13:11:56 2017
@@ -18,6 +18,7 @@ package org.apache.sis.storage.gdal;
 
 import javax.measure.Unit;
 import javax.measure.quantity.Angle;
+import org.opengis.metadata.Identifier;
 import org.opengis.util.FactoryException;
 import org.opengis.parameter.ParameterValue;
 import org.opengis.parameter.ParameterValueGroup;
@@ -33,6 +34,7 @@ import org.opengis.referencing.cs.Ellips
 import org.opengis.referencing.datum.Ellipsoid;
 import org.opengis.referencing.datum.GeodeticDatum;
 import org.opengis.referencing.datum.PrimeMeridian;
+import org.opengis.referencing.operation.Projection;
 import org.opengis.referencing.operation.CoordinateOperation;
 import org.apache.sis.referencing.factory.UnavailableFactoryException;
 import org.apache.sis.referencing.IdentifiedObjects;
@@ -45,11 +47,19 @@ import org.apache.sis.util.resources.Err
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.Static;
 import org.apache.sis.measure.Units;
-import org.opengis.referencing.operation.Projection;
 
 
 /**
- * Bindings to the {@literal Proj.4} library.
+ * Bindings to the {@literal Proj.4} library as static convenience methods.
+ * The methods in this class allow to:
+ *
+ * <ul>
+ *   <li>{@linkplain #createCRS Create a Coordinate Reference System instance from
a Proj.4 definition string}.</li>
+ *   <li>Conversely, {@link #definition get a Proj.4 definition string from a Coordinate
Reference System}.</li>
+ *   <li>{@linkplain #createOperation Create a coordinate operation backed by Proj.4
between two arbitrary CRS}.</li>
+ * </ul>
+ *
+ * Most methods in this class delegate to {@link Proj4Factory}.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Johann Sorel (Geomatys)
@@ -94,6 +104,12 @@ public final class Proj4 extends Static
      * @throws FactoryException if the Proj.4 definition string can not be created from the
given CRS.
      */
     public static String definition(final CoordinateReferenceSystem crs) throws FactoryException
{
+        ArgumentChecks.ensureNonNull("crs", crs);
+        for (final Identifier id : crs.getIdentifiers()) {
+            if (id instanceof PJ) {
+                return ((PJ) id).getCode();
+            }
+        }
         final String method;
         final GeodeticDatum datum;
         final ParameterValueGroup parameters;



Mime
View raw message