Thank you. The first approach works well, but I am not sure I can easily
narrow down the list of candidates to a particular transform.

For example, to list all operations between 4320 and 4326

        CoordinateOperationAuthorityFactory opFactory =
(CoordinateOperationAuthorityFactory) CRS.getAuthorityFactory("EPSG");
        Set<CoordinateOperation> operations =
opFactory.createFromCoordinateReferenceSystemCodes("4230", "4326");

The set returned does contain many eligible operations, and one of them is
transform 1311, the one I want to use.

CoordinateOperation["ED50 to WGS 84 (18)",
  SourceCRS[GeodeticCRS["ED50",
    Datum["European Datum 1950",
      Ellipsoid["International 1924", 6378388.0, 297.0]],
    CS[ellipsoidal, 2],
      Axis["Geodetic latitude (Lat)", north],
      Axis["Geodetic longitude (Lon)", east],
      Unit["degree", 0.017453292519943295],
    Id["EPSG", 4230, "9.7"]]],
  TargetCRS[GeodeticCRS["WGS 84",
    Datum["World Geodetic System 1984",
      Ellipsoid["WGS 84", 6378137.0, 298.257223563]],
    CS[ellipsoidal, 2],
      Axis["Geodetic latitude (Lat)", north],
      Axis["Geodetic longitude (Lon)", east],
      Unit["degree", 0.017453292519943295],
    Id["EPSG", 4326, "9.7"]]],
  Method["Position Vector transformation (geog2D domain)"],
    Parameter["X-axis translation", -89.5, Unit["metre", 1]],
    Parameter["Y-axis translation", -93.8, Unit["metre", 1]],
    Parameter["Z-axis translation", -123.1, Unit["metre", 1]],
    Parameter["X-axis rotation", 0.0, Unit["arc-second",
4.84813681109536E-6]],
    Parameter["Y-axis rotation", 0.0, Unit["arc-second",
4.84813681109536E-6]],
    Parameter["Z-axis rotation", -0.156, Unit["arc-second",
4.84813681109536E-6]],
    Parameter["Scale difference", 1.2, Unit["parts per million", 1.0E-6]],
  OperationAccuracy[1.0],
  Scope["Recommended transformation for UKCS and IrishCS petroleum
purposes."],
  Area["Denmark - offshore North Sea; Ireland - offshore; Netherlands -
offshore; United Kingdom - UKCS offshore."],
  BBox[47.42, -16.10, 63.89, 10.86],
  Id["EPSG", *1311*, "9.7",
URI["urn:ogc:def:coordinateOperation:EPSG:9.7:1311"]],
  Remark["Based on ED50 to WGS72 (precise ephemeris) 6-nations agreement of
1981 to which precise to broadcast and broadcast to WGS 84 transformations
have been concatenated."]]

Unfortunately, the API only allows to get the entire operation string, but
not extract the transformation id itself. If I am interested in converting
coordinates from EPSG 4230 to 4326, specifically with the transform 1311,
it seems that I need to parse the operation string, extract the transform
id then compare it with the value I am looking for. Is there an API that
would give me direct access to this transform id?




On Mon, Dec 16, 2019 at 9:57 AM Martin Desruisseaux <
martin.desruisse...@geomatys.com> wrote:

> Hello
>
> There is different possible approaches. A first one is to get the list of
> all possible operations between a given pair of CRS and pickup the one you
> prefer. The static methods in the CRS class are actually just convenience
> methods; they don't do much more than delegating to one of the various
> factories. To gain more control, the following code may be tried:
>
> CoordinateOperationAuthorityFactory opFactory = 
> (CoordinateOperationAuthorityFactory) CRS.getAuthorityFactory("EPSG");
> Set<CoordinateOperation> operations = 
> opFactory.createFromCoordinateReferenceSystemCodes(String sourceCRS, String 
> targetCRS)
>
> If you know the EPSG code of the desired coordinate operation, you can
> also invoke createCoordinateOperation(String) directly.
>
> It is also possible to get the set of CoordinateOperation for a pair of
> CRS instead than a pair of EPSG codes, and finally it is also possible to
> construct a coordinate operation by providing the parameter values (without
> EPSG database). Let me know if one of the latest approaches is the desired
> ones.
>
>     Martin
>
>
> Le 16/12/2019 à 16:30, Thierry Danard a écrit :
>
> It's quite common in geoscience to pick not the just the CRS that a
> dataset uses, but also to pick at the same time the matching transform to
> WGS 84.
>
> For example, when a user picks the 32056 - NAD 27 / Wyoming East Central
> CRS, the EPSG database has several possible transformations to WGS 84. One
> of them is 1173 - NAD27 to WGS 84 (4) USA - CONUS - onshore.
>
> I couldn't find a way to pass this transform to the CRS.findOperation
> method. I do understand that:
> - this transform is often not needed, as better methods than using WGS 84
> as a hub can be used (NADCON, NTV2, HARN, etc) in many areas
> - passing the bounding box technically allows Apache SIS to pick the best
> transform for that bounding box
>
> However, in many geoscience applications, the user wants to "pick" this
> transform to WGS 84 themselves, and use WGS 84 as transformation hub if no
> other method is available.
>
> Does Apache SIS support transforms to WGS 84? Is there a way I can specify
> a transform to WGS 84 when I find an operation, especially outside of an
> NADCON/NTV2/HARN area?
>
> -Thierry
>
>
>
>
>

Reply via email to