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
1
vote
0answers
18 views

ogr2ogr gdb to postgis — empty geometry after import

I am using the below command: ogr2ogr -f "PostgreSQL" -s_srs EPSG:2286 -t_srs EPSG:2286 PG:"host=${PGHOST} dbname=${PGDATABASE} user=${PGUSER}" import_file.gdb -overwrite -lco SCHEMA=some_schema -...
6
votes
1answer
187 views

Creating gpkg with many layers using ogr2ogr

I am trying to merge many shapefiles into a single gpkg using ogr2ogr (version 3.0.2). The command I am using is: ogr2ogr dst.gpkg src.shp -nln layerOne ogr2ogr dst.gpkg src.shp -nln layerTwo BUT ...
1
vote
1answer
38 views

Conversion TIFF to shp, duplicates polygons [closed]

The purpose of my project is 512 KML tiles which represents an entire map. By editing the KML files I realized that there is redundancy of the polylines. So I look for why and it happens to the ...
4
votes
0answers
50 views

Preventing ogr2ogr from generating invalid geometries in transformation

I have the following GeoPackage: https://drive.google.com/open?id=1COcGcbZQIsW6NrzuD-K-Kijpvg4BYQ54 I have checked it with spatialite and it does not have invalid geometries. It has a ...
1
vote
0answers
32 views

QGis 3.4: GPKG vector layer with object form (relations with spatial and non-spatial datasets) to postgres database

I have QGis project with a geopackage included. One layer in the geopackage contains a attribute form with relations to other layers (spatial and non-spatial). I have to convert it to a postgres ...
0
votes
1answer
24 views

CSV to shapefile in batch ogr2ogr [duplicate]

I have a folder called CSV, in it there are several CSV files with coordinates and attributes. I want to convert all files in a CSV folder into shapefiles New created shapefiles should have original ...
7
votes
1answer
120 views

QGIS Point on Surface

