MAK
MAK

Reputation: 7260

function st_intersects() does not exist using PostgreSQL 9.3

I have a table as shown below with three columns.

Table: geomet

create table geomet
(
cola float,
colb float,
geopath geometry
);

Insertion of records:

insert into geomet values('12.32232442','43.2324535',point(12.32232442,43.2324535)::geometry);

I have this:

select * from geomet;

cola          colb         geopath
---------------------------------------------------------------------
12.32232442   43.2324535   01010000004F34D5B407A528409D2B4A09C19D4540

Note: I need to find the Intersect of column geopath in my table as shown above. I have also installed PostGIS.

So I have tried this:

Try 1:

SELECT ST_Intersects(geopath) from geomet;

Got an error:

ERROR:  function st_intersects(geometry) does not exist

Try 2:

SELECT ST_Intersects(cola,colb) from geomet;

Got an error:

ERROR:  function st_intersects(double precision, double precision) does not exist

Upvotes: 0

Views: 2438

Answers (1)

John Powell
John Powell

Reputation: 12571

ST_Intersects requires two geometries or two geometry fields, as you are checking for the intersection between one geometry and another or one set and another set.

SELECT ST_Intersects(geomA, geomB) FROM some_table;

or

SELECT a.id., b.id, ST_Intersects(a.geom, b.geom)
FROM table a, table b 
WHERE a.id > b.id;

will give you all the pairwise intersection between two tables. Obviously, you can use ST_Intersects in a where clause in a similar fashion, to only return rows where the records from two different tables intersect.

Upvotes: 3

Related Questions