0

I've looked at existing questions about this (including this one) and followed the advice that was shared there. I'm still seeing this when I run some queries:

RuntimeError: Postgis Plugin: PSQL error:
ERROR:  Operation on two geometries with different SRIDs
Full sql was: 'SELECT ST_AsBinary("wkb_geometry") AS geom,"ogc_fid" FROM (SELECT ogc_fid,wkb_geometry,ele::integer FROM srtm3_contours_50m) AS "srtm-contour-50m" WHERE "wkb_geometry" && ST_SetSRID('BOX3D(-549661.6930924922 7480280.288652307,-338719.9409595227 7801966.460655085)'::box3d, 900916)'

Here's what I did to try to set the SRID:

UPDATE srtm3_contours_50m SET wkb_geometry = ST_SetSRID(wkb_geometry, 3785);
UPDATE srtm3_contours_50m SET wkb_geometry = ST_Transform(wkb_geometry, 3785);
VACUUM ANALYZE srtm3_contours_50m;

How can this still be happening?! Is my query to blame?

2
SELECT ST_Intersects(a.geom, b.geom) 
FROM 
  (SELECT ST_SetSrid(ST_MakePoint(300000, 300000), 3587) as geom) a,
  (SELECT ST_SetSrid(ST_MakePoint(300000, 300000), 900913) as geom) b;

returns ERROR: Operation on mixed SRID geometries, ie, even though these are identical points, and the SRIDs 900913 and 3857 describe identical coordinate reference systems, Postgis will complain. So, I would suggest adjusting your query so that you use 3857 in place of 900913.

If the problem persists, as these errors can also come from metadata settings, you can try running UpdateGeometrySRID, potentially in conjunction with USING ST_Transform(geom, 3857);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.