1

I've got a table which it has a geometry column filed by some point (ex. "POINT Z (116.309627 39.991285 148)"). now I want to select point's id from the table. I wrote follow sql Code but I force an error:

ERROR: Operation on two GEOMETRIES with different SRIDs SQL state: XX000

select id from database
 where (point_lat_lon = 'POINT Z (116.309627 39.991285 148)');
JGH
44.4k3 gold badges49 silver badges95 bronze badges
asked Aug 16, 2015 at 13:30

1 Answer 1

3

You need to cast the string to a geometry then set its SRID to match the geometry column's SRID.

select id 
from database 
where point_lat_lon = st_setsrid('POINT Z (116.309627 39.991285 148)'::geometry, 
 ST_SRID(point_lat_lon));
answered Aug 16, 2015 at 16:45
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.