As far as I can tell, the option to "Create point on surface for each part" in the QGIS Centroid tool is not returning the correct geometry when activated in QGIS (version 3.8.1-Zanzibar/GDAL v 2.2.3 ...
3
votes
2answers
41 views

ogr2ogr selecting features by location

I'm trying select features from one shapefile that contains features from another shapefile. However when I run the command I get an error " no such column geometry" Both shapefiles are working ...
4
votes
1answer
103 views

ogr2ogr commands with cmd

I'm trying to run a ogr2ogr command with cmd. When I run the cmd the Osgeow command prompt just flashes and nothing happens. When I enter my ogr2ogr script directly to the Command Prompt everythinh ...
0
votes
0answers
34 views

Sql query with ogr2ogr for clipping polygons

I'm trying to build a query with ogr2ogr to clip intersecting polygons. I know how to do this with QGIS database manager sql but I can't get it to work with ogr2ogr. With information I've gathered ...
3
votes
1answer
38 views

Extracting/casting mixed geometry types to single type using ogr2ogr?

I have a GeoJSON file with mixed geometry types, something like this: { "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "GeometryCollection", "...
2
votes
0answers
27 views

ogr2ogr sql query from dbf

In ogr2ogr, I can successfully read *.DBF files and write them to PostgreSQL DB: SET DBCONNECT=host=bla port=blue dbname=blub user=me password=easy active_schema=now SET PGCLIENTENCODING=UTF8 SET ...
0
votes
0answers
20 views

ogr2ogr MSSQLSpatial ERROR 1: Got Multipolygon geometry as polygonMember instead of MultiPolygon

I'm very new to using ogr2ogr so I hope I've provided enough detail to my problem. It's worked in the past. I'm trying to retrieve GIS data from a WFS feed and saving it into SQL using the following ...
0
votes
0answers
12 views

ogr2ogr and MITAB_BOUNDS_FILE configuration option

Here's my problem. I want to create a MapInfo .tab from another .tab with using MITAB_BOUNDS_FILE configuration option, with ogr2ogr. So I have cmd command like this: ogr2ogr --config ...
1
vote
1answer
28 views

Uploading MVT to MapBox result in error “Tile exceeds maximum size of 500k at z5…”

I have just recently started to use MapBox. I am trying to convert a huge GeoJSON file (1.28GB) into MVT for uploading into a MapBox. I am using ogr2ogr and this command-line: ogr2ogr -progress --...
0
votes
2answers
29 views

Can't find ogr2ogr on MacOS

After years working with Linux and Windows I had to move to MacOS. So far I succeeded in installing QGIS from the QGIS website. But I can't find ogr2ogr - I'm pretty sure it is installed on my system. ...
0
votes
1answer
34 views

Return all results from join of non-spatial CSV to spatial data using ogr2ogr and SQLite dialect

I am attempting to carry out a simple join of a non-spatial CSV to a GeoJSON data source using ogr2ogr an its built-in SQL capabilities. I would like to use the SQLite dialect to carry out the join. ...
4
votes
1answer
64 views

Join non-spatial CSV to GeoJSON data source using ogr2ogr and SQLite dialect

I am attempting to do a simple join of a non-spatial CSV file to a GeoJSON data source using the built-in SQL capabilities in ogr2ogr. I have successfully managed to do this using the OGR SQL dialect ...
2
votes
1answer
43 views

Can a PostGIS table contain features with both single-point and multi-point geometries?

I have a geopackage containing point features. Most features are single points but some are multipoints. When I attempt to import to PostGIS using ogr2ogr, I received the following error: ERROR: ...
1
vote
0answers
56 views

How to correctly append data from ArcInfo GENERATE file to PostGIS table using ogr2ogr

Using CentOS 8.0 with PostgreSQL 12, PostGIS 3, and GDAL/OGR 3.0.2. I am trying to append data in an ArcInfo GENERATE file to an exisiting table. My ArcInfo GENERATE file input.gen looks like this: ...
1
vote
1answer
59 views

ogr2ogr can't append shapefile to existing Postgres table

Using ogr2ogr within python (and Windows 10), I can upload a shapefile to Postgres as a new table. However, my shapefile is made of 10 parts (10 shapefiles). I can upload the first .shp but when ...
6
votes
2answers
297 views

ogr2ogr from file to PostgreSQL 12 table fails

Using CentOS 8.0 with PostgreSQL 12, PostGIS 3, and GDAL/OGR 3.0.1. I want to append a file to a database table. Previously (before upgrading to the new system) I used ogr2ogr -f "PostgreSQL" PG:"...
1
vote
0answers
31 views

ESRI FIleGDB API dll failure: ogr2ogr can't recognize File GDB as driver type

I have been trying this for a day or two now, and I have followed the instructions listed here: How to add support for FileGDB (Esri file gdb API) driver in fiona but for the life of me I can't ...
1
vote
0answers
19 views

excluding KMZ layer in ogr2ogr PostGIS import

I'm trying to script the import of a KMZ file into my PostGIS 2.2.1 enabled PostgreSQL 9.5.1 database and am running into a problem where it's not importing all of the (several dozen) layers. I think ...
1
vote
0answers
34 views

Invalid SRID in PostGIS when importing data by ogr2ogr

I am using PostgreSQL 12 with PostGIS 3.0.0 and GDAL 3.0.0 to copy data in it. The command I am using is: ogr2ogr -f "PostgreSQL" PG:"host=127.0.0.1 dbname=db user=user port=5432 password=1" "file....
0
votes
0answers
23 views

ogr2ogr - ST_DUMP(geometry)

I have been trying to run: ogr2ogr -f "Mapinfo File" out.tab in.shp -dialect SQLite -sql "SELECT ST_DUMP(geometry),* FROM in" but there is always an error like this: no such function: ST_DUMP ...
1
vote
0answers
23 views

Obscure import GeoJSON to PostGIS by ogr2ogr

I import UTF-8 encoded GeoJSON files and get a different column value in PostgreSQL. Execution command one template is: ogr2ogr -f "PostgreSQL" PG:"host=127.0.0.1 dbname=db user=user port=5432 ...
0
votes
0answers
26 views

Simplifying complex/overlapping polygon using GDAL/OGR

Is there a GDAL/ogr implementation of this paper? http://www.cis.southalabama.edu/~hain/general/Theses/Subramaniam_thesis.pdf It outlines a really nice way to clean up potentially overlapping ...
2
votes
2answers
41 views

Running ogr2ogr in Python on Windows

I run ogr2ogr to transfer geometrical data from a pgsql (PostGIS) database to a MS SQL one. It works quite well. I'm trying to achieve exactly the same result in Python, as I'm planning to use ...
2
votes
0answers
21 views

OGR2OGR - cannot save to ShapeFile

I am trying to fix a bug in some software that exports to Shapefile and/or MapInfo files. I am struggling to wrap my head around this OGR2OGR stuff. The software will not export to shapefile and I ...
1
vote
0answers
41 views

Using ogr2ogr to clip shapefile based on coordinate query

I have some shapefiles that I would like to convert to GeoJSON and clip to display only Arctic regions (for example, everything above 45°N). I tried the following, but nothing is clipped. Any ...
2
votes
1answer
49 views

ogr2ogr: 'ERROR 1: Wrong field type for ID' with primary key

I have a shapefile with the following structure: I'm trying using ogr2ogr to import the above shapefile inside my PostGIS database with the following code: ogr2ogr -append -f "PostgreSQL" PG:"host=...
3
votes
1answer
56 views

Gdaltools with SQL query?

I have been successfully using the Gdaltools module in Python to export from PostGIS to shapefile using: import gdaltools ogr = gdaltools.ogr2ogr() conn = gdaltools.PgConnectionString(host=HOST, ...
1
vote
0answers
19 views

ogr2ogr: cannot append data to Carto table. Error returned by server : missing data for column “cartodb_id”

I am trying to import data into CARTO using ogr2ogr. I can create new tables, but once I try to append new data to this table, I get an error ogr2ogr \ --config CARTO_API_KEY xxx \ -t_srs "EPSG:...
5
votes
1answer
251 views

Reading GeoPackage with large feature classes is very slow

I'm running a project which provides OpenStreetMap data on a global scale as GeoPackages. The data is created/transferred from a PostGIS database to GeoPackage by ogr2ogr. Issue: Initially reading of ...
1
vote
1answer
99 views

Using command line gdal to open and convert OSM file to feature class

I have an file that is in the format .osm.pbf. It's about 8GB. I want to convert it to a feature class and place it in a file geodatabase. From what I can see, the simplest way to do that is using ...
0
votes
0answers
32 views

ogr2ogr SQL Expression Error, From starting with number

I'm merging shp files with ogr2ogr in a python loop and adding the specific filename as coloumn. A command looks like: ogr2ogr -f "esri shapefile" -update -append final/merged.shp 3044/...
0
votes
0answers
21 views

Extracting data from OSM with ogr2ogr — blank output

I have an issue while extracting data from osm via ogr2ogr. What I tried: When I run from command line: ogr2ogr -f "ESRI Shapefile" example.shp source.pbf -lco ENCODING=UTF-8 -progress -sql "SELECT ...
1
vote
1answer
44 views

Export to DXF from Multipoint Z geometry in PostgreSQL using ogr2ogr

I want to export a PostgreSQL table of geometries in Multipoint Z to DXF using ogr2ogr I tried this command ogr2ogr -f "DXF" output.dxf PG:"host='127.0.0.1' port='5432' \ dbname='dbname' user='user'...
0
votes
1answer
79 views

GDAL/OGR losing OSM closed way features that OGR2OGR imports

I have managed to import an OSM PBF file into QGIS using ogr2ogr -> SQLite and then importing layers using the GUI- (essentially as per the first step in this answer : ogr2ogr -f "SQLite" -dsco ...
0
votes
0answers
25 views

GDAL C# Bindings ogr2ogr's clipsrc

I am trying to call ogr2ogr's clipsrc command from C#, but I can't find any reference other than implementing what the command does from scratch. I can imagine Using gdalwarp with c# bindings? is ...
1
vote
0answers
36 views

Converting PBF to Shapefile with name:xx tags as a column in the attributes

I have a PBF file containing only rivers information (extracted using osmosis when waterway=river). A conversion of this PBF to SHP works fine with ogr2ogr when I am selecting fields like "osm_id" ...
0
votes
0answers
66 views

Convert Polygon to MultiPolygon using features attributes

I'm trying to convert SHP files to GeoJson using ogr2ogr and that works well with Polygon. Now I'm struggling to convert multiple Polygon geometry features to a single one (MultiPolygon) for each ...
1
vote
0answers
32 views

ogr2ogr append to PostGIS table with PRIMARY KEY -fieldmap: Invalid destination field index 0

I have the following PostgreSQL/PostGIS table CREATE TABLE schema.table ( id bigint NOT NULL CONSTRAINT id_pkey PRIMARY KEY, geog geography NOT NULL ); and an ARCGEN file file.gen ...
0
votes
0answers
54 views

ogr2ogr sqlite dialect can't find functions

my question might be related to this Dissolve using ogr2ogr gives 'no such function: ST_union' What I am trying is st_unioning my landparcel polygons based on its group. The code is very ...
1
vote
0answers
12 views

How to get feature class name using ogrinfo

I am importing kmz into postgres $ogrCommand = 'ogr2ogr -f "PostgreSQL" -a_srs "EPSG:4326" PG:"host='.env("DB_HOST").' port='.env("DB_PORT").' user='.env("DB_USERNAME").' dbname='.env("DB_DATABASE")...
0
votes
1answer
53 views

OGR2OGR - converting a GML file to GeoJSON

I'm struggling to use ogr2ogr to convert a GML file into a GeoJSON file. My input is zipped GML files with several layers. I'm only interested in the layer with name 'TopographicArea'. I've tried ...
2
votes
1answer
49 views

Set schema in ogr2ogr from GML to pgdump

My ogr2ogr tranformation from a GML to a pgdump sql file always by default uses the schema public. I would like to use a different schema. It seems to be possible: How to assign a schema to ogr2ogr?. ...
1
vote
1answer
51 views

Cast 3D geometry as 2D for ogr2ogr GeoJSON

I'm trying to take a shapefile that can be downloaded here (specifically the shapefile titled PVS_19_v1_vtd_21031.shp), convert it from EPSG:4269 to EPSG:3857, and output the GeoJSON into CSV with ...
1
vote
1answer
53 views

Convert all KMLs within a directory to SHP, zip by name, and move to another output folder? [closed]

I have the requirement to convert a list of ~100 KML files into shapefiles and later merge and upload the polygons as one layer into ArcGIS. I'm new to GIS and Python. I've been able to convert ...