I loaded a set of contours into the database that are really nice, up-to-date LiDAR and breakline derived contours. The are engineering grade aerial contours, but they are a very big and complex dataset. So I’ve done what I had hoped was the hard part, using shp2pgsql, I’ve converted them to PostGIS insert statements and dumped them into the database only to find that some sections are corrupt. I’m hoping to use the function ST_Difference to clip out the bad areas, so I can insert them in again.
There are two problems in the contour dataset– some areas are duplicated records, and some areas are missing or otherwise corrupted areas. I’ve got a polygon file (in purple below) that delineates where the problem areas are, so I hope to use the function ST_Difference to remove these areas so I can repopulate with good data.
CREATE TABLE public.cuy_contours_2_clip AS SELECT elevation, ST_Difference(a.the_geom, b.the_geom) AS the_geom FROM base.cuy_contours_2_1 as a, public.contour_clip_bounds as b;
Let’s see if PostGIS can handle this big of a dataset… .