-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Geometry output different in Postgres + Postgis: 11.7 + 2.5 #1588
Comments
Yes, that's true. In PostGIS 3.0 there's a cast for geometry to json which is done automatically by In theory we could provide geojson for < 3.0, but not sure it would be worth the effort. |
Thanks for sharing this insight and thinking along. Using the unstable release is not in favour of the sysadmin's strategy for our internal services. Another solution might be to visualise the WKB variant and never need the GeoJSON version? But with this possible solution I want to be able in future projects to also configure the geometry output to be in WKB. Is it configurable somewhere? |
I have never worked with PostGIS, so I might be completely off here - but maybe you can just try to recreate the cast for geometry to json from postgis 3.0 that Steve mentioned, in your pg11/postgis2.5 schema manually? Maybe this will already yield the same result as in your pg12/postgis3.0 setup. |
Would this be easy to do @steve-chavez ? |
The casts are defined here: https://github.com/postgis/postgis/blob/f50dcaaaa7a0c77e84076d0543c3c48b3a4d9ad4/postgis/postgis.sql.in#L4731-L4748 Not sure whether you can compile the c function independently for this. Or whether you might be able to recreate it in plpgsql or something. Probably easier to convince your sysadmin to use the unstable release for now ;) |
Ok thank you for the insights. I'll close this for now... |
Actually, looking at the code you could try something roughly like this:
|
Thank you @wolfgangwalther, this exact snippet solved my problem! |
Environment
Description of issue
I am using the PostGIS extension to enable 'geometry' as data type. Via PostgREST I can query the attribute and receive the value as GeoJSON:
In PostgrSQL version 12.2 + PostGIS 3.0 I receive the geometry as proper GeoJSON:
In PostgrSQL version 11.7 + PostGIS 2.5 when I query the same record, I receive the geometry as (what I think it resembles) a WKB (Well Known Binary) representation of the geometry:
The easiest way to solve this, would be simply upgrade my PostgreSQL and PostGIS versions But since these service are installed on Debian I am tied to the Debian Buster version.
The text was updated successfully, but these errors were encountered: