[mapserver-users] editing shp files
Seamus Thomas Carroll
carrolls at unbc.ca
Tue Jul 30 10:56:54 PDT 2002
Sound like a good idea. I will give it a try.
Seamus
On Tue, 30 Jul 2002, Frank Warmerdam wrote:
> Paul Spencer wrote:
> > If you are adventurous, you could get openev
> > (http://openev.sourceforge.net) and write a simple python script to
> > process your shapefile
> >
> > sample python script:
> >
> > import gview
> >
> > shapes_in = gview.GvShapes( shapefilename="/path/to/my/shapefile" )
> > shapes_out = gview.GvShapes()
> >
> > #assuming you want the same schema
> > shapes_out.set_properties( shapes_in.get_properties() )
> >
> > for shape in shapes_in:
> > props = shape.get_properties()
> > #this would test against the first character
> > if props['postalcode'][:1] == 'V':
> > shapes_out.append( shape.copy() )
> >
> > shapes_out.save_as( "/path/to/new/shapefile" )
> >
> > If you are interested but aren't a python programmer, I could probably
> > help you with this as long as you can get openev installed.
>
> Seamus,
>
> In fact, if all you want to do is select some of the records from a shapefile
> based on attributes, you could try using the ogr2ogr utility from GDAL/OGR.
> It includes the ability to select records to copy based on an SQL WHERE like
> syntax.
>
> eg.
>
> ogr2ogr -select "post_address like '%British Columbia%'" bc.shp all.shp
>
> Of course, Paul's OpenEV/python solution is even more flexible than ogr2ogr
> on its own. Ogr2ogr is part of the GDAL/OGR suite.
>
> http://www.remotesensing.org/gdal
> http://gdal.velocet.ca/projects/opengis
>
> Best regards,
>
>
--
Seamus Carroll
More information about the MapServer-users
mailing list