<s> '''<STR_LIT>''' <EOL> import os <EOL> try : <EOL> import ogr <EOL> except ImportError : <EOL> from osgeo import ogr <EOL> try : <EOL> import osr <EOL> except ImportError : <EOL> from osgeo import osr <EOL> in_shp = '<STR_LIT>' <EOL> in_shp_datasource = ogr . Open ( in_shp ) <EOL> srs = osr . SpatialReference ( ) <EOL> srs . ImportFromEPSG ( <NUM_LIT> ) <EOL> out_shp = '<STR_LIT>' <EOL> out_layer_name = '<STR_LIT>' <EOL> driver = ogr . GetDriverByName ( '<STR_LIT>' ) <EOL> if os . path . exists ( out_shp ) : <EOL> driver . DeleteDataSource ( out_shp ) <EOL> out_shp_datasource = driver . CreateDataSource ( out_shp ) <EOL> out_layer = out_shp_datasource . CreateLayer ( out_layer_name , srs , ogr . wkbLineString ) <EOL> layer_number = in_shp_datasource . GetLayerCount ( ) <EOL> in_layer = in_shp_datasource . GetLayerByIndex ( <NUM_LIT:0> ) <EOL> in_layer_defn = in_layer . GetLayerDefn ( ) <EOL> num_field_col = in_layer_defn . GetFieldCount ( ) <EOL> for each in range ( num_field_col ) : <EOL> field = in_layer_defn . GetFieldDefn ( each ) <EOL> out_layer . CreateField ( field ) <EOL> features_number = in_layer . GetFeatureCount ( ) <EOL> for i in range ( features_number ) : <EOL> in_shp_feature = in_layer . GetFeature ( i ) <EOL> in_feature_geometry = in_shp_feature . GetGeometryRef ( ) <EOL> in_feature_length = in_feature_geometry . Length ( ) <EOL> if in_feature_length > <NUM_LIT:20> : <EOL> out_layer . CreateFeature ( in_shp_feature ) </s>
