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
0 answers
15 views

Trying to intersect a geodatabase with a line string using ogr2ogr

I would like to output the features of a geodatabase that intersect a line string using ogr2ogr. ogr2ogr -sql "SELECT geometry, FULL_NAME FROM input WHERE ST_Intersects(ST_GeomFromText('...
user avatar
  • 2,090
0 votes
1 answer
36 views

How to create a 3D DXF from ARCGEN with gdal ogr2ogr?

From ARCGEN (Esri ArcInfo Generate) I want to create a DXF with distinguishable layers: import_polz.pol The transformation to a three-dimensional shapefile runs flawlessly with gdal ogr2ogr: ogr2ogr ...
user avatar
1 vote
1 answer
25 views

Importing a .gdb file into PostGIS using ogr2ogr

I am trying to import data in .gdb format using the OSGEO4W console: ogr2ogr -f "PostgreSQL" PG:"host=XX.X.X.X \ port=5432 \ dbname=XXgeodados \ user=XXXXXX \ password=...
user avatar
0 votes
0 answers
23 views

OSGeo4W / ogr2ogr gives "Unable to create or change a table without a primary key" error with MySQL 8.0

I'm trying to use OSGeo4W Shell to populate my MySQL DB with data from a shapefile and am having some difficulty. Here's the command I'm using: ogr2ogr -f MySQL MySQL:maps,host=localhost,user=root,...
user avatar
  • 205
0 votes
1 answer
23 views

ogr2ogr batch process tries to open zip files instead of .gdb

I am using a semi-automatic analysis using a lot of datasets. To do so, I run a .bat file in OSGeo4W Shell that takes all the unpacked files in a folder and packages them in one .gpkg file for further ...
user avatar
0 votes
0 answers
34 views

How to import shapefile into MySQL with Python

Let's see if you could help me with this: I try to upload a gpkg (geo-referenced) file (table) to a MariadB server (MySQL). Not in PostgreSQL, Mariadb-(MySQL) If I import from an OSGeo4W in the ...
user avatar
2 votes
0 answers
82 views

ogr2ogr errors: PROJ: proj_create no database context specified, cannot prase CRS, proj.db lacks database.layout.version.major/minor metadata etc

I have a PostgreSQL/PostGIS database that I have been working on and it's generated in a docker container. I access it via PGAdmin to the docker DB or sometimes I create a backup and restore locally ...
user avatar
0 votes
1 answer
28 views

ogr2ogr convert WFS data, when WFS has password and username

I am trying to use ogr2ogr on a WFS with username and password. I tried to follow this answer here Import data from password protected WFS using OGR2OGR Does anyone have some examples of doing this? ...
user avatar
  • 561
2 votes
1 answer
47 views

ogr2ogr PostGIS to SpatiaLite: convert hstore to json

I used this command to export PostGIS tables to SpatiaLite with ogr2ogr ogr2ogr -f SQLite -progress -dsco SPATIALITE=yes ./mapfile/psql_tags.sqlite PG:"host=localhost port=5432 dbname=gis user=...
user avatar
  • 187
3 votes
1 answer
33 views

Why ogr2ogr -lco OVERWRITE doesn't work on PostgreSQL public schemas?

I've created a bash script with ogr2ogr as the following: PARAMS=( -f "PostgreSQL" PG:"host=localhost port=5432 user=user password=password dbname=my_database" -nlt ...
user avatar
  • 1,021
0 votes
0 answers
31 views

Receiving the error "Cannot do natural order without a primary key" while trying to download some WFS layers with ogr2ogr

I want to automate getting some public WFS data with ogr2ogr. When I check the data on QGIS the data looks perfectly fine: On QGIS, I can get all data with the WFS service with no problems and I can ...
user avatar
  • 1,021
1 vote
1 answer
35 views

ogr2ogr OSM polygon layer export from PostGIS to SpatiaLite has no CRS

I used ogr2ogr to export osm layers from PostGIS to SpatiaLite using this command: ogr2ogr -f SQLite -dsco SPATIALITE=yes ./mapfile/psql_polygon.sqlite PG:"host=localhost port=5432 dbname=gis ...
user avatar
  • 187
1 vote
1 answer
28 views

OSM to SpatiaLite (spatialite_osm_map or ogr2ogr) for mapnik

I am trying to convert OSM data of a region (136MB pbf) to SQLite. I have two options: spatialite_osm_map or ogr2ogr. My region's SpatiaLite file is 932MB with ogr2ogr, while it is 741MB with ...
user avatar
  • 187
0 votes
1 answer
35 views

ogr2ogr - "Unable to open datasource" error while converting shp to mif in code. Works fine when running command in console

I'm tyring to convert a shapefile to MapInfo using ogr2ogr. (C#/.NET 6) I get the following error when running the code below: Unable to open datasource [directory path]\file.mif. However, If I open ...
user avatar
1 vote
0 answers
40 views

Convert KML to shapefile using GDAL/OGR2OGR to include all attributes from description field

I'm currently trying to develop a workflow for converting KML to shapefile using OGR2OGR command within GDAL. The conversion seems to work fine for some KMLs that have basic information included ...
user avatar
1 vote
0 answers
36 views

Convert EPSG:3857 Geodatabase to MVT EPSG:27700

I'm trying to convert a gdb file to vector tile using ogr2ogr. The documentation mentions that I need to use TILING_SCHEME to do this : https://gdal.org/drivers/vector/mvt.html What would be the ...
user avatar
  • 11
3 votes
1 answer
88 views

Concurrent ogr2ogr processing of GeoJSON using offset/limit

