Contents
What causes no mixed srid error in PostGIS?
No mixed SRID error messages will be raised if the bounding boxes don’t intersect. But if they do intersect, the second filter is _ST_Intersects, which is more precise and checks the two SRIDs to make sure they match, and raises an error if they are mixed.
How to do an operation on mixed srid geometries?
There’s some description in Section 15 about this. @DPierce has answered the specific question but more broadly, if you’re trying to do an operation on mixed SRID geometries, you can use the ST_TRANSFORM function to cast your geometry into the SRID of the other geometry.
How to create proper geometry in PostGIS data type?
A couple of observations that may help: One, Point (Double, Double) is a native PostgreSQL function that you are coercing to a PostGIS data type. ST_MakePoint (double x, double y) will create proper geometry.
Why are the SRIDs in the same srid?
With your case, the SRIDs are the same, but you didn’t encode the SRID to the query point. So, to fix your query always specify the same SRID for your query point, and they will no longer be mixed.
When do you mix a geometry with a SRID?
When you specify a geometry without an SRID, it is actually 0 (or -1 for version < 2): So when you use this geometry with another one with SRID=4326, it is mixing 0 and 4326. This is usually a useful error, if the spatial references are truly different.
How to change the projection of data in PostGIS?
PostGIS includes built-in support for changing the projection of data, using the ST_Transform (geometry, srid) function. For managing the spatial reference identifiers on geometries, PostGIS provides the ST_SRID (geometry) and ST_SetSRID (geometry, srid) functions. We can confirm the SRID of our data with the ST_SRID function:
How are the geometries defined in PostGIS in SQL?
In conformance with the Simple Features for SQL ( SFSQL) specification, PostGIS provides two tables to track and report on the geometry types available in a given database. The first table, spatial_ref_sys, defines all the spatial reference systems known to the database and will be described in greater detail later.