I'm new in python. I have a class which opens SXF format, and i want the last string
self.sxf_ds = gdal.OpenEx(self.sxf_path)
to be opened with flag 'GDAL_OF_VERBOSE_ERROR' but the nOpenFlags is integer not the string. Where i can find the NUMBER of this flag??. In gdal.py for openEx function there is a comment: "OpenEx(char const * utf8_path, unsigned int nOpenFlags=0, char ** allowed_drivers=None, char ** open_options=None, char ** sibling_files=None) -> Dataset"
In gdal help only definition is written: nOpenFlags a combination of GDAL_OF_ flags that may be combined through logical or operator.
- Driver kind:GDAL_OF_RASTER for raster drivers, GDAL_OF_VECTOR for vector drivers. If none of the value is specified, both kinds are implied.GDAL_OF_RASTER for raster drivers, GDAL_OF_VECTOR for vector drivers. If none of the value is specified, both kinds are implied.
- Access mode: GDAL_OF_READONLY (exclusive)or GDAL_OF_UPDATE.
- Shared mode: GDAL_OF_SHARED. If set, it allows the sharing of GDALDataset handles for a dataset with other callers that have set GDAL_OF_SHARED. In particular, GDALOpenEx() will first consult its list of currently open and shared GDALDataset's, and if the GetDescription() name for one exactly matches the pszFilename passed to GDALOpenEx() it will be referenced and returned, if GDALOpenEx() is called from the same thread.
- Verbose error: GDAL_OF_VERBOSE_ERROR. If set, a failed attempt to open the file will lead to an error message to be reported.
here is a link to gdal docs.
If i write
self.sxf_ds = gdal.OpenEx(self.sxf_path,'GDAL_OF_VERBOSE_ERROR')
i'm getting an obvious error: TypeError: in method 'OpenEx', argument 2 of type 'unsigned int'. I suppose i need something like that
self.sxf_ds = gdal.OpenEx(self.sxf_path,1)or
self.sxf_ds = gdal.OpenEx(self.sxf_path,2)
class sxf2dxf(object): """docstring for sxf2dxf""" def __init__(self, sxf_path, rsc_path, dxf_style_path, dxf_out_path): self.sxf_path = sxf_path self.rsc_path = rsc_path self.dxf_style_path = dxf_style_path self.dxf_out_path = dxf_out_path self.cls = RSC.parse(rsc_path, cls_type='geom_type') tools.MyPrint().pprint(self.cls) gdal.SetConfigOption('SXF_RSC_FILENAME', self.rsc_path.encode('utf-8')) # gdal.SetConfigOption('SXF_LAYER_FULLNAME', False) # usage of long layer names self.sxf_ds = gdal.OpenEx(self.sxf_path)