[postgis-users] row-wise geometry intersecting

Stephen Woodbridge woodbri at swoodbridge.com
Tue Jun 12 12:52:40 PDT 2012


Brent,

select count(*) from v_images where not isvalid(wkb_geom_extent);

select count(*) from v_images where not isvalid(wkb_geom_extent) and not 
isvalid(st_buffer(wkb_geom_extent, 0.0));

update v_images set wkb_geom_extent=st_buffer(wkb_geom_extent, 0.0)
  where not isvalid(wkb_geom_extent);

You might want to backup your table first. If the second query returns 
zero then it should fix all the problems. You might want to get a list 
of the invalid ones and check them against the buffered ones also.

-Steve

On 6/12/2012 1:52 PM, Brent Fraser wrote:
> Hi All,
>
> I've got a table (a view actually) with two multipolygon geometry
> columns: wkb_geom_extent and wkb_geom_digitized.
>
> They contain polygons representing the footprint of images and the areas
> digitized in the images.
>
> So the view looks like:
> v_images
> image_id: wkb_geom_extent: wkb_geom_digitized:
> 1 xxxxx xxxx
> 2 xxxxx
> 3 xxxxxx xxxxx
>
>
> I want to calculate the area digitized in each of the images and since
> some of the polygons representing the area digitized could have be
> sloppily defined to extend outside of the image footprint , I thought I
> would intersect the two geometries:
>
> SELECT image_id, ST_Intersection(wkb_geom_extent, wkb_geom_digitized) as
> image_area FROM v _images
>
> but I get an error:
>
> NOTICE: TopologyException: side location conflict at -17.2242 79.1865
> ERROR: GEOS Intersection() threw an error!
> ********** Error **********
> ERROR: GEOS Intersection() threw an error!
> SQL state: XX000
>
> This may be due to some problems in my geometries, but I thought I would
> check to see if my query was reasonable...
>
> Thanks!
>




More information about the postgis-users mailing list