[postgis-users] Problem with ST_Within, Polygons and Multipolygons

Kevin Neufeld kneufeld at refractions.net
Thu May 7 15:16:45 PDT 2009


Yeah, that's a good question.  You could try to break-down your ocean geometry into the raw linework, properly node the 
linework, and then rebuild your polygons.

ie.
-- Extract the linework
CREATE TABLE water_poly_boundaries AS
SELECT st_collect(st_boundary(the_geom)) AS the_geom
FROM water_polys ;

-- Node the linework
CREATE TABLE water_boundaries_noded AS
SELECT st_union(the_geom, st_startpoint(the_geom)) AS the_geom
FROM water_poly_boundaries ;

Then use buildarea or polygonize to rebuild the polygons.

-- Kevin

Jorge Arévalo wrote:
...
> Oh, and thanks again for your response to my original question. It 
> helped me a lot... Maybe is it time to ask for new data, without errors? 
> If not, how should I "clean" my data? I tried with ST_Buffer(geom, 0.0) 
> (I read in this link 
> http://www.bostongis.com/postgis_extent_expand_buffer_distance.snippet 
> that is useful to repair data with self-interesections), but doesn't 
> seem to work for me...
> 
> Regards
> Jorge
> 



More information about the postgis-users mailing list