I have a line delimited GeoJSON file with around 600k features. Standard processing of it takes ~53 seconds: ogr2ogr -f "Esri Shapefile" ./out ./in.geojson Another approach I tried out was ...
user avatar
  • 275
0 votes
0 answers
49 views

ogr2ogr Multi Surface, Multi Polygon

estoy tratando de migrar una GDB a una base de datos en postgist con OGR2OGR de la siguiente manera ogr2ogr -f "PostgreSQL" PG:"host=localhost port=5432 user='postgres' password='...
user avatar
0 votes
1 answer
41 views

Changing projection of SpatiaLite layer in QGIS

I created a SpatiaLite layer from Geofabrik OSM data (.pbf) using ogr2ogr. When I load the data into QGIS it only shows up as WGS84. I would like to change it to ESRI:102003 or similar so i can do ...
user avatar
  • 710
2 votes
1 answer
22 views

Deleting entries (duplicates) from a GPKG using OGR

I tried to delete duplicates from a GPKG file using ogr2ogr and a SQLite statement from SO: ogr2ogr -sql "DELETE FROM layer WHERE rowid NOT IN (SELECT MIN(rowid) FROM layer GROUP BY ...
user avatar
2 votes
1 answer
80 views

Using ogr2ogr in Python scripts

I have been trying to figure out how to execute ogr2ogr to convert files in Python script. I got it to work in Jupyter notebook within ArcGIS Pro and in the terminal but not in Python scripts. Here's ...
user avatar
3 votes
1 answer
148 views

Importing a CSV inside PostgreSQL with ogr2ogr through a pipe

I can successfully import a CSV file inside PostgreSQL with the following command line: ogr2ogr -f "PostgreSQL" PG:"host=localhost port=5432 user=user password=password dbname=dbname&...
user avatar
  • 1,021
2 votes
1 answer
80 views

How to dynamically name the output file in ogr2ogr

I am using ogr2ogr to convert my huge geodatabase file (mygdb.gdb) into multiple shapefiles using one of the attributes (myattr). I have 100s of unique values for this attributes, so I am gonna do ...
user avatar
  • 405
2 votes
1 answer
80 views

GDAL to generate MVT from multiple PostgreSQL tables

I have a number of spatial tables in my PostgreSQL database which I would like to tile cache to Vector Tiles. Is it possible to combine multiple tables in one go so that effectively each tile has ...
user avatar
1 vote
0 answers
37 views

Dealing with white spaces in attribute names in ogr2ogr

I am trying to convert a sub-set of my geodatabase into a shapefile using ogr2ogr. The problem is that both the attribute name and the value have spaces, so when I use sql to subset it gives me syntax ...
user avatar
  • 405
3 votes
4 answers
449 views

Downloading lots of data from WFS

The problem is I have a lot of data to download from a WFS. I've tried this method with different errors on the way. First I tried PyQGIS with this script: uri = "http://wms.pcn.minambiente.it/...
user avatar
  • 281
1 vote
1 answer
27 views

Clip vector with ogr2ogr by reprojecting geometries on the fly

I have two vector geometries which I want to clip using ogr2ogr Geopackage with buildings in EPSG:28992 Shapefile with a neighborhood in EPSG:4326 I managed to clip the buildings using the ...
user avatar
  • 11
1 vote
1 answer
27 views

Making ogr2ogr convert from CSV to SpatiaLite while keeping capital letters on the header

Let's say I have the following input.csv file: Column1,Column2,latitude,longitude testData,TestData,-23.547384,-46.643363 testData,TestData,-23.555297,-46.635642 I know I can convert it from CSV to ...
user avatar
  • 1,021
0 votes
0 answers
46 views

Changing the output DXF version when exporting with ogr2ogr

I am exporting a DXF file from a PostgreSQL database. If I use the OSGeo4W installed with the 3.8 vesrion of QGIS, the dxf version will be a newer one than what I would get if I would use the OSGeo4W ...
user avatar
  • 195
1 vote
1 answer
103 views

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 ...
user avatar
  • 1,021
0 votes
1 answer
52 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 ...
user avatar
  • 1,021
0 votes
1 answer
128 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 ...
user avatar
2 votes
1 answer
47 views

Is it possible convert 3 shapefiles to 1 GPX file?

I ran into problem converting shapefiles to a GPX file. I used below code using ogr2ogr. ogr2ogr -f gpx i.gpx i.shp it works well, but I'd like to convert three shapefiles to one GPX file like this: ...
user avatar
1 vote
0 answers
33 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 ...
user avatar
1 vote
1 answer
32 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 ...
user avatar
1 vote
1 answer
34 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 ...
user avatar
1 vote
0 answers
49 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 ...
user avatar
  • 701
1 vote
1 answer
56 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 -...
user avatar
  • 1,021
0 votes
0 answers
112 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 ...
user avatar
1 vote
0 answers
47 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 ...
user avatar
  • 11
3 votes
1 answer
53 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,-...
user avatar
  • 1,021
5 votes
1 answer
145 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, ...
user avatar
  • 1,021
0 votes
1 answer
58 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 ...
user avatar
  • 448
0 votes
1 answer
28 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 ...
user avatar
  • 1,195
0 votes
0 answers
113 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:"...
user avatar
  • 1
0 votes
1 answer
197 views

How to generate a Mapbox Vector tile correctly?

I have a GeoJSON file that has this data { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties"...
user avatar
2 votes
0 answers
64 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/...
user avatar
  • 393
-1 votes
1 answer
224 views

Conversion of GeoJSON to GPX? [closed]

How do you convert a GeoJSON file to GPX?
user avatar
0 votes
0 answers
55 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 ...
user avatar
1 vote
0 answers
43 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 -...
user avatar
  • 989

1
2 3 4 5
21