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
2
votes
1answer
32 views

ogr2ogr Warning 1: layer names ignored in combination with -sql

When I run ogr2ogr command to export some specific polygons from .osm.pbf file, downloaded from OSM, I get an error Warning 1: layer names ignored in combination with -sql. I use -sql tag to get get ...
1
vote
1answer
42 views

How to get all “harbours” (nodes and polygon) out of osm.pbf

I downloaded the germany.osm.pbf from geofabrik and would like to extract all the harbours. I did that already for points by using ogr2ogr: ogr2ogr -f "GPKG" -where "harbour IN ('yes','...
1
vote
0answers
31 views

QGIS 3.18 Reprojections result in wrong projection - EPSG 32754 instead of 7854

When I run a QGIS processing tool that includes a new projection, the result is not correctly projected. Instead of EPSG::7854 (GDA2020 / MGA 54), the data ends up with EPSG::32754 (WGS 84 / UTM 54 ...
0
votes
0answers
24 views

How to decode Mapbox Vector Tiles?

I'm using the Mapbox Vector Tile API and I want to get the data into one or multiple GeoPandas GeoDataFrame. (Python) After I download the .mvt file, how do I decode it? What I've tried already: ...
3
votes
1answer
47 views

ogr2ogr cannot import into table with two geography columns

I am using ogr2ogr to import geojson files into a PostGIS table. The table has two geography columns ("footprint" and "centroid"). The geojson files contain polygon features, and I ...
0
votes
0answers
12 views

If ogr2ogr only accepts one input why is the order opposite of normal? [closed]

Why is it dest_datasource_name src_datasource_name and not src_datasource_name dest_datasource_name like gdal ? What are the benefits of this other than multiple invocations of -append style commands?
1
vote
0answers
10 views

OGRToOGR when used with SQL server 2017 driver reversing the lat and longs

Have a table with shape column generated from SQL Server geo functions. When I export that as GeoJSON via Ogr2Ogr(with SQL driver 2017, on Ubuntu) its reversing the lat, longs and the resultant map ...
3
votes
1answer
89 views

Reprojecting all layers in GeoPackage

In QGIS we can package all the layers using the "Package layers" tool but is there a way to also reproject all the component layers within the tool or using ogr2ogr? We have: processing.run(&...
0
votes
0answers
24 views

How to export every record of a SQL query to its own KML file using ogr2ogr?

I'm querying an MSSQL database and then using ogr2ogr to reproject and save the output as a single KML. Areas.sql has output like: DRAINAGE FLOODTYPE GEOM Creek #1 Nuisance 0x3C0B000... Creek #1 ...
1
vote
2answers
84 views

Change in coordinate precision with ogr2ogr moving from GDAL 2 to 3

I'm migrating some old code from GDAL 2 to GDAL 3. I use ogr2ogr to import a shapefile into PostGIS like this: ogr2ogr -f PostgreSQL -nln mwe PG:"host=localhost user=myuser" mwe.shp -...
1
vote
1answer
33 views

Issue to convert from PostgreSQL input to GPKG using Python GDAL API function gdal.VectorTranslate

When I run the following code, it fails with message The error is ERROR 1: SELECT from table mytable failed, no such table/featureclass. from osgeo import gdal gdal.UseExceptions() gdal....
2
votes
1answer
27 views

Errors when copy from shapefile to PostgreSQL using ogr2ogr

I am trying to upload data of MULTIPOINTS for listed buildings in Wales in shapefile format to a PostgreSQL database I have run the command below: ogr2ogr -progress -update -append -f PostgreSQL "...
2
votes
1answer
23 views

Is it possible to export POINT and LINE in the same DXF from POSTGRESQL using OGR2OGR?

I have two tables in a pg database. One with annotations/points and one with linestrings. I would like to export both of them to the same dxf file with ogr2ogr. Is it possible at all somehow? I have ...
0
votes
0answers
22 views

Geopackage on S3 to PostGIS RDS using a python Lambda

I am attempting to write/invoke a Lambda written in python (with a geospatial layer that includes gdal and the usual python geospatial gang: https://github.com/developmentseed/geolambda). This lambda ...
2
votes
1answer
41 views

Is it possible to print the output from ogr2ogr directly to stdout?

I know I can convert a Shapefile to GeoJSON as the following: ogr2ogr -f GeoJSON outputFile.json inputFile.shp Instead of writing the result of this conversion to the file outputFile.json, I'd like ...
2
votes
2answers
45 views

Is there any easy way of transforming the result of a SpatiaLite query on GeoJSON?

I've converted a huge Shapefile into a SpatiaLite file because I need to make a query that uses a spatial index. My problem started on this question where I wanted to filter a specific area of a ...
2
votes
1answer
18 views

How to extract Metadata from File Geodatabase using Ogr2ogr?

The Ogr2Ogr doc says: GetLayerDefinition a_layer_name” and “GetLayerMetadata a_layer_name” can be used as special SQL requests to get respectively the definition and metadata of a FileGDB table as ...
4
votes
1answer
97 views

PyQGIS: Load, process & overwrite layers from GPKG

I have 3 layers in one geopackage, all with the same name but different geometry: Point, Line, Polygon (originally coming from a MapInfo .TAB, which supports multi-geometry in one file). I already ...
2
votes
1answer
17 views

How to group insert statments into transactions when using ogr PGDump driver?

I tried the -gt option to group insert statements into transactions, but apparently it doesn't make a difference: ogr2ogr -f PGDump test1.sql test_6350.gpkg -lco SRID=6350 -lco DIM=2 -nlt ...
1
vote
1answer
57 views

Cannot get geometry column name from geopandas

I tried calling gdf.geometry.name and I always get back "geometry" as the geometry column name. Using GDAL's ogrinfo, I get the actual name which is "geom". Is there another way of ...
0
votes
0answers
28 views

OGR2OGR unable to initialize connection to the server for [ConnectionString]

Im trying to import a shape file to SQL Server 2017 using ogr2ogr ogr2ogr -overwrite -f "MSSQLSpatial" "MSSQL:server=.\[SQL instance];driver=SQL Server Native Client RDA 11.0;database=...
-1
votes
1answer
43 views

ogr2ogr cannot import data

I can successfully get a connection to my remote sql server database using: ogrinfo "MSSQL:server=my_server_name;database=my_database;Trusted_Connection=True;" But when I try to import an ...
1
vote
1answer
33 views

ogr2ogr shapefile to PostgreSQL

Trying to use ogr2ogr to import a shapefile in PostgreSQL. Here is my command: cd C:\Program Files (x86)\FWTools2.4.7\bin &&SET PGCLIENTENCODING= Windows-1256 &&ogr2ogr -f "...
0
votes
0answers
32 views

Does ogr2ogr from the Docker osgeo/gdal support PDF layers?

I'm trying to use the Docker osgeo/gdal image to extract vector data from a GeoPDF, i.e. https://www.floridastateparks.org/sites/default/files/media/file/SFHPSP_TrailMapBike_11-27-19.pdf. It's ...
1
vote
1answer
25 views

How to convert MDB to DXF with labels using ogr2ogr?

I have to convert some 700 MDB files (parcel layer). I want to generate DXF from from them. I tried ogr2ogr -f "DXF" d:\01Chitapol_1Ka.dxf d:\01Chitapol_1Ka.mdb This gives me the lines. I ...
0
votes
0answers
30 views

How to improve precision of geographic coordinates using ogr2ogr to translate from shapefile to KML?

I made a shapefile in QGIS (ver 3.16) project with EPSG:4326. The shapefile is for a simple polygon and I want to display the polygon on Google Earth so I need to convert it to KML format. The default ...
1
vote
1answer
41 views

Get OSM building heights using height or building:levels tags

I want to parse OSM data and to get all buildings with height or building:levels data. I changed osmconf.ini file to read height and building:levels tags as separate columns for multipolygon layer but ...
0
votes
1answer
27 views

ogr2ogr spatial query doesn't work in process

I tried exporting data selecting it from postgres with spatial query. The argument does work within osGeo4W Shell but I'm trying to use it from my C# console app. Everything seems too work until I add ...
2
votes
1answer
35 views

Convert coordinate reference system of GeoJSON using ogr2ogr with same file name?

I am currently looking to use ogr2ogr to convert the coordinate reference system of a GeoJSON file. I want the output file to have the same name as the input file. This is on a Linux PC running Ubuntu ...
0
votes
0answers
27 views

Configure GDAL MSSQLSpatial Driver to export shapefile

I need to configure the GDAL MSSQLSpatial Driver to correctly export spatial data from MS SQL Server Spatial database. I am trying to export a shapefile by running this command: ogr2ogr -f "ESRI ...
0
votes
0answers
18 views

ogr2ogr in Python results in non geometry

When I want to call ogr2ogr from Python, the given polygons are set to none. I tried to call ogr2ogr by: from subprocess import check_call, STDOUT command = f"ogr2ogr -f GPKG -s_srs EPSG:25833 -...
3
votes
1answer
78 views

Inserting value to column which is not existing in input using ogr2ogr

I am inserting geopackage to a table in the PostgreSQL if a certain value is not null with the following comment ogr2ogr -append -nln pgtablename -f PostgreSQL "PG:host=xx user=xx dbname=xx ...
0
votes
0answers
43 views

How much process memory is needed for ogr2ogr to process a GeoJSON file? -

I am trying to evaluate how many resources ogr2ogr needs to process a GeoJSON file; there's a concern that it's using much more memory than we would expect. All we are doing is converting a GeoJSON ...
0
votes
0answers
34 views

ogr2ogr: projection issue when converting a GeoJson to a Shapefile

I want to convert a GeoJSON into a shapefile with the ogr2ogr command using the Spyder Python interpreter. args = ['ogr2ogr', '-f', 'ESRI Shapefile', SHP_FILENAME, GEOJSON_FILENAME] The output ...
0
votes
0answers
93 views

ogr2ogr TopologyException invalid input geometry; ring self-intersection

I'm facing a problem when using osgeo/gdal:ubuntu-small-3.2.1 docker image and running these commands on the Natural Earth vector dataset: # Get and unzip the data # (inspired from https://github.com/...
0
votes
1answer
73 views

OGR2OGR call using Python and subprocess call fails on Windows 10

I have a Python script that batch converts GPX files stored on an older Garmin unit to ESRI shapefiles. This script use an ogr2ogr command line argument passed from Python using subprocess.call() to ...
1
vote
1answer
73 views

Upload specific or all tables from Geopackage to PostGIS database

I would like to upload a specific table (i.e. U2018_CLC2012_V2020_20u1 (Multi Polygon)) from a Geopackage file to a PostGIS database from the command line. I tried: ogr2ogr -f "PostgreSQL" &...
1
vote
0answers
33 views

Geometry converts from Polygon to Multipolygon in PostGIS

I'm having difficulties with the Geometry types in PostGIS and/or ArcPy and hope some of you can shed a light on what I'm missing or how I can fix it. I have a .gdb containing Polygons. The Table in ...
2
votes
1answer
86 views

Inconsistencies in features count retrieved while consuming a WFS webservice

GDAL approach I'm retrieving data using GDAL with the following ogr2ogr -f GeoJSON basol.geojson \ --config OGR_WFS_PAGING_ALLOWED ON \ --config OGR_WFS_PAGE_SIZE 800 \ --...
0
votes
1answer
26 views

Ogr2ogr importing table with all in text type - how to change geometry accordingly?

I've imported a large table that has a geometry column, problem is that it is in text format, how to change this to be a point geometry in 27700 CRS? I've tried SELECT UpdateGeometrySRID('table','geom'...
1
vote
0answers
23 views

How do I append a shapefile to PostGIS table with multiple geometry fields using ogr2ogr?

I am having an issue when trying to append shapefile data to an existing table in my PostGIS database using ogr2ogr. The existing table has multiple geometry fields. When I append the shapefile the ...
0
votes
0answers
47 views

Using ogr2ogr to convert a DXF to GeoJSON and place in PostgreSQL table

Is it possible to use either the ogr2ogr command line to both convert a DXF file to GeoJSON type and put into a PostgreSQL table at one time? e.g. ogr2ogr -f "GeoJSON" path/to/output.json ...
1
vote
1answer
68 views

Exporting many tables from PostgreSQL to GDB using ogr2ogr

So basically I imported .gdb package into PostgreSQL with the following command: ogr2ogr -f "PostgreSQL" PG:"dbname='my_database'" "ntest.gdb" "layername" -...
3
votes
3answers
198 views

How to import GDB to PostgreSQL into separate tables?

I am trying to upload a .gdb data into my postgres database using og2ogr. If I upload whole database by command ogr2ogr -f "PostgreSQL" PG:"" "test.gdb" -nln gdb_test -...
2
votes
1answer
62 views

Converting a single shapefile with multiple features into independent GeoJSON files using ogr2ogr

Let's say there's a single shapefile that contains multiple features. Most of which are polygons. How can one convert those features into separate independent GeoJSON files? Can this be done with ...
0
votes
1answer
48 views

Get input layer extent as new GeoJSON polygon on the command line

Starting from a GeoJSON file containing a country boundary polygon, I would like to obtain a rectangular approximation: another GeoJSON consisting of the bounding box/envelope of the original polygon. ...
0
votes
1answer
102 views

ogr2ogr SHP to MSSQL import leaves geometry column empty

I am trying to import a Shapefile with polygon features into MSSQL database with this command: ogr2ogr -f "MSSQLSpatial" "MSSQL:server=***;uid=***;pwd=***;database=***" "D:\...
2
votes
0answers
19 views

How to use WHERE IN clause with ogr2ogr [duplicate]

I am exporting some tables from PostGIS to a geopackage. My command to do is task is as follows ogr2ogr -append -f GPKG E:\workspace\test.gpkg PG:service=XXXX -where app_einzugsgebiet.hauptgemeinde=...
0
votes
0answers
16 views

How to create a PGDUMP from LVBAG format using ogr2ogr?

I am trying to figure out how to use this GDAL driver to create a SQL dump, using the ogr2ogr commandline. I have tried the following: ogr2ogr -oo AUTOCORRECT_INVALID_DATA=YES --config PG_USE_COPY=YES ...
0
votes
0answers
34 views

Convert a SQL Server table to a shapefile with projection info

I've been using ogr2ogr to write out shapefiles from my SQL Server spatial map layers. When I run the command it delivers the .shp, .shx, and the .dbf but no prj file. Is there a way to get ogr2ogr ...

1
2 3 4 5
19