[Xastir] Re: Splitting shapefiles with ogr2ogr

Tom Russo russo at bogodyn.org
Tue Jan 4 13:17:29 EST 2005


On Tue, Jan 04, 2005 at 11:15:32AM -0700, we recorded a bogon-computron collision of the <russo at bogodyn.org> flavor, containing:
> A few weeks ago there was talk here about how to split up shapefiles by
> feature type (i.e. take tiger files and split out only major roads into
> a separate shapefile, etc.).  At that time I produced two utterly trivial
> hacks using shapelib that could do some very simple splitting and put them up
> on my "shape_web" site.  Some folks have used them to create smaller shapefiles
> with fewer features to improve render speed.
> 
> I have since looked at ogr2ogr and realized that it can do this operation with 
> far more power.
> 

And ogr2ogr is also able to do spatial subsetting:

 ogr2ogr -f "ESRI Shapefile" -spat xmin ymin xmax ymax ...

The spatial selection can be mixed with a -where clause to get both
split-by-feature and split-by-location functions.

-- 
Tom Russo    KM5VY     SAR502  DM64ux         http://www.swcp.com/~russo/
Tijeras, NM  QRPL#1592 K2#398  SOC#236 AHTB#1 http://www.qsl.net/~km5vy/
 "When life gives you lemons, find someone with a paper cut."



More information about the Xastir mailing list