Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [ogr2ogr]

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

0
votes
0answers
34 views

OGR2OGR -overwrite mssql table is appending instead

I am running Command '['C:\\OSGeo4W\\bin\\ogr2ogr.exe', '-progress', '-skipfailures', '-overwrite', '-lco', 'UPLOAD_GEOM_FORMAT=wkt', '-t_srs', 'EPSG:28354', '-f', 'MSSQLSpatial', 'MSSQL:Server=xxx;...
0
votes
1answer
34 views

Importing NAS Data into SQLite database? [closed]

I'm trying to import German NAS-Data into a SQLite- Spatialite-database. For this I use the following command: ogr2ogr -f SQLITE --config OGR_SQLITE_CACHE 8192 -gt 65536 -skipfailures -s_srs "+proj=...
1
vote
1answer
11 views

Python SQLite JSONSTRINGLIST

I have converted an XML (NAS) - File into a SQLite-Database using ogr2org - which worked quite well. Now I'd like to read the data using Python (3.72) - which works quite good as well. But there is a ...
0
votes
1answer
21 views

ogr2ogr Warning 502: Field name 'yyy xx' contains invalid characters. 'yyy_xx' will be used instead

On MSSQL tables/views that have field names with spaces or starting with a number we get the warning 502 re: replacing invalid characters with a _ As we re-injest some of these files into MSSQL and ...
0
votes
1answer
18 views

ogr2ogr conversion failed when converting the varchar value to data type int

I keep getting this Error 1 when I run the following on some tables ogr2ogr -skipfailures -f "MapInfo File" -lco overwrite=yes -lco launder=no -lco relaxedFieldNameMatch "D:\QG\CREFNO.tab" "MSSQL:...
3
votes
2answers
164 views

Osm to Shapefile — missing polygons

Problem: I am using ogr2ogr to convert osm file to shp and some features realated to the lakes are missing. I noticed for ex. lake is missing when it is flow-through lake (river is at both ends). My ...
1
vote
0answers
10 views

Geopackage drops fields during import [closed]

When I use the ogr2ogr -f command to create a geopackage the first layer imports correctly but every layer after that drops fields. Can anybody explain why it does this?
0
votes
0answers
21 views

Android Library to convert ESRI Shapefiles to GeoJSON

I'm building an Android App for display ESRI Shapefiles but unfortunately, there are only a few free SDKs which support Shapefiles. Most of them working with GeoJSON, so now I'm looking for an Android ...
0
votes
1answer
17 views

ogr2ogr Failing to Reproject SQL layer

I have a script which reprojects some imported SQL data so we can view it in our GIS. I haven't touched this for a long time and today it has failed. ERROR 1: latitude or longitude exceeded limits ...
0
votes
0answers
34 views

Alter and update a shapefile with a field from an ASCII file using ogr

I have a vector file "map.shp" with a field ID. I have an attribute table (data.txt) with the following fields: ID, value1, value2. The field ID is the same in both files. I want to update map.shp by ...
0
votes
1answer
34 views

Uploading TAB data to MSSQL using ogr2ogr

I have been trying various methods to import a shapefile into MSSQL but keep getting FAILURE: no source datasource provided. ATTEMPTS ogr2ogr -f "MSSQL:Server=xxx;Database=_GIS_Test;UID=yyy;PWD=...
1
vote
1answer
34 views

Converting MSSQL linked MapInfo Tab file to a shapefile using ogr2ogr

I have some tab files that are actually references to a view in a MS SQL Server table. It looks like begin_metadata "\IsReadOnly" = "FALSE" "\MapInfo" = "" "\MapInfo\TableID" = "055372be-523f-430a-...
-1
votes
0answers
15 views

GDAL ogr2ogr how to select by type not column name [duplicate]

I want to select column name by type (geometry column) not by name. How can I do that? Here is my ogr2ogr command "ogr2ogr>/var/www/html/logs/exception.log 2>&1 -f OCI OCI:".CFG_DB_USER."/"....
2
votes
1answer
68 views

Sorting (ORDER BY) rows from Shapefile using Python?

I'm writing a Python script where I have to read a Shapefile, sort its rows/records by a specific field, and then write a new shapefile with that new order. Does anyone how can I do it? I'm using ...
1
vote
0answers
17 views

ogr2ogr - organizePolygons() error

Does anyone has idea how to deal with this error: Warning 1: organizePolygons() recieved an unexpected geometry. Either a polygon with interior rings or a polygon with less than 4 points or a non-...
0
votes
0answers
33 views

No geometry when importing 3D building model GML into PostGIS

I'm attempting to import a GML file containing 3D building models into PostGIS using ogr2ogr. ogr2ogr -f PostgreSQL PG:"host=${hostname} port=${port} dbname=${db} \ user=${user} password=${...
0
votes
1answer
36 views

Changing srs-definition string in geopackage with ogr2ogr

When creating a geopackage with ogr2ogr in WGS84 (EPSG:4326), the srs-definition string cannot be interpreted correctly when loading the data into ArcGIS. ArcGIS does not project the data corretly ...
2
votes
1answer
38 views

QGIS/QDAL: Accessing OGR_STYLE across all layers in a KML file

I get a regularly updated KML file which I need to pull into QGIS. It has different folders/layers (about 12), and features in each folder/layer have different <styleURL>s. I need to access ...
3
votes
1answer
55 views

Using ogr2ogr on Anaconda

I am building a Choropleth map in D3.JS. In order to do that, I have downloaded a map from Eurostat. From the GeoJSON file, I want to extract the country for the visualization, in my case Portugal. ...
0
votes
0answers
10 views

Suitable Image or container that has ST_MakeValid functionality

I'm looking for an easy to deploy machine image that would allow me to use the ST_MakeValid function. I'm looking to use this in an ogr2ogr call, but can't get a version compiled correctly against ...
2
votes
0answers
51 views

Running gdal ogr2ogr command from python

I have an ogr2ogr command which uploads an ESRI File Geodatabase to a PostgreSQL database, updating/overwriting the existing data: ogr2ogr -f "PostgreSQL" PG:"host=hosting_url port=5432 dbname=...
0
votes
1answer
88 views

Converting self-intersecting polygons into distinct polygons

How to convert self-intersecting polygons into distinctive, well behaving polygons? My polygon inputs consist of self-intersecting polygons, which fails the st_isvalid test, ie: the below statement ...
0
votes
1answer
53 views

How can I write a zipped shapefile with ogr2ogr and /vsizip/?

After reading a bit of GDAL Virtual File Systems docs, I am trying to write a zipped Shapefile using this gdal command involving the use of /vsizip/: ogr2ogr -f "ESRI Shapefile" /vsizip/test.zip\test....
0
votes
2answers
112 views

QGIS SERVER - convert WFS GetFeature GML as Shapefile with ogr2ogr

I'd like to use ogr2ogr with the WFS driver to convert the GML response of my QGIS Server 3.4.2 GetFeature layer into Shapefile. I have to do this from a WebGIS JavaScript application I am developing, ...
1
vote
1answer
21 views

Keep only one geometry type when clipping polygons to sqlite with ogr2ogr

I have a regular grid of polygons and want to clip them using ogr2ogr. While using sqlite files as destination I stumbled over some wierd behavior: When clipping polygons exactly at their borders, a ...
1
vote
0answers
78 views

Ogr2ogr transform shapefile into GeoJSON without the geometry

I'm trying to transform a set of shapefiles (49) that contains nearly 2500 LineStrings each and also different columns of information. So my intention is to obtain only this additional information ...
0
votes
0answers
73 views

ogr2ogr MVT Append

I am creating a MVT (Mapbox Vector Tile) MBTile for various layers from my PostGIS database but I cannot seem to get ogr2ogr to append to an existing MBTile. I am currently using the following ...
0
votes
1answer
51 views

ogr2ogr polygon to point with point inside the polygon

Can ogr2ogr be used to convert a polygon to a point but the point must remain inside the polygon? It does not matter where the point is as long as it is inside the object polygon.
2
votes
1answer
56 views

dbf to shp within BASH (ogr2ogr would be ideal)

I have a CSV with many points and attributes that I'm trying to convert into a shapefile but I'm having no luck. I have installed gdal-bin and can use my terminal environment to create a shapefile ...
2
votes
1answer
191 views

Using ogr2ogr to convert multiple GML files to a postgis table

I have a folder with 150 .gml (addressbase) files I need to upload to my postGIS/postgres database. After the first gml is uploaded, the rest will be appended to it to form a single table. However I ...
1
vote
0answers
45 views

Import ArcSDE db to Postgres/PostGIS

Is it possible to import an ArcSDE db in PostGIS? I don't have experience with ArcSDE and then I don't have any idea to what is the data exportation format of this software. A customer asked me to ...
1
vote
2answers
233 views

Migrating US Census GDB file to PostGIS — ERROR: tables can have at most 1600 columns

I'm working with data from the U.S. Census. Specifically, I've downloaded gdb files from here. I have the gdb file ACS_2016_5YR_TRACT.gdb on my server and I'm attempting to create a psql table with ...
0
votes
0answers
41 views

ogr2ogr merge fgdb (while importing to PostGIS)

I have millions of records and hundreds of tables in several file geodatabases.. The tables name in these FGDBs are all same but just in different areas. For instance, the Admin table, you see below,...
0
votes
1answer
50 views

ogr2ogr import fails with “ERROR 1: GeoJSON object too complex”

I'm trying to import a large (8.8GB) GeoJSON file to a Postgres 9.6 database with the following command: ogr2ogr -f "PostgreSQL" -nln final_diffs PG:"host=localhost dbname=inspire user=me" diffs....
1
vote
1answer
128 views

Export multiple shapefiles to one DXF file using Python

I'm trying to convert shapefiles into one DXF file using pyqgis, I started with one layer, the problem is that I can't open the DXF file after conversion. I've tried two approaches but still getting ...
1
vote
0answers
29 views

Linux (unix) bash, import multiple fgdb to PostGIS using find & ogr2ogr command

I have multiple file geodatabases in different folders and this is the command I made so far: find -path "*/V*/*.gdb" -o -path "*/W*/*.gdb" -o -path "*/R*/*.gdb" -o -path "*/WM*/*.gdb" | while read ...
2
votes
1answer
108 views

Unicode encoding problem in ogo2ogr GeoJSON export from PostGIS

I have few tables those have some unicode value of different language. When I am trying to export the data from PostGIS to GeoJSON using ogr2ogr the returned GeoJSON showing wrong unicode language ...
0
votes
1answer
44 views

Batch convertion of .tab files to a single .gml using ogr2ogr

My task is to convert .tab files from a directory (C:\Users\Vadim\Downloads\vec\MapInfo\snp) to a single GML file (snp.gml). I use OSGeo4w Shell. So I wrote a following command: ogr2ogr -f "GML" C:\...
0
votes
0answers
13 views

ogr2ogr loop through feature classes in FGDB except one feature class

I have multiple fgdb and I wanted to merge this to one FGDB and this is the command I used so far find . -path "*/*1*/*.gdb" -o -path "*/*2*/*.gdb" -o -path "*/*3*/*.gdb" \ -o -path "*/*4*/*.gdb" -o -...
1
vote
0answers
24 views

ogr2ogr manipulating cpu and memories

My OGR2OGR command is working very hard and I am kind of satisfied but not as fast as I expected. What I am doing is Joining a table to a fgdb feature class and save it to another fgdb. through my mac ...
0
votes
1answer
60 views

OGR2OGR Differencing Vector Layer

This is related to the link attached below and in my case, it is not working properly. Can ogr2ogr "reverse clip" (or "clip out" or "erase" or "difference") ...
2
votes
1answer
89 views

Joining CSV file to Shp file using ogr2ogr and python

I am having problems with the code below i.e. parsing the SQL string in python. I keep getting an error. I am joining a CSV file called lookup_scales.csv to a shp file called RC_CATALOGUE_GRANTED. I ...
2
votes
1answer
145 views

How to style KML through LIBKML layer creation options?

I am exporting a layer from PostgreSQL to KML using ogr2ogr. I get a workable KML with a series of features (Placemarks). Here is a simplified example of a feature. (I took out the long list of ...
-1
votes
1answer
101 views

Convert esriGeometryPolyline to GeoJSON

I would like to extract the "Existing KinderMorgan Trans Mtn Tar Sands Pipeline" from this ArcGIS REST service and convert it to GeoJSON. Ogrinfo can't read the JSON (it's not standard ESRI JSON): ...
1
vote
0answers
95 views

Importing SHP to MSSQL using OGR2OGR?

I am trying to import a Shapefile which is in EPSG:4326 coordinates to MSSQL Database but its failing. I am following the below command: ogr2ogr -f MSSQLSpatial -overwrite "MSSQL:server=...
0
votes
1answer
76 views

ogrmerge cannot open input files specified as a pattern

I have several geojson files which I am trying to merge using the ogrmerge.py script. For some reason I am getting ERROR: Cannot open *.geojson when I run ogrmerge.py -o merged.geojson *.geojson -f ...
7
votes
1answer
181 views

Using shp2pgsql instead of ogr2ogr to import shapefile to PostGIS? [closed]

I may very well be doing something wrong here, but: If I import some shapefile to a PostGIS database using shp2pgsql, I have to first figure out the SRID/EPSG of that shapefile. I think this is, at ...
2
votes
2answers
179 views

ogr2ogr sql: what is the name of the geometry field?

I have the following ogrinfo -so output about a shapefile: Layer name: PREDEFINED Geometry: Polygon Feature Count: 58075 Extent: (425995.430000, 336399.500000) - (447356.663000, 359782.760000) Layer ...
0
votes
0answers
29 views

ogr2ogr: is it possible to transform to WKT and reproject at the same time?

I would like to use ogr2ogr to transform an input GML to WKT CSV, and from EPSG:27700 to EPSG:4326. This is my command: ogr2ogr -f CSV output.csv input.gml -sql "select id as gmlid, OGR_GEOM_WKT ...
2
votes
0answers
58 views

Serverless geospatial data type conversion (similar to ogr2ogr)

Is it possible to run ogr2ogr or Python/Fiona in a serverless environment where each feature gets processed in parallel and where you don't have to specify the properties of a virtual machine upfront? ...