Skip to main content
6 votes
Accepted

Does GDAL have an error with calling multiple functions on the same line of code?

This is a GDAL python "gotcha": Python crashes if you use an object after deleting an object it has a relationship with ... This problem can manifest itself in subtle ways. For example, it ...
user2856's user avatar
  • 66.6k
5 votes
Accepted

How to extract the integer-based geometry type code from an OGR feature

After poking around a little longer, I found out that while OGR geometries don't have access to the GetGeomType method, they DO have access to the GetGeometryType method, which outputs exactly what I'...
Felipe D.'s user avatar
  • 2,629
5 votes
Accepted

ogr2ogr cannot open datasource ogrinfo can open

That error on your second attempt doesn't make sense if this is the issue, but one mistake you made is that -f declares output file format, not input. So if you're meaning to convert to SHP, you'll ...
oliwf's user avatar
  • 66
4 votes
Accepted

Specify layer when using a geopackage in ogr2ogr

Based on the ogr2ogr documentation, this should work: ogr2ogr -clipsrc clip_polygons.gpkg -clipsrclayer clip_polygons_layer -nln output_layer output.gpkg input.gpkg input_layer
Pieter's user avatar
  • 2,759
3 votes

ogr2ogr cannot open datasource ogrinfo can open

The error is not about opening but about creating the data/osm/extract.osm.pbf file. GDAL cannot create new OSM PBF files. Best use a tool like osmium for this.
bugmenot123's user avatar
  • 10.9k
2 votes

In QGIS Georeferencer: Mysterious OGR Driver Error: not found OGR

I found the solution! It is a weird one but hear me out. This issue is related to the FILENAME you give your georeferenced image. The files i wanted to georeferenced were named: ...
David SSS's user avatar
2 votes

How to set a 'dataset open option' in ogr on a file geodatabase?

For information, this is also possible using fiona, a library that offers alternative, more "pythonic", bindings to GDAL: tables = fiona.listlayers( "data/filegdb/testopenfilegdb....
Pieter's user avatar
  • 2,759
2 votes
Accepted

How to set a 'dataset open option' in ogr on a file geodatabase?

You can find an example from the GDAL Python tests https://github.com/OSGeo/gdal/blob/master/autotest/ogr/ogr_openfilegdb.py#L2115 # Test LIST_ALL_TABLES=YES open option ds_all_table = gdal....
user30184's user avatar
  • 66.5k
2 votes
Accepted

Let ogr/GDAL automatically choose Driver based on file extension

The cookbooks are apparently a bit dated, but yes, this is possible. Some more up-to-date information can be found in the GDAL Vector API Tutorial. The following should do the trick: Replace from ...
Pieter's user avatar
  • 2,759
1 vote

Is it possible to get features by the WFS vector driver in a coordinate system that is not the default srs regarding the WFS capabilities?

The short answer is that it is possible by adding a supported srsName to the WFS server URL that GDAL is using ...srsName=EPSG:3857or srsName=urn:ogc:def:crs:EPSG::3857 if that is what the WFS server ...
user30184's user avatar
  • 66.5k
1 vote

Read only the structure of a geopackage using GDAL/OGR?

According to https://www.geopackage.org/guidance/getting-started.html : A GeoPackage is an SQLite Database file with a .gpkg extension. If you are unsure whether a file is an SQLite database, you can ...
swiss_knight's user avatar
  • 10.4k
1 vote
Accepted

How to assign a layer to a group in GDB datasets using gdal python

Yes, you can pass the FEATURE_DATASET= layer creation option (specific of the OpenFileGDB driver) to assign a layer to a feature dataset: https://gdal.org/drivers/vector/openfilegdb.html#layer-...
Even Rouault's user avatar
1 vote
Accepted

ogr2ogr -where: match features from OSM PBF with unset "seasonal" field

If the seasonal field is showing as NULL, you should check for seasonal IS NULL in the -where query, like this: "((natural = 'water' and water = '') or (water in ('lake', 'oxbow')) and ...
Pieter's user avatar
  • 2,759
1 vote

Exporting polygon as DXF using PyQGIS

Try this: expFolder = r"/home/cirrusklaus/Downloads/tmp/shp" #Path of a Linux OS adapt it Filename= 'myFile'#adapt it Filetyp='dxf' filename = f"{Filename}.{Filetyp}" output = os....
Klaus's user avatar
  • 329
1 vote

Feature creation error (OGR error: Coordinates with non-finite values are not allowed)

I have had this problem many times when editing a polygon shape and needing to add additional vertices. My solution I just discovered is that if you edit > vertex tool > right click on polygon, ...
Jesse95's user avatar
  • 11
1 vote

GDAL/ogr2ogr ( to convert osm to shapefile)

ogr2ogr does not find the osmconf.ini. Surprisingly :-) As stated in https://gdal.org/drivers/vector/osm.html#configuration you can define an alternate path with the OSM_CONFIG_FILE configuration ...
CaptainInler's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible