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 clip one GeoJSON with another

I'm trying to clip the NYC streets layer using a NYC borough polygon layer. This works: ogr2ogr -clpsrc manhattan-borough.geojson manhattan-streets.geojson nycStreetCenterline-simplified.geojson -...
1
vote
2answers
36 views

Using ogr2ogr in Python to import data to PostgreSQL DB

Currently I use the following command to batch import multiple GML files to PostGIS database: set dirgml= C:\data\ set app=ogr2ogr set opt=-update -append -progress set dst=-f "PostgreSQL"...
0
votes
2answers
34 views

PostgreSQL to FileGDB doesn't keep joins

I'm trying to convert my geospatial PostgreSQL tables to a FileGDB (geodatabase) by using this command: ogr2ogr --config FGDB_BULK_LOAD YES -f "FileGDB" C:\data.gdb -append -overwrite -...
-1
votes
0answers
26 views

Bulk import GML files to PostGIS database using ogr2ogr pg_dump [closed]

Currently I use the following command to batch import multiple GML files to PostGIS database: set dirgml= C:\data\ set app=ogr2ogr set opt=-update -append -progress set dst=-f "PostgreSQL"...
1
vote
1answer
38 views

PyQGIS: Prompt ogr2ogr error in the log window of the processing tool

I have a processing tool that helps users to export data from PostGIS tables to GPKG. I am using ogr2ogr commands to achieve the tasks. I am calling the commands via subprocess. However, I cannot ...
1
vote
1answer
34 views

"Resize" arbitrary coordinates (inches) to EPSG46

I'm using ogr2ogr to transform an AutoCAD (DXF) file to GeoJSON. The GeoJSON file is generated, but with very large coordinates, for example "coordinates": [ [ [ 6319.645968701713173, 9523....
1
vote
0answers
38 views

"Failed to process SRS definition" error when reprojecting vector layer via ogr2ogr

I'm using GDAL 3.3.1 with all the necessary variables already setup. I'm reprojecting a vector layer using ogr2ogr ogr2ogr -t_srs EPSG:32651 test.shp new_layer.shp and an error says ERROR 1: PROJ: ...
0
votes
0answers
13 views

GDAL Convert to GPX, force format

In QGIS 3.16.9, I'm trying to do a simple processing modeler that would repair and convert polygons into simple lines then into GPX files. First steps are done until I try to save the lines output as ...
0
votes
1answer
63 views

Changing layer names when converting from WFS to Geopackage‏

I want to convert WFS to GeoPackage, everything is working fine but I need to change the name of each layer before converting to GeoPackage because the layer name has a special character ":"...
0
votes
1answer
36 views

Error while converting multiple layers (FeatureServer) to one GeoPackage

when I want to convert this FeatureServer as one GeoPackage using ogr2ogr on macOS, an error occurred with these messages Warning 6: driver ESRIJSON does not support open option NATIVE_DATA ERROR 1: ...
0
votes
1answer
16 views

SSL error throws when I try do operation

ERROR 1: SSL certificate problem: unable to get local issuer certificate This message appears when I do an operation using the ogr2ogr library using terminal on MacOS, the URL that I am using is ...
3
votes
1answer
47 views

Converting multiple MapInfo tab files to shapefiles using PyQGIS and GDAL

I am trying to put together a script to convert multiple (>50) Tab files into shapefiles. I am planning on executing this through the python console in QGIS 3.8.1 When I run the below code all I ...
1
vote
1answer
30 views

Custom Attributes from GeoJSON files not loading through ogr2ogr to PostGIS database

I am ingesting hundreds of GeoJSON files which I need to load in the PostGIS database. I am using ogr2ogr in a shell script to automate the process on a daily basis using the below command. ogr2ogr -...
0
votes
1answer
55 views

ogr2ogr -sql select a layer name with space

I'd like to ingest some shp files into PostGIS using ogr2ogr from my Mac Terminal. The name of these shp files contains spaces. Here is my original script and it works perfectly ogr2ogr -f "...
4
votes
1answer
23 views

Can "--config OGR_SQLITE_CACHE <size>" be set while using ogr2ogr?

I use ogr2ogr (GDAL 3.2.1) to export some Spatialites out of Postgresql. As I was inspecting the exported data via the tools provided by Alessandro Furieri by using PRAGMA cache_size and PRAGMA ...
0
votes
0answers
46 views

ogr2ogr in QGIS v3.8 vs. v3.20 - swapped coordinates from swissgrid to WGS84 when import to MariaDB 10.4.19-

I have a shapefile to be imported to db. in QGIS 3.8 the following worked: ogr2ogr -f ....... -t_srs "+proj=latlong +datum=WGS84 +axis=neu +wktext" but with the latest QGIS 3.20 coordinates ...
0
votes
0answers
34 views

Unable to add geopackage to PostGIS database using OGR2OGR

