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
0
votes
0answers
9 views

How can I make ogr2ogr import data to PostGIS using a schema different than public?

I've successfully imported from SpatiaLite to PostGIS with the following command: ogr2ogr -f "PostgreSQL" PG:"host=localhost port=5432 user=user password=password dbname=mydb" -nlt ...
0
votes
1answer
31 views

Making ogr2ogr not normalize field names

I have a CSV file that I'm converting to Shapefile with the following command: ogr2ogr -oo X_POSSIBLE_NAMES=longitude -oo Y_POSSIBLE_NAMES=latitude -f "ESRI Shapefile" output.shp input.csv ...
0
votes
1answer
25 views

OGR2OGR Esri JSON to GeoJSON - Rings returning as null in geometry?

I'm trying to convert an Esri JSON file to a GeoJSON format using ogr2ogr. For some reason, in the objects returned, the geometry field is constantly null. Here's the script I'm running: ogr2ogr -f ...
1
vote
1answer
24 views

is it possible convert 3 shape files to 1 gpx file?

I ran into problem converting shp to gpx file. I used below code using ogr2ogr. ogr2ogr -f gpx i.gpx i.shp it works well, but I'd like to convert 3 shp files to 1 gpx files like this: ogr2ogr -f gpx ...
0
votes
0answers
20 views

Looping through all layers in Esri feature server

Because multiple layers aren't handled by the ESRIJSON driver. I have to query layer per layer. source I need to loop through all my feature layers, To generate a GeoPackage file containing all ...
0
votes
1answer
13 views

ogr2ogr DXF_FEATURE_LIMIT_PER_BLOCK error

I am trying to convert a DXF to GeoJSON using ogr2ogr However, I am getting the below error: Limit of 10000 features for block ____ reached. If you need more, set the DXF_FEATURE_LIMIT_PER_BLOCK ...
1
vote
1answer
22 views

How to delete duplicate objectID in ogrmerge?

I am using ogrmerge to merge two GeoJSON files together. These two files can sometimes have duplicate objectIDs. Is there a way I can specify from the ogrmerge command options to only select distinct ...
1
vote
0answers
34 views

Using -limit tag with ogr2ogr and -where takes too long

I am running some ogr2ogr commands to extract some data from OSM dataset. Since I don't want to extract all features of some condition because I can't see them all and is takes too long I am trying to ...
0
votes
0answers
28 views

Convert geometry type multilinestring to polygon

I want to create a .sh script which would edit my JSON file. "features": [{ "type": "Feature", "properties": { "value": 1.0, &...
1
vote
1answer
42 views

Making ogr2ogr generate different files for each geometry

Let's say I have a GeoPackage file with 5000 lines. Each line with its own MULTIPOLYGON geometry. I know I can use spatial functions with it and generate a new file as the following: ogr2ogr -f GPKG -...
0
votes
0answers
34 views

Troubleshooting ogr2ogr error when loading shapefiles into PostGIS: Error 1: Couldn't fetch requested layer

I am trying to get familiar with PostGIS. I have been trying to work through the PostGIS tutorial and following the instructions closely but they aren't working for me and I'm not sure how to ...
1
vote
0answers
35 views

How to change the geometery type multilinestring to polygon in a JSON file through og2ogr [closed]

I have have a JSON file of earthquake data. The data type within the JSON file is a MULTILINESTRING. For my further workflow I need the data type POLYGON. I am able to import the dataset as POLYGON ...
3
votes
1answer
47 views

Add data inside a shapefile incrementally with ogr2ogr

Let's say I have the two following CSV files: file1.csv: Latitude,Longitude,name -23.5592201171,-46.5417389180,one -23.5666778463,-46.5500715205,two file2.csv: Latitude,Longitude,name -23.5703366507,-...
5
votes
1answer
65 views

Using ogr2ogr to generate a shapefile from a CSV with multipolygon geometries

I have a CSV file with the following structure: id,Geometry 0,MULTIPOLYGON(((343362.10597 7395133.999035, 343362.608646 7395137.592628, 343366.027235 7395138.714539, 343389.482792 7395141.302312, ...
0
votes
1answer
47 views

Why is the Export to PostgreSQL function in QGIS to a remote database extremely slow?

I posted this on Twitter but I'll ask here as well - I need to load spatial data into a remote PostgreSQL database (i.e. a db on a VPS in the cloud or hosted SAAS db). When I use the Export to ...
0
votes
1answer
18 views

Extract Layer with Wildcard (*) or by Index

In the Geopackage below (in.gpkg) I would like to extract the first layer (i.e. pinios_eudem2_basins) and write it to a new Geopackage (out.gpkg). However I would like to do this not by name, but with ...
0
votes
0answers
38 views

Error: free(): invalid pointer displayed when executing ogr2ogr on ubuntu 20.04

Hello I'm getting an error when executing ogr2ogr tool when running bash file: free(): invalid pointer save_maps_to_db.sh: line 5: 301101 Aborted (core dumped) ogr2ogr -f "$format" PG:"...
0
votes
0answers
46 views

How to generate a Mapbox Vector tile correctly?

I have a GeoJSON file that has this data { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties"...
1
vote
0answers
40 views

REST API pagination with OGR

I am using OGR to ETL data from an ArcGIS Map Service into PostGIS. When I run ogrinfo on the service, I see ~47000 records: ogrinfo -so -al "https://maps.bouldercolorado.gov/arcgis/rest/services/...
-1
votes
1answer
112 views

Conversion of GeoJSON to GPX? [closed]

How do you convert a GeoJSON file to GPX?
0
votes
0answers
16 views

ogr2ogr geometryCollection export: Attempt to write non-linestring (GEOMETRYCOLLECTION) geometry to ARC type shapefile

I'm trying to export a single table row to geometryCollection. I don't understand why I am getting the following error message or how to fix it. The row contains the following shape GEOMETRYCOLLECTION ...
1
vote
0answers
22 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
60 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
41 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
vote
1answer
49 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
36 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....
2
votes
0answers
235 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
25 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
74 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
42 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
20 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
58 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
51 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
62 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
36 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
62 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
42 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
97 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
83 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
40 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
71 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
54 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
38 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
132 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
85 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
70 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
36 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
56 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
111 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
294 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
2 3 4 5
20