[gdal-dev] Clipping shapefiles

Matthew Huck matthew.huck at gmail.com
Wed Sep 10 15:47:20 EDT 2008


Hi,
  Thanks for that, I seem to have something working now (or so I think), my
shape file is the contours lines for a reasonably hilly area (100Mb), and
I'm clipping it to an area of about 1/12.  The only thing is it's still
running about 17 hours later. Is v.overlay slow or have I done something
wrong, here are my steps:

g.region vect=NZMG_s27
v.in.region output=cutter type=line --overwrite
v.overlay ainput=wellington_contours atype=line binput=cutter output=clipped
operator=and

Thanks in advance

Matthew


On Thu, Sep 4, 2008 at 9:09 PM, Craig Leat <craig.leat at gmail.com> wrote:

> Hi Matthew
>
> Matthew Huck wrote:
> >  Hi,  I've got a reasonably large shapefile that I wish to break down
> > into areas that match the topographic maps in NZMG. I've got a python
> > script that creates a shapefile with each topomap as a polygon in it
> > (and I can create a shapefile per topo map too if required). What I
> > can't work out how to do is to clip my master shapefile by the smaller
> > shapefiles. I've seen ideas of copying across the features if they
> > intersect with the clipping box, but the data is contour lines so I
> > want to "cut" the contour lines at the boundry of the clipping boxes.
> > Any ideas on the best way to do it, I can get MapWindow to do it
> > (sometimes, but it crashes frequently).
>
> I use GRASS for this sort of task. The basic steps are:
>
> 1. Import shape files using v.in.ogr
> 2. Set the region extents (a bounding box for the area of interest)
> using g.region
> 3. Make a vector to be used as a cutter - v.in.region
> 4. Select within the region box and cut on the boundary using v.overlay
>
> It's quite easy to roll these steps into a script and is definitely
> the way to go if you have to do this many times.
>
> Craig
>
> gdal/ogr devs, an ogr2tiles.py would be quite nice.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080911/1eb4d77c/attachment.html


More information about the gdal-dev mailing list