Hello Florian, and welcome!

Le 08/03/2020 à 21:17, Florian Micklich a écrit :

I am pretty new to Apache SIS but did already some coordinate transformations like this example:

https://sis.apache.org/book/en/developer-guide.html#CoordinateOperations

Is there also a possibility to reproject other geometries like LineStrings and Polygons or do I have to use a CoordinateSequens to reproject such kind of types?

Yes, but not yet with a public, committed API. The support of geometries in Apache SIS is a work in progress. Geometries are defined by the ISO 19107 international standard, which supports up to three-dimensional geometries with curves. JTS can been seen as a subset of that standard for two-dimensional line strings in Cartesian space. Our plan is to define an API based on ISO 19107, then create wrappers around JTS objects for exposing those objects through that API. That way the same API can also be used with ESRI API (another library which can pretty much compete with JTS), and the API is ready for 3 dimensional objects in the future.

But we are not yet there. In the meantime it is possible to do some operations on JTS objects using the given class:

 * org.apache.sis.internal.feature.jts.JTS

It has a static method like below:

 * public static Geometry transform(Geometry geometry,
   CoordinateOperation operation)

However everything in "internal" packages are not committed API; they may change in any future SIS version. As said before we plan to provide this service in the future through an API which work with JTS as well as with ESRI API and future libraries. But we are not yet there and for now that internal API is the only way.


Is there an example to do a transformation with JTS geometry with SIS?

If "source" and "target" are two EPSG code as Strings, it could be:

   CoordinateReferenceSystem sourceCRS = CRS.forCode(source);
   CoordinateReferenceSystem targetCRS = CRS.forCode(target);
   CoordinateOperation op = CRS.findOperation(sourceCRS, targetCRS, null);

   Geometry original = ...;
   Geometry converted = JRS.transform(original, op);    // WARNING: internal 
class, may change in any future version.

Regards,

    Martin


Reply via email to