Operations on mixed geometries in geography types

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Operations on mixed geometries in geography types

J Smith-4
G'day list.

I was just updating some code recently that had some unit tests that
tested some operations on geography columns and noticed that between
PostGIS 2.1 and 2.2 the following query gives different results:

SELECT ST_covers('SRID=4326;POLYGON((5 5,5 10,10 10,10 5,5
5))'::geography, 'SRID=4269;POINT(7 7)'::geography);

On PostGIS 2.1 we get true, but on 2.2+ it errors out with "ERROR:
XX000: Operation on mixed SRID geometries".

I haven't been using PostGIS on any projects recently so I might be a
bit behind the times, but is this expected behaviour? I would have
assumed that SRID isn't really used on geography types and figured
that everything would be coerced or otherwise transformed to 4326
anyways.

Is this new behaviour expected, or should I change my unit tests and
code to match the new behaviour?

Cheers
_______________________________________________
postgis-devel mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-devel
Reply | Threaded
Open this post in threaded view
|

Re: Operations on mixed geometries in geography types

Paul Ramsey-3
Change your tests. Early versions of geography were 4326-only, but it's now possible to have other geographic SRIDs

P

On Tue, Feb 21, 2017 at 1:57 PM, J Smith <[hidden email]> wrote:
G'day list.

I was just updating some code recently that had some unit tests that
tested some operations on geography columns and noticed that between
PostGIS 2.1 and 2.2 the following query gives different results:

SELECT ST_covers('SRID=4326;POLYGON((5 5,5 10,10 10,10 5,5
5))'::geography, 'SRID=4269;POINT(7 7)'::geography);

On PostGIS 2.1 we get true, but on 2.2+ it errors out with "ERROR:
XX000: Operation on mixed SRID geometries".

I haven't been using PostGIS on any projects recently so I might be a
bit behind the times, but is this expected behaviour? I would have
assumed that SRID isn't really used on geography types and figured
that everything would be coerced or otherwise transformed to 4326
anyways.

Is this new behaviour expected, or should I change my unit tests and
code to match the new behaviour?

Cheers
_______________________________________________
postgis-devel mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-devel


_______________________________________________
postgis-devel mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-devel
Reply | Threaded
Open this post in threaded view
|

Re: Operations on mixed geometries in geography types

J Smith-4
On Tue, Feb 21, 2017 at 6:07 PM, Paul Ramsey <[hidden email]> wrote:
> Change your tests. Early versions of geography were 4326-only, but it's now
> possible to have other geographic SRIDs
>

Ah, perfect. I'll have to go through the docs, I did a quick perusal
but didn't see anything at first glance but obviously I need something
more than a glance.

Cheers
_______________________________________________
postgis-devel mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-devel