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
1answer
12 views

ogr2ogr MSSQLSpatial truncating attribute fields

I have a Shapefile with a number of attribute fields defined in its corresponding .dbf file. I am trying to transfer this data to an Azure SQL Server DB using the following command: ogr2ogr -f ...
0
votes
0answers
33 views

Transfer indexed Oracle geoloc table to PostgreSQL using ogr2ogr

I am copying tables using ogr2ogr from Oracle to PostGIS using ogr2ogr -f "PostgreSQL" PG:"host=<host> port=5432 user=<user> dbname=<dbname> password=<pwd>" OCI:<USERNAME&...
1
vote
0answers
14 views

Oracle to PostgreSQL migration with ogr2ogr only imports first geoloc column

I transfer Oracle tables to PostGIS using Oracle Wallet and ogr2ogr -f "PostgreSQL" PG:"host=<host> port=5432 user=<user> dbname=<dbname> password=<pwd>" OCI:<USERNAME>...
1
vote
0answers
17 views

Correct syntax for specifying multiple Layer Creation Options in ogr2ogr

I am trying to run a GDAL 300 command line command to convert a file to GeoJSONSeq, projecting output using ESRI:102008 (Albers North America), using a SQL query to choose and rename some columns, and ...
1
vote
1answer
26 views

ogr2ogr write multiple layers to one geopackage

I'm using ogr2ogr to write a SQL query from PostGIS to a GeoPackage in a linux shell. Query by Query to many GPKG: ogr2ogr -f "GPKG" point.gpkg PG:"host=localhost dbname=data user=user password=******...
2
votes
0answers
47 views

Converting GeoJSON file to vector tiles

I need to display huge GeoJSON file using OpenLayers. So I decided to use VectorTiles. Library geojson-vt.js works perfectly for me, but unfortunately it requires my GeoJSON file to be preloaded on ...
2
votes
1answer
23 views

ogr2ogr cannot append of truncate PostGIS table

I am reading in GML data to a specified PostGIS schema. This is part of an automated job so and the db table might include views so I don't want to drop the table each time the script is run. EDIT: ...
1
vote
1answer
34 views

Can ogr2ogr read from PostgreSQL materialized view?

I'm writing a quick Python script to bulk export from PosgtreSQL materialized view (PostGIS geometry) to ESRI FileGDB and ogr2ogr (I'm using the one in OSGeo4W through Python subprocess module) is ...
0
votes
0answers
20 views

Error with Datetime fields when loading Tab file to SQL Server using OGR2OGR

I have a MapInfo Tab file that needs to be loaded to a MSSQL Server DDBB in a scheduled basis and I want to use OGR for this task. The tab is going to be appended in an existing DDBB table that has ...
1
vote
2answers
39 views

Convert a tab (Mapinfo) file to ESRI Shapefile with ogr2ogr

I want to convert a tab file created with MapInfo to an ESRI Shapefile (.shp) using ogr2ogr in command line. I did the following ogr2ogr -f 'ESRI Shapefile' "file.shp" "file.tab" but it gives an ...
2
votes
1answer
21 views

Create points (shapefile) with ogr2og from an attribute table

I have a csv file containing lon,lat coordinates. I want to create a vector layer (points with the lon/lat coordinates) using ogr2ogr. I did the following: ogr2ogr -f "ESRI Shapefile" "vector.shp" "...
0
votes
0answers
21 views

Join attributes by location using gdal in command line

I have a Shapefile with lon-lat coordinates (points) and I want to join it with a vector grid. When using QGIS I do this with "Join attributes by location" , using as input layer the vector grid and ...
2
votes
2answers
60 views

GeoDatabase (GDB) import not working (QGIS3)

I have a *.gdb which I normaly could load in QGIS version (3.4 / 3.8) following that instructions (or symply drag'n'dop): Installing File Geodatabase (*.gdb) support in QGIS? But it returns a error: ...
1
vote
1answer
51 views

Exporting GeoJSON from PostGIS?

I am, trying to export GeoJSON from postgis. I am using the following code which is working local machine but when I am trying to use this in a server the following error is occuring CODE: ogr2ogr ...
0
votes
1answer
32 views

Converting DXF to KML with ogr2ogr

I want to convert DXF from AutoCAD to KML. It works but the coordinates don't come out right when I compare them to a KML produced with global_mapper and consequently it is shifted some when uploading ...
0
votes
0answers
18 views

How to make sure GDAL Java binding doesn't crash my whole application?

I'm using GDAL Java binding to convert some files (ogr2ogr), such as shapefile to GeoJSON. The problem is when something goes wrong it crashes the whole application and I have to start it up again. ...
0
votes
0answers
27 views

How can I convert a MULTILINESTRING geodatabase file into a coordinate system with lat / long for individual points in a CSV file?

I have tried ogr2ogr, and QGIS but nothing seems to work for converting a MULTILINESTRING into individual lat/long coordinates. I am doing this in order to get it into a flat file so I can rearrange ...
1
vote
2answers
63 views

Transform datum CSV->CSV using ogr2ogr

First I have a set of points in UTM 48S / WGS84 (EPSG 32748) as test.csv: X,Y,Z 9231824.04,787648.04,711.1442 Second I defined a test.vrt for ogr2ogr to read the data as follows <...
0
votes
1answer
22 views

Using OGR_GEOM_AREA to add area attribute to shapefile?

I've been trying to batch convert raster files to polygons then delete areas <100m2 before clipping the raster to the filtered polygons. I have referred to both the below posts: Is there any way ...
3
votes
3answers
138 views

Trying to import Dutch Infrastructure GML using OGR GMLAS driver, but no geometries?

I have some Dutch Infrastructure GML files that I'm trying to display in GeoServer. Step 1 is to import the GML into PostGIS and while I can make it work using the OGR GML driver, I end up with a ...
0
votes
1answer
29 views

Using ogr2ogr for converting tables from non-public schema to GeoJSON

I've used ogr2ogr to convert tables in PostgreSQL database to GeoJSON which works fine for the public schema. The question is how can I set the schema to non-public to access my tables? I've already ...
1
vote
1answer
45 views

Join a CSV file to GeoJSON using ogr2ogr in a Python script?

I have a CSV which I would like to join to a GeoJSON. I found this answer which I tried to implement but I can't get it to work just yet. Here's an extract of my python: join_command = ['ogr2ogr', '...
1
vote
1answer
43 views

Python: Convert shapefile to GeoJSON whilst stripping and renaming fields

I'm writing a Python script to convert shapefiles into GeoJSONs but I would like to remove many of the fields as they are redundant and rename the ones I am retaining. Here's an extract of where I ...
2
votes
1answer
50 views

ogr2ogr difference between -append and -update

I wonder what's the difference between the ogr2ogr parameters -append and -update. It seems that they both are used to prevent ogr2ogr from creating a new layer: -append: Append to existing layer ...
2
votes
0answers
33 views

Running ogr2ogr script batchfile from SQL fails due to temporary drive mapping

I am trying to run the SQL procedure EXEC xp_CMDShell 'blahblah.bat' which needs to run an ogr2ogr script to create a kml from sql. The batch file works if I run it alone but with SQL permissions it ...
1
vote
0answers
13 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
47 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
38 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
35 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
18 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
78 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
30 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
53 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
22 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
33 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
55 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
21 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
89 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
45 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
35 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
45 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
12 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
40 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
99 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
49 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
81 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
50 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
15 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
22 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
116 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:...