ogr2ogr is an open source command line utility popular for converting to and from various vector spatial data formats.

learn more… | top users | synonyms

2
votes
2answers
355 views

Geocoding on OSM-shape files via elasticsearch

I want to get a geocoding system based on osm data and elasticsearch engine. I've tried some projects like komoot\photon, but, as I'm a really newbie in this, I stuck on preparing of the data for my ...
4
votes
0answers
45 views

How do I load 1 billion points into PostGIS?

I have a file geodatabase containing research data that I need to load into PostGIS. The GDB contains one feature class with one billion records with three columns (the FID, a FK, and the geometry ...
0
votes
0answers
15 views

What is the ogr2ogr syntax for exporting from Oracle to Spatialite?

I want to export data from Oracle to spatialite, 3 tables with geometry and 1 attribute table. Alternatively, I already have this data written out nightly using ogr2ogr, but the output location is a ...
0
votes
0answers
30 views

Loading GML data into Postgres with ogr2ogr

I'm working with a new OS dataset, Highways Network, trying to get it loaded into Postgres and set up in some kind of usable state. I've loaded all the data already, but it seems some elements of ...
1
vote
3answers
342 views

Extracting difference between two massive shapefiles using QGIS?

I have two massive shapefiles and I need to create a difference shapefile output between the two. I have a layer where I have satellite coverage (orange) and then a layer where I have high resolution ...
3
votes
3answers
1k views

How to repair broken GDAL and PROJ.4 on Ubuntu?

EDIT2: I solved the library problem, but others remain, only vaguely related to that of PROJ.4 library not loaded. I asked a follow-up question for these. My GDAL package and PROJ.4 library are ...
0
votes
1answer
15 views

Set PATH variables for ogr2ogr without admin privileges

In the office I use ogr2ogr to convert several file formats such as KML or ESRI shapefiles. Since the commands are the same almost every time I'd like to run ogr2ogr with a batch. I'm using the GDAL ...
7
votes
2answers
4k views

How to convert GML Surface to SHP Using OGR?

I have a very large .gml file with multiple layers in it. I would like to export one of these layers to .shp. It is a polygon layer (of lakes). However, I am getting the error: ERROR 1: ...
4
votes
1answer
193 views

Merging multiple feature classes in file geodatabase with ogr2ogr?

Is there a way to merge multiple feature classes into one feature class in a geodatabase with ogr2ogr? If this isn't possible with ogr2ogr, is there another method? I'm using the ESRI File Geodatabase ...
2
votes
1answer
35 views

Export to DXF from PostgreSQL using ogr2ogr

I have a large dataset in a PostGIS database (OS MasterMap). My aim is to export specific areas of this dataset to DXF, while retaining the attributes of the data as layers in the DXF. My current ...
1
vote
1answer
223 views

ogr2ogr from personal geodatabase to spatialite produces “non-spatial” tables

I have around 4 GB of data in 10 separate Personal Geodatabases, each of which contains multiple feature classes. I'm trying to convert the smallest one to SpatiaLite via ogr2ogr, in preparation for ...
0
votes
1answer
32 views

Why do I get a 503 error when pushing data to the CartoDB SQL API

I'm using ogr2ogr to push a large (200,000 feature) dataset to the CartoDB API. I'm using where_clauses to upload 500 features at a time, and sleeping every 20,000 features for a minute to give the ...
1
vote
0answers
19 views

Identifying suitable head (H) for hydro power estimation from 30m SRTM DEM data using focal statistic analysis

I am doing my project on identifying suitable sites for locating small-scale hydro power. I have all other necessary variables but I am confused about extracting Head (H) values in meters from SRTM ...
3
votes
3answers
40 views

What is the easiest way to avoid shapefile columns being imported as PostGIS `numeric(p,s)` data type?

Considering the number of shapefiles I've imported to PostGIS (using shp2pgsql or ogr2ogr), I'm a little surprised I haven't come across this before. But I have a shapefile that has numeric columns ...
3
votes
2answers
45 views

Ogr2ogr is rounding numeric field from PostgreSQL to 6 decimals

I am using ogr2ogr to convert the data from PostgreSQL to GeoJSON. PostgreSQL contains field named shape.area, type numeric, which stores values up to 17 decimal places, like 0.15627328781960101. The ...
2
votes
2answers
57 views

Converting shapefile to postgis without giving bounding box

ogr2ogr -progress --config PG_USE_COPY YES -f PostgreSQL PG:"<myconnection>" -lco DIM=2 /path/to/myshapefilename.shp myshapefilename -overwrite -lco GEOMETRY_NAME=geom -lco FID=id -spat ...
3
votes
2answers
751 views

Convert non-spatial Oracle table to spatial Oracle table in a different database

I'm trying to use ogr2ogr to convert data from a non-spatial table (has X & Y values) in an Oracle database (1) to a spatial format in a different Oracle database (2). This will be scheduled to ...
2
votes
0answers
39 views

Using ogr2ogr for clipping vector files

I am looking for alternative (more efficient) methods for clipping large feature class datasets. When using the 'Clip' tool in ArcGIS, often times the tool will crash after many hours of processing. ...
3
votes
2answers
311 views

How to have GDAL print layers of GeoPDF AND say which are raster vs vector

My Objective: I would like to use GDAL to convert a GeoPDF. I want the vector layers as shp files and the raster layers as tif files. I want to do this in a programmatic way. Edit: In reality, I ...
1
vote
3answers
216 views

ESRI Shapefile not loading into SQL Server

I have been loading a number of shapefiles into SQL server 2012 using ogr2ogr.exe and the MSSQLSpatial driver. Up until this point, I have been very successful with doing so. However, I have now run ...
1
vote
0answers
46 views

Is spat the correct flag to use in my ogr2ogr command?

I have an ogr2ogr command that I'm using to convert part of a Postgres database to a Geojson. I ingested all of Canada in my database and to start, I want to grab all of the buildings in the Toronto ...
4
votes
3answers
2k views

Converting multilayer KML files to GeoJSON using ogr2ogr

I have a kml file that I'm trying to convert to GeoJSON. However, it turns out there's multiple layers, and ogr2ogr isn't happy. $ ogr2ogr -f GeoJSON shapes.json shapes.kml ERROR 6: GeoJSON driver ...
4
votes
1answer
25 views

How to resolve error when launching OSeo4W Shell: Windows cannot find .bat file?

I downloaded and installed OSGeo4W to use ogr2ogr, but the the program OSGeo4W will not run. On launching the shell, I receive an error stating the .bat file cannot be found in specified directory ...
1
vote
0answers
23 views

ogr2ogr append 1 row to a File GDB feature class's data table

I export a polygon layer from Oracle to a FileGDB using ogr2ogr. I need to append one row to the data table, with '0' for numeric fields and 'No Elements' for the one string field. In ArcGIS, I run a ...
6
votes
1answer
111 views

Why isn't QGIS detecting CRS from .prj file?

I have a number of 1 km hexagonal grids that cover various counties in the United States in a postgreSQL/postGIS database. Each grid has the CRS EPSG:3857, and the counties layer has EPSG:3857. When ...
1
vote
1answer
31 views

Export Line Feature using ogr2ogr.

I am trying to export a line feature class from an oracle spatial database to a file geodatabase. I can export polygons with no problem, but cannot find the appropriate command '-nlt' for Line ...
1
vote
1answer
23 views

Convert KML polygons to lines

I've been given a KML file which should consist of linear features (train lines), but for some reason they're all represented as <Polygon> types. Each appears to have the right data, from end of ...
3
votes
1answer
58 views

ogr2ogr: encoding issues when importing from Oracle Spatial to PostGIS

I'm trying to import some spatial tables from Oracle Spatial to PostGIS using ogr2ogr, but I can't figure out why the special characters on the attribute tables get messed up while I'm doing it. My ...
4
votes
1answer
69 views

Error trying to import data to CartoDB using ogr2ogr

I have a local install of CartoDB in my Ubuntu 14.04. I have created a CartoDB account called "development" and been playing with it for a while. Now I'd like to import some data from a shapefile ...
1
vote
0answers
38 views

ogr2ogr - Shapefile database SQL query; missing .cpg and .xml

I am using gdal and ogr2ogr to perform a SQL query on a database of shapefiles with the code below. The geoprocessing works and the appropriate shapefile is extracted from the query, but when I print ...
3
votes
2answers
42 views

Conversion of .shp to EPSG:4326 has slight offset

I just started this project where I need to project the Dutch municipalities on a map. Luckily this seems very easy with the help of GeoJSON. However, I'm having a slight issue where my conversion to ...
0
votes
1answer
52 views

ogr2ogr - Clipping postgis and creating geojson

I'm trying to create a geojson file data based on data from my local postgis database using ogr2ogr. I'm trying to clip to a specific area and when I start to run the command, everything starts fine, ...
1
vote
0answers
74 views

Using TIGER/Line shape files, how do I get address coordinates?

I've downloaded addressfeature shapefiles from TIGER/Line on the Census Bureau website. I converted one file to CSV using ogr2ogr. I get the following sample output: ...
0
votes
1answer
43 views

Converting shapes using OGR2GUI

I am trying to convert a MapInfo .TAB file to a Shape file while setting the projection of the target to NAD83 UTM Zone 19. The latest version of OGR seems to not have this projection available in the ...
0
votes
1answer
19 views

Use ogr2ogr to delete content of table and load new data from shapefile

Is it possible to load a shape file to a postGIS database by replacing the content of the table with the new content of the shape file WITHOUT DROPING the table? I want to do this using ogr2ogr. In ...
0
votes
0answers
22 views

Installation and execution of GDAL

I am trying to install GDAL on the remote server. I do: pip install GDAL==1.9.1 It gets installed and then I try to do: gdalinfo --version But I get 'command not found'. I understand that I ...
1
vote
1answer
50 views

ogr2ogr Set Feature to Column Name?

I'm converting PostGIS data to PDF via GDAL 2.0.2 with below. ogr2ogr -f "PDF" mypdf.pdf PG:"host=domain.com user=me password=mypassword dbname=mydb" -sql "SELECT geom, state_name, sub_region, ...
2
votes
0answers
41 views

Can ogr2ogr “reverse clip” (or “clip out” or “erase” or “difference”) one shapefile from another?

Is there a means in ogr2ogr to "clip out" one shapefile from another? I know ogr2ogr -clipsrc B.shp out.shp A.shp will remove any part of A.shp that is NOT in B.shp. Is there an ogr2ogr command to ...
1
vote
0answers
21 views

ogr2ogr FAILURE: Couldn't fetch requested layer 'ùnlt'!

I am getting the following error message with ogr2ogr while try to convert into MySQL. I have tried PGeo,Shapefile and FileGDB. FAILURE: Couldn't fetch requested layer 'ùnlt'! My environment is ...
1
vote
1answer
131 views

OGR2OGR FileGDB 2 other format with -SQL query change structure

I'm using GDAL 1.11.1 with ESRI FileGDB Driver, GDB version 10.x. When I use ogr2ogr, my goal is to sort differently my fields and in some case, to rename them. The problem is when I call FileGDB ...
5
votes
1answer
1k views

ogr2ogr selecting features by attributes

I am writing a shapefile after some processing; however, in the final step I need to do some selection by attributes from the the shapefile. I am using the command in a shell with the aim of using it ...
0
votes
1answer
31 views

How to extract a shapefile with a SQL expression from a database of shapefiles using PyQGIS or OGR [duplicate]

I have a shapefile Water_Districts.shp that consists of several water district polygons. I am trying to use the script below to 'extract' a specific polygon with the name Cache La Poudre River listed ...
2
votes
0answers
217 views

How to clip a big shapefile from another shapefile's extent

I am working on mangroves in Sundarbans (Bangladesh / India), using Landsat pictures. I need to equalize them in reflectance, before classification, for the evolution of the biomass in this region. I ...
9
votes
7answers
4k views

How to add field with filename when merging shapefiles with ogr2ogr?

I'm merging some shapefiles and I had some problems doing so inside QGIS, so i'm using ogr2ogr directly. I'm doing this (in a batch): ogr2ogr -overwrite %destination% %n1% ogr2ogr -update -append ...
1
vote
1answer
162 views

VSI File API support in ogr2ogr

It seems that support for streaming input is wishy-washy in ogr2ogr. For example, why can I do this: curl "http://data.usgin.org/arizona/wfs?service=WFS&version=1.1.0& ...
4
votes
2answers
51 views

ogr2ogr sql query from text file

In ogr2ogr or ogrinfo, I can successfully query an Oracle database using this command as a test: ogrinfo -al -so "OCI:USER/PASSWORD@SERVER/DATABASE" -sql "SELECT * FROM SCHEMA.TABLE" However, ...
0
votes
1answer
60 views

Combining GeoJSON Features

I haven't been able to find a solution with the source so am trying to work on the output file. I have also asked this question on SO I have a large (200MB) geoJSON file that has a lot of complex ...
1
vote
0answers
54 views

ogr2ogr - mapinfo to geojson. Merging shapes with certain values

I'm just starting out with this so apologies if I explain things poorly. I have some mapinfo files (TAB, IND, MAP etc) and I am trying to convert to Geojson. I can do this using ogr2ogr ogr2ogr ...
2
votes
1answer
72 views

Writing GeoJSON data into PostGIS in perl?

I am working with GeoJSON files and need to store them in PostgreSQL using perl. I can do this in 2 steps: open (JSON,">$path/tmp/current.json"); print JSON $fullJSON; close JSON; followed by: ...
1
vote
1answer
32 views

Truncate a Shapefile field with SQL and ogr2ogr

I want to create a new attribute which is the first 8 characters of another, using ogr2ogr. To my surprise, this didn't work: ogr2ogr -f "ESRI Shapefile" a.shp b.shp -sql "select FID,left(FLOORKEY,8) ...