<s> '''<STR_LIT>''' <EOL> import os <EOL> try : <EOL> import ogr <EOL> except ImportError : <EOL> from osgeo import ogr <EOL> line_shp_file = "<STR_LIT>" <EOL> line_datasource = ogr . Open ( line_shp_file ) <EOL> driver = ogr . GetDriverByName ( '<STR_LIT>' ) <EOL> point_shp_file = '<STR_LIT>' <EOL> layer_name = '<STR_LIT>' <EOL> if os . path . exists ( point_shp_file ) : <EOL> driver . DeleteDataSource ( point_shp_file ) <EOL> point_datasource = driver . CreateDataSource ( point_shp_file ) <EOL> layer_count = line_datasource . GetLayerCount ( ) <EOL> for each_layer in range ( layer_count ) : <EOL> layer = line_datasource . GetLayerByIndex ( each_layer ) <EOL> srs = layer . GetSpatialRef ( ) <EOL> point_shp_layer = point_datasource . CreateLayer ( layer_name , srs , ogr . wkbPoint ) <EOL> feature_count = layer . GetFeatureCount ( ) <EOL> for each_feature in range ( feature_count ) : <EOL> line_feature = layer . GetFeature ( each_feature ) <EOL> feature_geom = line_feature . GetGeometryRef ( ) <EOL> if feature_geom . GetGeometryName ( ) != '<STR_LIT>' : <EOL> points = feature_geom . GetPoints ( ) <EOL> for point in points : <EOL> point_geom = ogr . Geometry ( ogr . wkbPoint ) <EOL> point_geom . AddPoint ( point [ <NUM_LIT:0> ] , point [ <NUM_LIT:1> ] ) <EOL> point_feature = ogr . Feature ( point_shp_layer . GetLayerDefn ( ) ) <EOL> point_feature . SetGeometry ( point_geom ) <EOL> point_shp_layer . CreateFeature ( point_feature ) </s>
