Hi,
This question rose while upgrading the MySQL module to version 8 where I ran into the database throwing a "MysqlDataTruncation" exception with message "Data truncation: SRID value is out of range in 'st_geomfromtext'" when passing -1 as the SRID value when one of the tests inserted a geometry without SRID.

I traced this back to JDBCDataStore#getDescriptorSRID(AttributeDescriptor) defaulting to -1 as the unknown value:
https://github.com/geotools/geotools/blob/821d9add2f8de1f6649601dc4a67ccd9c64f1719/modules/library/jdbc/src/main/java/org/geotools/jdbc/JDBCDataStore.java#L4291-L4302

There's actually a default to -1 for srid in setPreparedFilterValues() as well.

I found this note on the PostGIS ST_SRID page: https://postgis.net/docs/RT_ST_SRID.html

"From PostGIS 2.0+ the srid of a non-georeferenced raster/geometry is 0 instead of the prior -1."

Which might explain why (and it's been like that for at least 10 years), but if postgis stopped using -1 maybe we should too?
(postgis seems lenient to using -1 as a srid)

Mark


_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to