Geoscience Reference
In-Depth Information
feature.SetGeometry(geom.Buffer(float(buffdist)))
layer.CreateFeature(feature)
del geom
ds_out.Destroy()
except:
return False
return True
#include the handler to run the program
if __name__ =="__main__":
main()
We can now run the Python script on the polygon outline of France and then visual-
ize the results using the script plotVector.py that was created in the Sect. 14.2.4 .
python dm_buffer.py FRA_adm0.shp FRA_adm0_buff.shp 0.3
python plotshp.py -d FRA_adm0_buff.shp -color green
14.2.5 X-Y CSV to OGR Format
It is quite common to receive a list of coordinates in a Comma Separated Value (CSV)
file that you would like to use spatially, for visualization and/or for analysis. Many
GIS packages provide this functionality. To demonstrate some other features of the
OGR Python bindings, we will write a program that will read a CSV file containing a
set of coordinates and use theOGRAPI to create either anESRI Shapefile or Spatialite
layer depending on what the user specifies on the command line. In addition, we
 
Search WWH ::




Custom Search