[mapserver-users] editing shp files

Paul Spencer pagameba at magma.ca
Tue Jul 30 06:53:25 PDT 2002


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.

Cheers,

Paul Spencer
Applications and Software Development
DM Solutions Group

Seamus Thomas Carroll wrote:

>Hi,
>
>Does anyone know of a way to edit a shp file not using an esri product.  
>I have a file containing 950,000 Canadian postal codes and I want to 
>extract the British Columbia postal codes.  There are many attributes that 
>seperate BC postal codes from the rest of the country.  I want to split up 
>the postal code file to decrease the amount of time to display the 
>postal codes.
>
>  
>






More information about the MapServer-users mailing list