On Fri, 18 Jun 2021 at 15:53, Andrea Aime <andrea.a...@geo-solutions.it> wrote:
> 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 > > That makes (some) sense - but I just found this warning ( https://github.com/geotools/geotools/blob/73051a745a647c134ae7c2be26978e0968bfbb03/modules/library/referencing/src/main/java/org/geotools/referencing/factory/epsg/DirectEpsgFactory.java#L3051 ): * @todo The ordering is not consistent among all database software, because the "accuracy" * column may contains null values. When used in an "ORDER BY" clause, PostgreSQL put null * values last, while Access and HSQL put them first. The PostgreSQL's behavior is better * for what we want (put operations with unknow accuracy last). Unfortunatly, I don't know * yet how to instruct Access to put null values last using standard SQL ("IIF" is not * standard, and Access doesn't seem to understand "CASE ... THEN" clauses). 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 > > That requires them to copy the WKT out of the database and maintain it across versions which seems like a hassle when the data is in there. I've got some code to handle the look up, the hard bit is finding somewhere to test it as I need a EPSG authority to test against so I can put the test in gt-referencing but gt-epsg-hsql has no depedency on gt-main where JTS.transform lives and I can't directly inspect a coordinate transform to see what the parameters are! Ian
_______________________________________________ GeoTools-Devel mailing list GeoTools-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel