1

I have a situation where I need to find which of my geodataframe geometries already exists on my postgis table.

For that I was thinking in use something like a IN clause for my sql. But I don't know how to use a IN clause in my where condition with postgis geometries.

I already achieved the expected result by transforming my geodataframe to WKB and using the ST_GeomFromWKB() function to every geometry:

select id, geom from table
where geom in (ST_GeomFromWKB(geom1), ST_GeomFromWKB(geom2), ...)

But it doesn't seem very efficient. I believe there may be a better way to do this. Maybe using ST_DWithin() but I didn't quite get it how I could do that using this function.

I would like to have something like this:

select id, geom from table
where geom in (geom1, geom2, geom3)

0 Answers0