<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> latitudes = [ <NUM_LIT:0> , <NUM_LIT:10> , <NUM_LIT:20> , <NUM_LIT:30> , <NUM_LIT> ] <EOL> longitudes = [ <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:50> , <NUM_LIT> , <NUM_LIT> ] <EOL> shapefile = '<STR_LIT>' <EOL> layer_name = '<STR_LIT>' <EOL> driver = ogr . GetDriverByName ( '<STR_LIT>' ) <EOL> if os . path . exists ( shapefile ) : <EOL> driver . DeleteDataSource ( shapefile ) <EOL> data_source = driver . CreateDataSource ( shapefile ) <EOL> srs = osr . SpatialReference ( ) <EOL> srs . ImportFromEPSG ( <NUM_LIT> ) <EOL> layer = data_source . CreateLayer ( layer_name , srs , ogr . wkbPolygon ) <EOL> field_name = ogr . FieldDefn ( "<STR_LIT:Name>" , ogr . OFTString ) <EOL> field_name . SetWidth ( <NUM_LIT> ) <EOL> layer . CreateField ( field_name ) <EOL> linear_ring = ogr . Geometry ( ogr . wkbLinearRing ) <EOL> linear_ring . AddPoint ( longitudes [ <NUM_LIT:0> ] , latitudes [ <NUM_LIT:0> ] ) <EOL> linear_ring . AddPoint ( longitudes [ <NUM_LIT:1> ] , latitudes [ <NUM_LIT:1> ] ) <EOL> linear_ring . AddPoint ( longitudes [ <NUM_LIT:2> ] , latitudes [ <NUM_LIT:2> ] ) <EOL> linear_ring . AddPoint ( longitudes [ <NUM_LIT:3> ] , latitudes [ <NUM_LIT:3> ] ) <EOL> linear_ring . AddPoint ( longitudes [ <NUM_LIT:4> ] , latitudes [ <NUM_LIT:4> ] ) <EOL> linear_ring . AddPoint ( longitudes [ <NUM_LIT:0> ] , latitudes [ <NUM_LIT:0> ] ) <EOL> polygon = ogr . Geometry ( ogr . wkbPolygon ) <EOL> polygon . AddGeometry ( linear_ring ) <EOL> feature = ogr . Feature ( layer . GetLayerDefn ( ) ) <EOL> feature . SetGeometry ( polygon ) <EOL> feature . SetField ( "<STR_LIT:Name>" , '<STR_LIT>' ) <EOL> layer . CreateFeature ( feature ) </s>
