2

I'm using GDAL/OGR to open shapefiles. Now i'm calling this method to open a dataset:

dataset = (GDALDataset *)GDALOpenEx(path.toStdString().c_str(), GDAL_OF_VECTOR, NULL,NULL, NULL);

I read in http://www.gdal.org/classGDALDataset.html#a9cb8585d0b3c16726b08e25bcc94274a that i can define option with NULL, or a NULL terminated list of strings the dataset open options using the papszOpenOptions var.

I don't undestand with the documentation how is this cons char* const*

must be declared.

Could some one help me?

I want set the Overview level in the open method.

3
  • You are using shapefiles but overview levels belong to raster datasets. Question about how to use open options is relevant but overviews in context of vector data are not.
    – user30184
    Commented Jun 27, 2018 at 9:19
  • @user30184 thanks for the information. I Supose that would be worked whith shape files too. Do you know how can i simplify a shapefile in the opening call?
    – Zharios
    Commented Jun 27, 2018 at 9:31
  • Use ExecuteSQL with SQLite SQL dialect gdal.org/ogr_sql_sqlite.html. Then you can utilize the SpatiaLite function ST_Simplify.
    – user30184
    Commented Jun 27, 2018 at 9:34

1 Answer 1

3

As for me the easiest way is using CSLAddNameValue

char **papszOptions = nullptr;
papszOptions = CSLAddNameValue(papszOptions, "KEY", "VALUE");

Don't forget to free options list after using:

CSLDestroy( papszOptions ); 

Also see GDAL Documentation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.