I am using the following command to upload a geopackage into a POSTGIS database using the OSGeo4W shell that comes with QGIS. ogr2ogr -f “PostgreSQL” PG:”host=<hostname> dbname=<dbname> ...
1
vote
0answers
46 views

Changing shapefile encoding using Python

I have shapefile in cp1251 and trying to convert it into utf-8. Create cpg file with text cp1251 with same name as my shapefile and put it in same directory. Run ogr2ogr -lco ENCODING=UTF8 output.shp ...
1
vote
2answers
61 views

ogr2ogr download GeoJSON from URL with parameters

I have this working URL query for this dataset https://data.ny.gov/resource/9a8c-vfzj.geojson?$limit=100000&$$app_token=mytoken&$where=county in('Kings','Queens','Bronx','Richmond','New York') ...
2
votes
1answer
27 views

ogr2ogr missing geometry when selecting from one sqlite db into another

I have a more complicated dataset in real life but here I'll include a simplified case to illustrate what is happening. I'm almost certain it due to my lack of knowledge on how to use ogr2ogr properly ...
1
vote
1answer
41 views

Exporting Oracle table with multiple geometry columns to gpkg by using ogr2ogr

I am using ogr2ogr to export a table in Oracle to GPKG. The table in Oracle has two columns (GEOMETRY_2, GEOMETRY_20) with geometry info. I am using the following ogr2ogr command to export the table ...
1
vote
0answers
37 views

Unable to import shapefile to SQL Server 2019

