Questions tagged [ogr2ogr]

ogr2ogr is an open source command line utility popular for converting to and from various vector spatial data formats.

Filter by
Sorted by
Tagged with
3
votes
2answers
24 views

Inserting only subset of columns of shapefile to existing PostGIS table with different column names?

The situation So I have a shapefile with several columns: id|name_en|name_es|name_de|name_fr|... I also have an existing PostGIS table on my remote server: county_id|county_name|county_name_de|...
1
vote
1answer
12 views

ogr2ogr error loading kml file in postgis with php

So I have a kml file that I want to save to my postgis database, Currently I have the following code using php: $file = $request->file("item"); $name = time(); ...
0
votes
1answer
30 views

ogr2ogr large gdb file to SQLite warning: “organizePolygons() received a polygon with more than 100 parts”

I'm trying to write a .gdb file (could also be any other format, geojson, gpkg, etc.) to a Spatialite DB but it takes awhile and I am getting a warning. Command: ogr2ogr --config OGR_SQLITE_CACHE 1024 ...
0
votes
1answer
22 views

ogr2ogr Conversion Clockwise to Counterclockwise?

Looking for the right combination of ogr2ogr parameters to get a .shp bundle to GeoJSON and reverse the Coordinate pairs. I recognize that ESRI defines Polygons as clockwise (http://www.esri.com/...
0
votes
1answer
29 views

Use the Python port of ogr2ogr in memory

I found a Python port of ogr2ogr which can be found here This port allows me to re-project vectors from a Python script instead of having to use the command line: import pyogr2ogr, tempfile with ...
3
votes
0answers
39 views

Getting the results of a PostGIS query to a file with ogr2ogr with low memory usage

I have a PostGIS query returning geographies and attributes. The result set is deterministic and ordered (so OFFSET and LIMIT work for getting subsets). The result set of my query would exceed my RAM ...
0
votes
1answer
29 views

OGR_STYLE BRUSH not applied

I have a shapefile that contains multiple polygons. I want to convert it to a kml but also keep the face color. From other answers here, I have found that I can add a field called OGR_STYLE to the ...
2
votes
0answers
20 views

Is it possible to prevent ogr2ogr from generating a shapefile if no records are returned from the given intersection?

I am generating shapefiles from a geodatabase file with ogr2ogr via the spatialite dialect using the following command: ogr2ogr -f "ESRI Shapefile" ./clipped.shp -dialect sqlite -sql "...
2
votes
1answer
51 views

Export PostGIS data from one database to another with multiple geometry fields (ogr2ogr)

I am trying to copy the data from one database to another database. Both the source and target tables have 2 geometry columns -- a polygon field and a point field. There are NOT NULL constraints on ...
0
votes
0answers
49 views

Using GDAL in Command Line with QGIS 3.10.6 on Mac

I'm fairly new to GIS. I want to run GDAL in the command line on my Mac running MacOS Catalina. My understanding is that QGIS comes with GDAL. GDAL plugins seem to work in my installation of QGIS. I ...
1
vote
0answers
30 views

linux gdal 3.1.0 ogr2ogr ERROR 1: Unable to find driver PostgreSQL

I have seen a number of posts similar to this but I have another issue. I try to complie gdal-3.1.0 to import osm.pbf to PostgreSQL. My os is Red Hat Enterprise Linux Server release 7.6. I need Oracle ...
2
votes
1answer
26 views

ogr2ogr shapefile to PostgreSQL table | cannot change geom field

ogr2ogr -lco GEOMETRY_NAME=geom -f "PostgreSQL" "PG:host=localhost user=postgres dbname=lidar password=postgres" "C:/Users/Rose/Documents/faulty_rasters_test/raster_summary/...
1
vote
1answer
22 views

How can I use ogr2ogr & sqlite to create a new GeoJSON file that contains only a specific set of rows while renaming two of the keys?

I need help with a syntax error from a sqlite command in ogr2ogr. I'm trying to run a query on a geojson file. The query should create a new file that contains only a specific set of rows while ...
2
votes
1answer
110 views

Action to directly export selected features as GPX

I would like to directly export selected tracks of a line layer as gpx. The common way is: Select the line-layer select the tracks for export right-click on the layer -> save selected features as.....
2
votes
1answer
33 views

Using ogr2ogr to export an Oracle Spatial table with measured geometries (3302) to a shapefile ignores the measure values

I have an Oracle spatial table with measured geometries (SDO_GTYPE=3302) which I want to convert to a shapefile. The command I am using is this: ogr2ogr -f "ESRI Shapefile" "tshapeARCM....
0
votes
0answers
35 views

How to speed up ogr2ogr process on giant geodatabase

I have a geodatabase that has over 193 million polygons. I have a process that gets a small subset of this .gdb based on an inputs' extent, for thousands of inputs, using ogr2ogr. I am looking for ...
0
votes
0answers
28 views

In command ogr2ogr add ogc_fid in output

I am executing the command ogr2ogr -nln "demodata" -lco GEOMETRY=AS_XY -t_srs EPSG:4326 -preserve_fid -f "CSV" "/tmp/demo.csv" "PG:host=localhost dbname=demo user=root password=root schemas=...
0
votes
0answers
131 views

How to correctly assign (apply) XSD schema to GML using ogr2ogr?

My task is to convert data from ESRI fileGDB to single GML, applying certain XSD schema (a kind of state standard). So, I used OSGeo4W Shell to write the following command: ogr2ogr -f "GML" -oo ...
3
votes
1answer
50 views

ogr2ogr - accomodate spaces in -select properties

I have a geojson feature collection. Some of its features have spaces in their property names. I am attempting to use the -select argument to limit which properties are included in the output. Is ...
0
votes
1answer
98 views

Convert GeoPackage to ESRI shapefile format

I learned that to convert a DWG file with all its layers from AutoCAD to an ESRI shapefile format in QGIS, one has to first import it as a GeoPackage, and then convert it from a GeoPackage to a ...
0
votes
1answer
20 views

Create Multiple Shapefiles from GeoJSON

I am attempting to convert a GeoJSON Feature Collection into multiple shapefiles. The shapefile a feature ends up in depends on a specific property of the GeoJSON, layer_id. My desired output is a ...
1
vote
1answer
23 views

How to specify output table name in GeoPackage when using ogr2ogr

I want to convert a GeoJSON file to a Layer within a GeoPackage. For this, I'm trying to use the following command: ogr2ogr dist.gpkg mah.geojson -nlt PROMOTE_TO_MULTI This sucessfully creates a ...
0
votes
0answers
13 views

Conversion from .shp o .xml gives invalid data

I tried to convert an ESRI shape file (jagdgebiete.zip) with ogr2ogr from the GDAL library with this command: ogr2ogr -f GPX -dsco GPX_USE_EXTENSIONS=YES Jagdgebiete.gpx Jagdgebiete.shp -nlt ...
0
votes
0answers
22 views

ogr2ogr Error 1: no linking against spatialite library

I'm receiving this error from ogr2ogr: ogr2ogr -f SQLite testspatialite.sqlite test.sqlite -dsco SPATIALITE=YES Warning 6: driver SQLite does not support creation option SPATIALITE ERROR 6: OGR was ...
0
votes
0answers
39 views

Missing gml_id when using ogr2ogr from WFS to PostGIS / GPKG / GML

I am trying to find the way to download on our PostgreSQL+PostGIS database the content of several WFS at regular intervals. It has to be done at regular intervals so we want to the whole thing to be ...
0
votes
0answers
40 views

Merge with ogr2ogr creating multiple feature classes despite consistent -nln flag

I have a Python script that creates hundreds of individual shapefiles and in the end, merges them iteratively to one big geodatabase using ogr2ogr. I want one geodatabase output with a single feature ...
0
votes
0answers
45 views

ogr2ogr cannot import .osm.pbf file to PostGIS

I'm trying to import a multipolygon layer from "colorado-latest.osm.pbf" into PostGIS. GDAL 2.4.2 has been installed in a Ubuntu system. However, whenever I'm trying to import the osm.pbf file, I get ...
0
votes
1answer
87 views

Problem with clob data type when running ogr2ogr command

Using ogr2ogr, I transferred data from the oracle database to the postgres database. However, the table "table" contains attributes that have a "clob" as a data type, which were not created. Is there ...
0
votes
0answers
24 views

Rename layers created by ogr2ogr /w “-explodecollections”

I created a .gpkg using ogr2ogr. As the original file included some geometry collections, I used the "explodecollections" switch of ogr. The resulting GeoPackage now has two layers with the same name, ...
0
votes
1answer
77 views

ogr2ogr conversion between from shapefile to MBtiles not working as intended

I am trying to convert a shapefile to MBTiles format using ogr2ogr and have been running this script in the OSGEO4W command line ogr2ogr -f MBTILES -dsco MINZOOM=10 -dsco MAXZOOM target.mbtiles C:\...
3
votes
1answer
272 views

Upload multiple tables from a single Geopackage file to PostgreSQL (PostGIS)

Context I have a single GeoPackage file containing several layers (tables) with different geometry types that I want to push to a PostgreSQL (+PostGIS) database. Each table in the GPKG has a unique ...
1
vote
1answer
37 views

Gdal ogr2ogr update a PostGIS table without breaking views and relations

Context I'm trying to update a PostgreSQL+PostGIS table from an ESRI Shapefile using the ogr2ogr too from gdal. The Shapefile is being updated from external sources on a regular basis. I don't want ...
2
votes
0answers
26 views

Reading files from URL with ogr2ogr

I'm trying to move from downloading geodata manually and then working with it using ogr2ogr on the local file to just reading the data in from the url directly in order to have the actual source in ...
0
votes
1answer
35 views

Upload a Geopackage to PostGIS-DB fails

I'm trying to load a relatively big Geopackage into my database with ogr2ogr and Windows Subsystem for Linux: ogr2ogr -f PostgreSQL "PG:user=postgres password=#### dbname=db host=localhost port=5432" ...
0
votes
1answer
68 views

Oracle query using 'with' keyword fails in ogr2ogr

I am trying to return a spatial resultant by throwing a fairly long and complex query at some datasets in an Oracle database, and returning a resultant via ogr2ogr. The goal is to return a resultant ...
1
vote
1answer
27 views

ogr2ogr not converting negative values when doing json to shp

I have converted a geoJSON file to shp using ogr2ogr, and everything is as expected - except any values that are negative in the JSON end up being positive once the file is converted to shp. For ...
0
votes
1answer
103 views

Create and use index with GDAL/ogr on shapefile

I'm using OGR and VRT to create a new shapefile from two distinct sources (CSV file and shapefile). It works well, but it is very slow. I want to make it more efficient, so I tried indexing my data ...
0
votes
0answers
39 views

Problem with importing VFK into PostgreSQL with ogr2ogr

Problem is importing VFK (Czech cadastrial data format) into PostgreSQL by ogr2ogr. Versions are: PostgreSQL: 12 PostGIS: 2.5.3 GDAL: 3.0.2 Command is: ogr2ogr -overwrite -f "PostgreSQL" PG:"...
2
votes
1answer
36 views

Append data with ogr2ogr when target has two geometry columns

I am running the following command: ogr2ogr.exe -update -append --config PG_USE_COPY YES -f PostgreSQL "PG:host=xxxx port=5432 dbname=yyyy password=***** user=zzz" "C:\xxx.gpkg" -where "Owner_ID in (...
1
vote
0answers
33 views

OGR2OGR failed to connect error

Uploading GML files to PostgreSQL via OSGeo4W Shell using OGR2OGR I receive an odd sequence of failed to connect errors. Using OSGeo4W Shell I run the following: ogr2ogr -a_srs "EPSG:27700" -f "...
0
votes
1answer
155 views

Using GDAL ogr2ogr correctly to generate vector MVT tiles

I am a bit lost here. I am trying to convert JSON to MVT tiles for Mapbox (directory format) using ogr2ogr. My problem is that no matter what I do on the Mapbox/browser side, the tiles do not show up. ...
-1
votes
1answer
37 views

Suppress the list of drivers when ogr2ogr fails

I'm quite sick of seeing this spammy output when ogr2ogr fails: FAILURE: Unable to open datasource `foo.csv' with the following drivers. -> `PCIDSK' -> `netCDF' -> `JPEG2000' -> `...
0
votes
0answers
127 views

Warning 6 while loading data to MSSQLSpatial using ogr2ogr

I am loading layers from a .gdb to a database in SQL Server using the following command: ogr2ogr -f MSSQLSpatial "MSSQL:server=server_name;database=database_name;trusted_connection=yes" "...
5
votes
1answer
59 views

Resolve Intersecting areas in shapefile

I combined two shapefiles and noticed that the polygons didn't overlay perfectly. How can I resolve these intersections to snap to their closest neighbours? This is a closer look at the intersections:...
2
votes
1answer
33 views

KML driver failed to create

I want to convert spatial data from postgres to some basic formats (shp, geopackage, csv, xlsx, gml... ) using python gdal functionality. I read the answer to this question: Using ogr2ogr to convert ...
0
votes
2answers
44 views

Python ogr2ogr encoding problem

I am trying to convert gpkg to shapefile using ogr2ogr command with python. After running this line of code I got a message saying: ogr2ogr.main(["", "-f", "ESRI Shapefile", "out6.shp", "kucni_broj....
0
votes
1answer
54 views

GDAL 2.4.2 installation problem in Debian

I have built GDAL 2.4.2 in Debian package through the following commands sudo apt-get install build-essential python-all-dev wget https://download.osgeo.org/gdal/2.4.2/gdal-2.4.2.tar.gz tar xvfz gdal-...
1
vote
1answer
26 views

Converted GeoJSON have 3 elements in each coordinate entry [closed]

I'm working on something that converts DXF file to GeoJSON. I'm using ogr2ogr to do the conversion. I noticed that after the conversion there are sometimes 3 coordinates in elements of the coordinate ...
2
votes
2answers
80 views

Unable to connect WFS datasource with ogr, but works with QGIS

I am accessing some WFS layers via QGIS. I want to download those same layers via ogr. This doesn't work and I can't find why. The WFS URL is https://www.mercator.vlaanderen.be/...
1
vote
0answers
42 views

Data missing while importing .kml file to PostgreSQL using ogr2ogr

As I am newbie to both dealing with KML and PostgreSQL. I am able to load KML file to PostgreSQL. But feature data table is empty. My file structure is same as mentioned in link. while importing ....

1
2 3 4 5
18