New answers tagged

1 vote

ogr2ogr merge two GeoJSON to one GeoJSON

You can also merge GeoJSON files using a JSON processing command line tool such as jq. jq '{"type": "FeatureCollection", "features": [.[] | .features[]]}' --slurp input*....
  • 171
3 votes

Ogr2Ogr appending duplicate records (2X Times) to PostgreSQL Table

Switch -append is adding new features into the table. If you already had a table with 3620 rows then the result is expected. If the table was empty then the result is strange. If you want to replace ...
  • 58.9k
1 vote

ogr2ogr: Make polygon from points

You can also read your .csv file with GDAL directly without editing it. Just read the documentation https://gdal.org/drivers/vector/csv.html and use the syntax like ogrinfo concave.csv -al -oo ...
  • 58.9k
0 votes

Convert gpkg to OSM using ogr2ogr

Ogr2ogr is not capable of converting to osm, you need to use another tool like for example ogr2osm. It expects at least the input file as parameter, in your case that will be the .gpkg file in stead ...
  • 1
0 votes

Setting top-level GeoJSON id using ogr2ogr?

This works with GDAL 3.6.2. Attribute "attributefid" is first selected as name "foobar" and consumed as a GeoJSON id, and then it gets selected again with * and placed into GeoJSON ...
  • 58.9k
0 votes

Importing GeoJson data to postgresql using ogr2ogr command

Your data are valid JSON but not valid GeoJSON. You can test yourself by pasting this into https://geojsonlint.com { "type": "FeatureCollection", "properties": { "...
  • 58.9k
0 votes

Using ogr2ogr in Python scripts

This is how I did it (for fgb): from osgeo import gdal shpin = 'shpin.shp' gdal.UseExceptions() src_shp = gdal.OpenEx(shpin) ds=gdal.VectorTranslate( 'abc.fgb', src_shp, options='-f "FlatGeobuf&...
1 vote

Correct syntax for specifying multiple Layer Creation Options in ogr2ogr

I made a test with GDAL 3.6.2 and the syntax that you used works for me. I used this GeoJSON as source data: { "type": "FeatureCollection", "features": [ { "type&...
  • 58.9k
2 votes
Accepted

Setting different GDAL configuration folder when calling ogr2ogr with Python subprocess

To set the GDAL_CONFIG_FILE environment variable for only that process you can pass the env arg to subprocess.run(). This expects a dict containing the complete set of vars to be used, so you should ...
  • 4,643

Top 50 recent answers are included