[FWTools] ogr: how to create a data source?

Bryan Keith bryan at geomega.com
Tue Oct 18 11:07:02 EDT 2005


If this isn't the correct list for this question, let me know.

I have some Python code that creates a new shapefile.  It uses these ogr 
calls:

ogrSDS = ogr.Open(os.path.abspath(""),1)
ogrSLayerNew = ogrSDS.CreateLayer(myfilename, None, geomtype)

This works fine if a shapefile already exists in the directory.  
However, when no shapefiles (or any other data sources) exist in the 
directory then the ogr.Open method fails.  Is there a way to create a 
data source?  Or what am I supposed to do here?

Thank you,

Bryan

Bryan Keith
GIS Specialist
Geomega, Inc.
Boulder, CO, USA



More information about the FWTools mailing list