[postgis-users] GeosIntersects Error

David Haynes haynesd2 at gmail.com
Wed Aug 17 14:57:02 PDT 2016


Hello,

I am running into an interesting version of the bad topology error.
During a raster/vector overlay I receive the following error:
"GEOSIntersects: TopologyException"

I figure I have some bad topologies in my vector dataset. I run the
following code and receive no records. I don't have any invalid topologies.

with data as
(
SELECT sgl.id as sample_geog_level_id, gi.id as geog_instance_id, gi.label
as geog_instance_label, gi.code as geog_instance_code,
ST_IsValid(bound.geog::geometry) as valid
FROM sample_geog_levels sgl
inner join geog_instances gi on sgl.id = gi.sample_geog_level_id
inner join boundaries bound on bound.geog_instance_id = gi.id
WHERE sgl.id = 1043
)
SELECT sample_geog_level_id
FROM data
WHERE valid = FALSE

However whenever I run this I receive the invalid topologies error

WITH geographic_boundaries AS
(
SELECT sgl.id as sample_geog_level_id, gi.id as geog_instance_id, gi.label
as geog_instance_label, gi.code as geog_instance_code, bound.geog::geometry
as geom
FROM sample_geog_levels sgl
inner join geog_instances gi on sgl.id = gi.sample_geog_level_id
inner join boundaries bound on bound.geog_instance_id = gi.id
WHERE sgl.id = 1043
)
SELECT p.geog_instance_id as geog_id, p.geog_instance_label as place_name,
p.geog_instance_code as place_code, ST_Clip(r.rast, 1, p.geom, True) as rast
FROM geographic_boundaries p inner join landcover.glc2000_tp  r on
ST_Intersects(r.rast, 1, p.geom)

I also went through the process of running ST_MakeValid(geom) on my data
into a new table and still encounter the error. What am I missing? This
particular error also spits out an x,y location that changes
-113.02232164290001 43.120535816300048
-126.41517874290001 47.584821516300046
-122.12053589950004 48.281250085500034
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20160817/fbe9f7ce/attachment.html>


More information about the postgis-users mailing list