Quantcast
Channel: Question and Answer » gdal
Viewing all articles
Browse latest Browse all 397

Python GDAL: ogr.open or driver.open?

$
0
0

I’ve been using GDAL with python to manipulate shapefiles. When opening a source file I first set the driver to “ESRI Shapefile” before calling the driver’s “Open” method with the required shapefile.

I have had no issues with this; however I am curious what the difference is between the Driver instance method “Open” and the ogr function “Open”. For example, what is the difference between:

driver = ogr.GetDriverByName("ESRI Shapefile")
source = driver.Open(“O:myshp.shp”,0)

and

source = ogr.Open(“O:myshp.shp”,0)

Is there a particular scenario where you would use one over the other?


Viewing all articles
Browse latest Browse all 397

Trending Articles