Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Userlayer geometry srid #1005

Merged
merged 2 commits into from
Oct 2, 2023

Conversation

okauppinen
Copy link
Contributor

@okauppinen okauppinen commented Sep 26, 2023

PostGIS 3+ ST_GeomFromGeoJSON defaults to SRID=4326 if not specified otherwise. SimpleFeatureCollection -> GeoJSON contains only type and coordinates, no crs. I think it's easier to use st_setsrid than add crs to every geojson.
https://postgis.net/docs/ST_GeomFromGeoJSON.html

Migrate existing geometries to native srid to fix mixed srid. Some spatial queries doesn't work with mixed srid. Geometries added before PostGIS 3 have srid 0 and geometries added with version 3 have 4326. Note that coordinates were stored always in native srs/srid. So no need for transformation. Only update info/metadata.

Fixes issue where GeoServer userlayer datastore doesn't use 'loose bbox' option and GeoServer didn't get features from db with intersects query and exception were thrown.

Maybe we should set srid to geometry columns to be sure that geometries doesn't get mixed srid (throws error if inserted geometry srid doesn't match columns srid)

image

Like: UpdateGeometrySRID('user_layer_data','geometry',${srid});

Didn't set for now because vuser_layer_data view uses user_layer_data table. Have to drop view before set and is view needed anymore if we are aiming to use direct queries to db (without GeoServer).

@ZakarFin ZakarFin added this to the 2.13.0 milestone Oct 2, 2023
@ZakarFin ZakarFin merged commit d3dcf37 into oskariorg:develop Oct 2, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants