Hi Ian, the code can only handle one transformation right now, but I don't think it's random, it should be picking one with good accuracy and wide area coverage, see the sorting here: https://github.com/geotools/geotools/blob/73051a745a647c134ae7c2be26978e0968bfbb03/modules/library/referencing/src/main/java/org/geotools/referencing/factory/epsg/DirectEpsgFactory.java#L1542
There is also some handling of transformations superceding others a few lines below. That said, there is no way to specify the preferred one in GeoTools, indeed. GeoServer has a custom config file to force a preferred transformation, Jody referred to it in his message, code is here: https://github.com/geoserver/geoserver/blob/9e40cbbccb9626b8d08516c8eacaf5a8f168189b/src/main/src/main/java/org/vfny/geoserver/crs/GeoserverWKTOperationFactory.java#L26 Cheers Andrea On Sun, Jun 13, 2021 at 1:17 PM Ian Turton <ijtur...@gmail.com> wrote: > I'm looking at how to pick out a specific transform for a coordinate > reference system (e.g. https://epsg.io/21036) EPSG:21036 has 4 transforms > defined in the EPSG database and currently GeoTools picks the Kenyan > onshore one (https://epsg.io/21036-1284) presumably because it has the > best accuracy. Now I happen to be looking at data in Tanzania so I would > prefer to pick that transform (https://epsg.io/21036-1285) - so far as I > can see the only way to do this is to use the WKT and define a new CRS > object from that which is OK but a bit fiddly. > > I would prefer to be able to say something like: > > CoordinateReferenceSystem arc1960SRS = CRS.decode("EPSG:21036-1285"); > > From the look of the code it would involve modifying > org.geotools.referencing.operation.DefaultCoordinateOperationFactory.createOperation(CoordinateReferenceSystem, > CoordinateReferenceSystem) to check for the preferred transform rather than > returning the first one it finds in the database. So would probably need to > make sure that CRS decode found the correct transform and made a note of > that transform for later. > > Or am I missing an easier way of doing this and the documentation needs > updating? > > Ian > > -- > Ian Turton > _______________________________________________ > GeoTools-Devel mailing list > GeoTools-Devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/geotools-devel > -- Regards, Andrea Aime == GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- *Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.*
_______________________________________________ GeoTools-Devel mailing list GeoTools-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel