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.

1
vote
0answers
10 views

Error while converting WGS84 => Albers-Siberia by ogr2ogr [duplicate]

While converting from one geosystem to another polygons crossed by 180 meridian left got split into eastern and western parts. Tool used - ogr2ogr library. Initial geosystem - WGS84, target - Albers-...
1
vote
1answer
33 views

Some OSM tags in polygons and some in points - how to bring them together

Tagging objects in OSM can sometimes be done as polygon or as point. For example ruins or museum So far so good, but finding a specific object in a osm-dataset makes it necessary to look into the ...
0
votes
0answers
19 views

Missing WFS driver in gdal installation

How do I enable WFS driver in gdal? I've installed gdal from the official osgeo source in Fedora 27 using make. But running ogrinfo --formats, the WFS support is missing. It seems that the format is ...
1
vote
1answer
30 views

Parsing and filtering JSON to CSV using ogr2ogr flags

I want to export filtered data from JSON to a CSV by selecting a couple of fields and applying a where clause. I get empty output when using either the -sql or -where parameters with the -select (...
0
votes
0answers
17 views

Remove duplicate polygons in a single layer using ogr2ogr? [duplicate]

I have a spatialite database file containing buildings within a country as multipolygons. While trying to use QGIS to delete these duplicate features, QGIS keeps on crashing due to the millions of ...
0
votes
0answers
31 views

Convert shapefile to DXF using ogr2ogr?

I want to convert shapefile with/without EPSG Code to DXF format. I've tried following commands ogr2ogr -f DXF output.dxf -t_srs EPSG:2004 stations.shp ogr2ogr -f DXF output.dxf stations.shp But ...
0
votes
1answer
26 views

PostGIS: unable to import GeoJSON data (selected attributes) to PostgreSQL database using ogr2ogr

I downloaded sample OSM data of my area of interest via Overpass-turbo as my_map.geojson. I am trying to import this geojson file to my PostgreSQL 10 (Windows 8 x64 machine) database using ogr2ogr (...
0
votes
1answer
43 views

Joining a csv file to shp (ogr2ogr)

I've been trying to use a ogr2ogr -sql call to create a ESRI.shp file with the joined attributes - but it keeps on failing due to "ERROR 1 SELECT from table inshape failed, no such table/feature" ...
0
votes
1answer
17 views

OGRInfo On Shapefile = zero length delimited identifier error

I have an ESRI Shapefile that I can open in ArcMap and QGIS and show the attributes fine. However when I try to load to PostGIS using ogr2ogr I get an error saying ERROR 1: ERROR: zero-length ...
0
votes
0answers
22 views

ogr2ogr: How to export / explode GeoJSON features from collections into separate files

I would like to use an ogr2ogr command to export features as multiple separate geojson files from a single GeoJSON feature collection. I have tried using the -explodecollections command but I am ...
1
vote
2answers
47 views

Problem with PostGIS ogc_fdw: unknown SRS

I am trying to connect a WFS from within PostGIS using the ogr_fdw foreign data wrapper [https://github.com/pramsey/pgsql-ogr-fdw]. With most servers this works great! With one specific server I get ...
1
vote
1answer
18 views

Projecting Bavarian NAS data using ogr2ogr?

up to December last year I used the following command to convert Bavarian NAS data to shapefiles: "C:\Program Files\QGIS 2.18\bin\ogr2ogr.exe" "ESRI Shapefile" -skipfailures -s_srs "+proj=tmerc +...
1
vote
1answer
48 views

MySQL 8.0 Error Code: 3617. Latitude is out of range in function st_geomfromtext

First I have a problem creating spatial index in MySQL 8.0. Here the description: I have a collection of several thousand species range maps (polygon & multi-polygon) which is provided by IUCN as ...
0
votes
0answers
32 views

Chinese encoding problem in ogr2ogr from DXF file to GeoJSON?

I have a dxf format file named test.dxf which has some Chinese characters inside. I tried to transform it to GeoJSON file using ogr2ogr -f GeoJSON test.geojson test.dxf and returned GeoJSON showing ...
1
vote
1answer
30 views

Cannot solely remove M value of Shapefiles

I have a couple of Shapefiles which are of geometry type ZM (like PolygonZM, MultiLineStringZM, etc.), however my database (a PostGIS database) is of geometry type Z (like PolygonZ, MultiPointZ, etc.)....
0
votes
1answer
22 views

How to convert an ASCII file (with lat,lon coordinates) to a shapefile using OGR?

I have an ASCII file with the following columns : ID, longitude, latitude, value Is it possible to use OGR (ogr2ogr or ogrinfo) in command line in order to open the ASCII file and convert it to a ...
0
votes
0answers
9 views

Style data getting lost while importing KML using ogr2ogr

I am trying to import the KML data generated from Google Earth into PostGIS using gdal(ogr2ogr). <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="...
1
vote
0answers
21 views

GDAL/ogr2ogr .vrt driver - ERROR 1: Unable to find source field

We are using ogr2ogr to convert GML to Geopackage v1.2, using a .vrt to enforce a "schema" (reason: the greater control it offers over using a .gfs mapping file (e.g. enforcing nullable fields, ...
1
vote
1answer
58 views

ogr2ogr fails with 'no such table'

I have downloaded a shape file of Chicago building footprints from here. Unzipped it and ran ogr2ogr -f csv -dialect sqlite -sql "select AsGeoJSON(geometry) AS geom, * from 'geo_export_98941210-c995-...
1
vote
1answer
42 views

ogr2ogr with GDAL 2.4 not reprojecting correctly

I have downloaded the latest OSGeo4w (GDAL 2.4) and GDAL 2.4 (from GIS Internals site) but I cant get the below command to correctly reproject the shapes in either application. I used the command ...
0
votes
1answer
58 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
46 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
12 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
41 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
189 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
13 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
35 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
0answers
48 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
37 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
46 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-...
2
votes
1answer
76 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
20 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
36 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
57 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
64 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
66 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
18 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
89 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
156 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
82 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
162 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
39 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
114 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
121 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
92 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
67 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
243 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
49 views

Import ArcSDE db to Postgres/PostGIS [duplicate]

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
250 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 ...