0

I want to check if a point is in a polygon or not with this query:

SELECT ST_Contains ( '0103000000010000001400000011FF156A9E352541DE2D18CE2EDF1641DA40D5EDA53425414BFB34C40DE116410C49814A47342541E03EC0B0AEE1164194440E3141342541638E57EDB7E11641E2B88DC4533525416A9861CD8FE4164182375DD534362541E671078BE8E61641EC780186613625419003FF582BE716411A0222D26536254174E4D7CB1DE71641195A908B3A362541D73F1E1BDDE61641DB6FA22766352541A38CA432A6E41641C98F7B295A3525416FB5DA2F86E4164135573DAE193525412473EC34DBE31641265EE823E73425415B50633155E31641458741D34B3425411ECF425BB9E1164109AF25A1AA342541827D572618E11641230D54A315372541ADA50DFF6EDC164170CF51B328372541D967C1404ADC16415CF9C9F5243725411AF9DD043EDC1641530190A4173625412453692245DE164111FF156A9E352541DE2D18CE2EDF1641' '0101000000B1DE9305D01C2541FB428F9E6C211741') I res

Normally it must return true or false as the case but give the error:

Warning: pg_query (): Query failed: ERROR: function st_contains (unknown, unknown) is not unique LINE 1: SELECT ST_Contains ('0103000000010000001400000011FF156A9E3525 ... ^ HINT: cast in C: \ xampp \ htdocs \ dashboard \ project_na_convertire_dxf \ new.php on line 116

What should I change in my query?

1 Answer 1

3

You should tell PostGreSQL those 2 values are geometries, because it doesn't know which type they are. They could just as wel be texts.

You also missed a comma:

If you use:

SELECT ST_Contains ( '0103000000010000001400000011FF156A9E352541DE2D18CE2EDF1641DA40D5EDA53425414BFB34C40DE116410C49814A47342541E03EC0B0AEE1164194440E3141342541638E57EDB7E11641E2B88DC4533525416A9861CD8FE4164182375DD534362541E671078BE8E61641EC780186613625419003FF582BE716411A0222D26536254174E4D7CB1DE71641195A908B3A362541D73F1E1BDDE61641DB6FA22766352541A38CA432A6E41641C98F7B295A3525416FB5DA2F86E4164135573DAE193525412473EC34DBE31641265EE823E73425415B50633155E31641458741D34B3425411ECF425BB9E1164109AF25A1AA342541827D572618E11641230D54A315372541ADA50DFF6EDC164170CF51B328372541D967C1404ADC16415CF9C9F5243725411AF9DD043EDC1641530190A4173625412453692245DE164111FF156A9E352541DE2D18CE2EDF1641'::Geometry, '0101000000B1DE9305D01C2541FB428F9E6C211741'::Geometry) 

It gives false as the result.

Your Answer

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

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