Windows 10; GDAL 3.3.1; QGIS 3.2; SS2019; When attempting to load any shapefile into SQL Server 2019 I'm getting column headers but no rows are importing. I've tried: Different versions of QGIS (QGIS ...
0
votes
1answer
27 views

GDAL SQL Syntax Error "Unexpected End of String"

I am trying to convert from SQL to shapefile, from EPSG 28355 to 4283, however I am getting the error: ERROR 1: SQL Expression Parsing Error: syntax error, unexpected '.', expecting end of string. ...
3
votes
1answer
83 views

How to create mapnik XML file for database

I have a folder of sea maps in S57 format (i.e. file.000 files). And I want to create a .png at some location as input. So my tools are: old debian-based OS, S57 as map format, navi2pg or ogr2ogr to ...
0
votes
2answers
64 views

ogr2ogr loads spurious tables from GeoPackage using PostGIS driver

I am loading a GeoPackage file into PostgreSQL using the following command:- ogo2org -f PostgreSQL -oo LIST_ALL_TABLES=NO \ -lco OVERWRITE=YES \ -lco ...
1
vote
0answers
57 views

Importing to pgsql from gpkg/shp with ogr2ogr

I am trying to import features from a geopackage (or a shapefile) in an existing table of a distant PostgreSQL database. I use ogr2ogr which I run from OSGeo4W Shell. The code used with the geopackage ...
0
votes
1answer
35 views

Slicing shapefile by negative coordinates

I have a shapefile that contains data for both sides of the Greenwich meridian. According to ogrinfo, this shapefile has the extents of (-9.298157, 35.265607) - (4.327108, 45.046054). I want to copy ...
0
votes
0answers
30 views

ogr2ogr to CSV with quotes breaks with NULL values

I have some data stored in a Postgres 13 Postgis 3.1 table that looks like id(integer),valid_to(timestamp),language(varchar),name(varchar) 1,2021/08/16 11:19:06.493,eng,London 2,2021/08/16 11:19:06....
3
votes
1answer
81 views

ogr2ogr append script keeps incrementing id field in PostgreSQL/PostGIS table

I have a geopackage (from the 'input' app) which is being inserted into a postgres/postGIS table via an ogr2ogr script on a daily basis: ogr2ogr -append -f "PostgreSQL" "PG:user=xxxx ...
6
votes
2answers
241 views

Is it possible to run a PostGIS query on a SpatiaLite database?

I like using SpatiaLite because, for me, it's easier to manage files on my computer instead of having tables inside a PostgreSQL database. However, there are sometimes I need PostGIS functions that I ...
1
vote
1answer
45 views

How to convert s57 to shape via ogr2ogr?

Trying conver s57 files to shape. First added enviroment variable: OGR_S57_OPTIONS with value RETURN_PRIMITIVES=ON,RETURN_LINKAGES=ON,LNAM_REFS=ON Then run: ogr2ogr -overwrite -skipfailures "...
1
vote
0answers
19 views

Export part of schema to SpatiaLite

I want to export a part of a schema to SpatiaLite. It seems that I am to be able to export the whole schema with gr2ogr -skipfailures --config PG_LIST_ALL_TABLES YES --config PG_SKIP_VIEWS YES -f &...
0
votes
1answer
88 views

GDAL ogr2ogr into SQL Server Bulk Insert (BCP) not working

I'm on Windows 10 trying to use ogr2ogr to transfer a single non-spatial table from SpatiaLite to SQL Server 2016. (I'm also using this for spatial tables back the other direction (MSSQL->SQLite) ...
1
vote
1answer
41 views

Reproject shapefile between two user projections

I need to tranform a set of geometries that have been drawn in the wrong projection system in an other projection system. I tried to do this using this command : ogr2ogr -s_srs bad.prj -t_srs good.prj ...
1
vote
0answers
24 views

Removing holes from shapefile in OGR call (or adding additional OGR calls)

I have: and after using this ogr2ogr call: ogr2ogr -dialect sqlite -sql "select st_union(geometry) from tmpem122" -explodecollections dissolved.shp tmpem122.shp I get: The problem is to ...
0
votes
1answer
53 views

"no such field as `OGR_GEOMETRY'" when changing Multipolygon to Polygon with altering geometry in shapefile

The attempt is to change from multipolygon to polygon (shapefile) using: ogrinfo tmpem122.shp -sql "alter table tmpem122 alter column OGR_GEOMETRY type geometry(polygon, 4326) using st_geometryn(...
0
votes
1answer
55 views

How to add coordinate system to SPOT imagery mask files?

I'm working with SPOT 6 and 7 imagery delivered in DIMAP format. I've figured out how to extract the multispectral and pan-chromatic bands into geotiff with gdal-translate so they're easier to work ...
0
votes
0answers
27 views

OGR2OGR ERROR 1: Non contiguous curves

I am using ogr2ogr to move data between a file geodatabase and a postgres database with postgis installed. the layer is returning the error: ERROR 1: Non contiguous curves Googling the error does not ...
0
votes
1answer
48 views

ogr2ogr PostgreSQL layer creation options

Using ogr2ogr to import shapefile into PostGIS, I would like to be able to use specific SQL statements (ex: create index, alter column, add constraint, ...) within my ogr2ogr command line, to be ...
0
votes
0answers
19 views

GDAL ogr2ogr - taking too long to load MapInfo TAB file into SQL server table

I am having an issue with loading MapInfo TAB format file into SQL Server table. We have a process that is running fine which uses GDAL ogr2ogr.exe to load MapInfo TAB files we get from suppliers into ...
3
votes
1answer
160 views

Replicating ogr2ogr operation with GDAL vector translate

Following a comment on Error using SQL statement in ogr2ogr with Python string formatter, I am trying to use gdal.VectorTranslate() instead of ogr2ogr, but I keep receiving an error. Using Windows, ...
1
vote
1answer
41 views

Error using SQL statement in ogr2ogr with Python string formatter

I am iterating through a list of shapefiles and extracting subsets of each shapefile to save as a KML using ogr2ogr. How can I extract the subset based on multiple conditions while using string ...
0
votes
1answer
85 views

ogr2ogr shapefile to MariaDB

My problem is: when i open my shapefile in Qgis its fine. but i need to export my shapefile to a Database MySQL/MariaDB. i export my file with ogr2ogr with this command: ogr2ogr -f "MySQL" ...
1
vote
2answers
62 views

ogr2ogr unable to find driver LIBKML

I am trying to use ogr2ogr to convert a SHP to KML. I want to use the LIBKML driver because it has more options for customizing the KML output. Code is below (running in Jupyter notebook). ! ogr2ogr -...
0
votes
1answer
41 views

Python convert GeoDataFrame to shapefile using ogr2ogr, unable to open error

I have a GeoDataFrame that I am trying to save as a shapefile using ogr2ogr. Based on the Q&A for Use GeoDataFrame as a osgeo.ogr DataSource and Using geopandas GeoDataFrame in gdal.Grid for ...
1
vote
1answer
78 views

ogr2ogr shapefile import to PostGIS

I'm trying to import a shapefile into a new PostGIS table, selecting specific fields from the input shapefile and adding a new date column to the output table. I'm using ogr2ogr with -sql option to ...
0
votes
0answers
18 views

ogr2ogr ignores some osm ways when converting from osm to gpkg

I convert OSM PBF downloaded from Geofabrik to GeoPackage for further processing with fiona. Recently I have noticed that some ways get lost during the transfer. In particular the way with id 8597172 (...
0
votes
1answer
65 views

ERROR: Unable to open datasource with ogr2ogr

I am trying to convert OpenDrive file xodr file format to shapefile format shp using gr2ogr I am using: ogr2ogr -f "ESRI Shapefile" Town_01.shp Town01.xodr But I get the following error and ...
1
vote
2answers
61 views

Recursively reproject shapefiles in folders and subfolders

I would like to recursively reproject shapefiles with different source projections. The shapefiles (109) are saved in deep folder trees. They have 4 different CRS, all the *.prj are present. As result,...
0
votes
0answers
18 views

Changing schemaUrl in SchemaData when converting PostGIS to KML using OGR2OGR

I'm using ogr2ogr to convert PostGIS to KML file. ogr2ogr -f "KML" file.kml PG:"host='myhost' user='user' dbname='db' password='password'" -sql "select ref_n, wkb_geometry ...

1
2 3 4 5
20