Intended to function as convienence class that helps to save and convert files and selections on them. Only knows one method so far that saves an ogr layer as a shapefile.
rtype: None
Parameters: |
|
---|
Easily saves some attribute or spatial selection to a shape file:
import ogr
from ogr_utils.copy_helper import CopyHelper
c = CopyHelper()
f = '/home/.../border_segs.shp'
shp =ogr.Open(f,0)
lyr = shp.GetLayer()
lyr.GetFeatureCount()
>>> 13411
fo = '/home/.../border_segs_test.shp'
lyr_sel = shp.ExecuteSQL("select * from 'border_segs' where 'FID' < 100 ")
lyr_sel.GetFeatureCount()
>>> 100
c.lyr_2_shp(lyr_sel,fo,'line')