[
https://issues.apache.org/jira/browse/SIS-287?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14727329#comment-14727329
]
Martin Desruisseaux commented on SIS-287:
-----------------------------------------
The reason why the providers in the {{OperationMethod}} service file are not
sorted by name is because they are rather sorted by dependency order (e.g.
{{LambertConformal}} reuses some parameters defined in {{Mercator}} - indeed,
Mercator can been seen as a simplification of Lambert Conformal in the special
case where the cone extremity is located at infinity). If there is no
dependency, we try to sort by increasing complexity (simpler operations first),
or most frequently-used operation first.
The idea is that when the user requests an operation,
{{java.util.ServiceLoader}} will load the classes in the order they are listed
in the service file. But the iteration stops as soon as a matching is found (it
will restart from the point where we stopped if, later, we need to go further).
This means that the last providers in the service file will never be loaded if
they are never requested. For this reason, it is advantageous to sort the
provider on _"most likely to be used first"_ or _"most heavyweight last"_
criterion.
> TransverseMercator projection provider missing in service file
> --------------------------------------------------------------
>
> Key: SIS-287
> URL: https://issues.apache.org/jira/browse/SIS-287
> Project: Spatial Information Systems
> Issue Type: Bug
> Components: Referencing
> Affects Versions: 0.6
> Reporter: Fredrik Kjellberg
> Assignee: Martin Desruisseaux
> Priority: Minor
> Attachments: TransverseMercator.diff
>
>
> I'm trying to parse the following WKT using the code from trunk and get an
> exception:
> {code}
> CoordinateReferenceSystem crs = CRS.fromWKT("PROJCS[\"RT90 2.5 gon
> V\",GEOGCS[\"RT90\",DATUM[\"Rikets_koordinatsystem_1990\",SPHEROID[\"Bessel
> 1841\",6377397.155,299.1528128,AUTHORITY[\"EPSG\",\"7004\"]],TOWGS84[414.1055246174,41.3265500042,603.0582474221,-0.8551163377,2.1413174055,-7.0227298286,0],AUTHORITY[\"EPSG\",\"6124\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4124\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",15.80827777777778],PARAMETER[\"scale_factor\",1],PARAMETER[\"false_easting\",1500000],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"3021\"]]");
> {code}
> {noformat}
> Exception in thread "main" org.opengis.util.NoSuchIdentifierException: No
> operation method found for name or identifier “Transverse_Mercator”.
> at
> org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory.getOperationMethod(DefaultMathTransformFactory.java:381)
> at
> org.apache.sis.referencing.operation.DefaultCoordinateOperationFactory.getOperationMethod(DefaultCoordinateOperationFactory.java:179)
> at
> org.apache.sis.internal.referencing.ServicesForMetadata.getOperationMethod(ServicesForMetadata.java:672)
> at
> org.apache.sis.io.wkt.GeodeticObjectParser.parseMethod(GeodeticObjectParser.java:1225)
> at
> org.apache.sis.io.wkt.GeodeticObjectParser.parseDerivingConversion(GeodeticObjectParser.java:1273)
> at
> org.apache.sis.io.wkt.GeodeticObjectParser.parseProjectedCRS(GeodeticObjectParser.java:1963)
> at
> org.apache.sis.io.wkt.GeodeticObjectParser.parseCoordinateReferenceSystem(GeodeticObjectParser.java:360)
> at
> org.apache.sis.io.wkt.GeodeticObjectParser.parseObject(GeodeticObjectParser.java:323)
> at
> org.apache.sis.io.wkt.AbstractParser.parseObject(AbstractParser.java:240)
> at
> org.apache.sis.io.wkt.GeodeticObjectParser.parseObject(GeodeticObjectParser.java:281)
> at
> org.apache.sis.io.wkt.AbstractParser.createFromWKT(AbstractParser.java:209)
> at
> org.apache.sis.referencing.factory.GeodeticObjectFactory.createFromWKT(GeodeticObjectFactory.java:1436)
> at org.apache.sis.referencing.CRS.fromWKT(CRS.java:236)
> {noformat}
> It seems there are a few projection providers missing from the service file.
> It works if I apply the attached patch.
> Maybe the providers in the OperationMethod service file should be sorted by
> name to make the file easier to read?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)