You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@sis.apache.org by Michael Arneson <mi...@geotoolkit.net> on 2020/01/24 16:40:32 UTC

Retrieving CoordinateOperation from wkt

I am trying to get a CoordinateOperation from a WTK.
I can use the following code to get the CoordinateOperation from a
transform code.



*        CRSAuthorityFactory crsFactory = CRS.getAuthorityFactory("EPSG");
      CoordinateOperationAuthorityFactory opFactory =
(CoordinateOperationAuthorityFactory) crsFactory;
CoordinateOperation operationFromCode=
opFactory.createCoordinateOperation("15788");*

Is there a way to get the CoordinateOperation from a
CoordinateReferenceSystem created from a wtk?

*CoordinateReferenceSystem fromCrs = CRS.fromWKT(wkt);*
*...*
*CoordinateOperation operationFromWKT = ...*


Thanks,
-- 
*Michael Arneson*

*Software Engineer*



*Office:* +1 (713) 975-7434

michael.arneson@int.com

*INT *| *Empowering Visualization*

Re: Retrieving CoordinateOperation from wkt

Posted by Martin Desruisseaux <ma...@geomatys.com>.
Hello Michael

Le 24/01/2020 à 17:40, Michael Arneson a écrit :

> Is there a way to get the CoordinateOperation from a 
> CoordinateReferenceSystem created from a wtk?
>
>     /CoordinateReferenceSystem fromCrs = CRS.fromWKT(wkt);/
>
>     /.../
>
>     /CoordinateOperation operationFromWKT = .../
>
Do we mean to get a CoordinateOperation directly from a WKT (not from a 
CoordinateReferenceSystem), with a WKT like the example below?

    http://docs.opengeospatial.org/is/18-010r7/18-010r7.html#143

If yes, then it can be done with the following class:

    http://sis.apache.org/apidocs/org/apache/sis/io/wkt/WKTFormat.html

Example:

    WKTFormat wf = new WKTFormat(null, null);
    Object obj = wf.parseObject(theWKT);
    Warnings warnings = wf.getWarnings();	// Optional but may be worth to do.
    if (warnings != null) {
         System.out.println(warnings);       // More advanced analysis could be done here.
    }

The obj result will be an instance of CoordinateOperation if the WKT was 
like the example in above-link, or a CoordinateReferenceSystem, or a 
Datum or any other WKT objects recognized by SIS.

Is what you were looking for, or was it something different?

     Martin