On Tue, May 3, 2022 at 6:07 AM Glenn Walbran via GeoTools-Devel < geotools-devel@lists.sourceforge.net> wrote:
> Hello Geotools developers > > I've recently noticed that when reading data from PostGIS with > PostgisNGDataStoreFactory the feature source has a CRS with a YX axis order. > > My understanding is that PostGIS uses an XY axis order. > Correct. As do most spatial databases (AFAIK). > This is of course having a bad affect on the location of those features. > > My plan was to override createCRS() in PostGISDialect and call CRS.decode > with forceXY set. This is a simple enough fix but I thought I'd canvas > views from the developer group first. It looks like there would be quite a > bit of churn in the tests go along with this change. > JDBC data stores have a lot of tests, a small part of them are using CRS for checks... to get a feeling about it, I've grepped for "CRS.decode(" in the test sources, coming up with this list: modules/library/jdbc/src/test> git grep "CRS.decode(" java/org/geotools/jdbc/JDBCDataStoreAPIOnlineTest.java: CoordinateReferenceSystem crs = CRS.decode("EPSG:4326", forceLongitudeFirst); java/org/geotools/jdbc/JDBCDataStoreAPIOnlineTest.java: ReferencedEnvelope e = new ReferencedEnvelope(CRS.decode("EPSG:4326", forceLongitudeFirst)); java/org/geotools/jdbc/JDBCDataStoreOnlineTest.java: builder.setCRS(CRS.decode("EPSG:4326")); java/org/geotools/jdbc/JDBCDataStoreOnlineTest.java: builder.setCRS(CRS.decode("EPSG:4326")); java/org/geotools/jdbc/JDBCDataStoreOnlineTest.java: builder.setCRS(CRS.decode("EPSG:4326")); java/org/geotools/jdbc/JDBCDataStoreOnlineTest.java: return CRS.decode("EPSG:26713"); java/org/geotools/jdbc/JDBCFeatureCollectionOnlineTest.java: ReferencedEnvelope exp = new ReferencedEnvelope(1, 1, 1, 1, CRS.decode("EPSG:4326")); java/org/geotools/jdbc/JDBCFeatureSourceExposePkOnlineTest.java: assertTrue(areCRSEqual(CRS.decode("EPSG:4326"), schema.getCoordinateReferenceSystem())); java/org/geotools/jdbc/JDBCFeatureSourceOnlineTest.java: return CRS.decode("EPSG:4326"); java/org/geotools/jdbc/JDBCGeneric3DOnlineTest.java: crs = CRS.decode("EPSG:" + getEpsgCode()); java/org/geotools/jdbc/JDBCGeographyOnlineTest.java: new ReferencedEnvelope(-110, 0, 29, 49, CRS.decode("EPSG:4326")); java/org/geotools/jdbc/JDBCGeometryOnlineTest.java: CoordinateReferenceSystem crs = CRS.decode("EPSG:4326"); java/org/geotools/jdbc/TestData.java: roadBounds = new ReferencedEnvelope(CRS.decode("EPSG:4326", forceLongitudeFirst)); java/org/geotools/jdbc/TestData.java: riverBounds = new ReferencedEnvelope(CRS.decode("EPSG:4326", forceLongitudeFirst)); However... all these tests are shared across the various JDBC plugins: making the change just for PostGIS may prove challenging. As you issue a PR, most JDBC stores will be checked with an online build against their specific database: they all need to pass, and you can leverage the build outputs to figure out what else you might have to fix. There is extensive documentation on how to set up most of them locally, eventually using docker to pull a database image, here: https://docs.geotools.org/latest/developer/conventions/test/online.html Cheers Andrea == GeoServer Professional Services from the experts! Visit http://bit.ly/gs-services-us for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions Group phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 333 8128928 https://www.geosolutionsgroup.com/ 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