I try to make ogr2ogr work in Python the way suggested by Elevine's answer elsewhere, but I'm facing bugs. Most notable error is that while I try to reproject shapefiles, I get the following error:
Unable to open datasource `lesy_w.shp' with the following drivers.
A list of formats follow, including "ESRI SHapefile". My command looks like this:
ogr2ogr.main(["", "-f","ESRI Shapefile", "-s_srs","epsg:4326", "-t_srs","epsg:32633", "lesy_u.shp","lesy_w.shp"])
The corresponding ogr2ogr command (
ogr2ogr -f ESRI Shapefile -t_srs epsg:32633 lesy_u.shp lesy_w.shp) works well in the command line. It's a simple line geometry, no "geometry collection". The input shapefile (
lesy_w.shp) is loaded as a QGIS layer normally. I tested this with other layers and the problem is still there.
I get the same error also while trying other operations, like converting to
KML without reprojection. The same when I try to convert from
Is filing this as a bug in ogr2ogr.main() my only option, or is there any solution?