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

learn more… | top users | synonyms

3
votes
2answers
2k views

Loading shapefile to a specific table in postgis using ogr2ogr

I have already created a geometry table in postgis. I want to load several shapefiles into that table using ogr2ogr. But I didn't find the parameter which could specify that table. ogr2ogr -append ...
0
votes
1answer
35 views

GDAL -SQL or -where options

ogr2ogr -overwrite -t_srs EPSG:3978 -f "ESRI Shapefile" -sql "SELECT * FROM 'Layer Name' WHERE FIELD_NAME = 'A CLASS'" dst.shp src.shp help me out here - looking to 1) reproject a shape and 2) ...
1
vote
1answer
35 views

ogr2ogr problem mapping shapefile to geojson ETRS89 / Poland CS92

I'm trying to convert official boundaries of administrative regions of Poland from official governmental site (codgik.gov.pl). I want to use those data because they are official ones, and set contains ...
1
vote
2answers
260 views

Reducing Size of KML file (After converting from Shapefile)

I have a shape-file of size 224 mega byte. I am using ArcGis to convert it to a KML file. The process involves converting the shapefile to a feature layer and then converting the layer to KML. An ...
1
vote
1answer
327 views

ogr2ogr - extracting S-57 layers

I'm trying to extract the layer DEPARE from an S-57 datafile and convert it into a shapefile. I'm using ogr2ogr from OpenGeo Suite 4.5 (GDAL 1.11.1) on Windows 7 64 bit. The problem is that when I ...
0
votes
1answer
191 views

ogr2ogr from MIF to KML including MID generating split kmls

I have a set of MIF and MID files that I would like to translate to KML. I used ogr2ogr to transform the MIF into one big KML which worked ok like so: ogr2ogr -f "KML" geo-kml geo-mif I have two ...
2
votes
1answer
82 views

Converting a CSV with a WKT column to a Shapefile

Using ogr2ogr in Python, I am trying to convert a CSV to a shapefile. One column in the CSV, named "Polygon", contains WKT like this: POLYGON((long lat, long lat, long lat, etc.)) Currently, I can ...
1
vote
1answer
24 views

Unable to open datasource with ogr2ogr.main() [closed]

I try to make ogr2ogr work in Python the way suggested by Elevine's answer elsewhere, but I'm facing bugs. Most notable error is that while I try to reproject shapefiles, I get the following error: ...
2
votes
2answers
87 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 ...
3
votes
1answer
45 views

How to re-compile ogrinfo against gdal used by QGIS?

I just solved a problem with missing libraries blocking use of ogrinfo and ogr2ogr, only to find that these utilities are garbled in one more way: whenever I run any of these, I get following error ...
2
votes
1answer
81 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 ...
1
vote
1answer
423 views

GDal problem “no suitable image found” when I run “ogr2ogr” command

I am trying to run "ogr2ogr" command macbook$ sudo ogr2ogr -f "PostgreSQL" PG:"dbname=test user=postgres" /Users/macbook/planning.gdb But I am getting this error: dyld: Library not loaded: ...
0
votes
1answer
35 views

Problem importing sqlite into Postgres (with PostGis) using ogr2ogr

I am trying to import a very large sqlite file into Postgres SQL 9.3. The first tool I tried to use was OGR2GUI (http://www.ogr2gui.ca/). The 64 Bit version does nothing, whilst the 32 bit version ...
3
votes
2answers
658 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 ...
3
votes
2answers
84 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 ...
3
votes
1answer
634 views

Converting Tab to Shp Using OGR2OGR with Python on linux

First i downloaded http://svn.osgeo.org/gdal/trunk/gdal/swig/python/samples/ogr2ogr.py and i am importing this. How can i get ogr2ogr to run in my script? nothing seems to be working and i not sure ...
2
votes
0answers
18 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 ...
0
votes
1answer
38 views

Spatial query ST_CONTAINS returns empty result

I want to create a database view in Postgres/PostGIS which returns a subset of the points stored in another table called locations. The subset is defined by an area stored in yet another table called ...
1
vote
0answers
22 views

How to install CartoDB driver for ogr2ogr?

I'm trying to import data from my postgis DB directly into CartoDB. I've seen in this forum's post that I can do that with ogr2ogr, a GDAL tool, in this way: ogr2ogr -t_srs EPSG:4326 --config ...
0
votes
1answer
60 views

Keeping Properties When Converting JSON to SHP

I'm trying to convert the Nielsen map of DMAs from a JSON to a shapefile. The properties of the json is as formatted like this: "id": 546, "properties": { "name": "dma:", ...
1
vote
0answers
23 views

ogr2ogr: export intersected gml using shapefile

I'm trying to do the same as the ogr2ogr example given by http://gis.stackexchange.com/a/119404/6458 The difference is that my inputs are a GML and a shapefile. Export.shp should only contain the ...
3
votes
1answer
64 views

Execute ogr2ogr from python

I tried to execute ogr2ogr from python with this shell command: ogr2ogr.exe --config PG_LIST_ALL_TABLES YES -f "PostgreSQL" -append PG:"host=hostnamet user=username password=password dbname=dbname" ...
2
votes
2answers
30 views

Using “ogr2ogr -sql” without an input fiile

Lets say I just wanted to turn WKT to GeoJSON on the command line I could do this: /opt/gdal-custom/bin/ogr2ogr -f CSV /vsistdout/ foo.sqlite \ -dialect sqlite \ -sql "SELECT ...
11
votes
7answers
8k views

ogr2ogr convert all shapefiles in a directory

I have a directory with several shapefiles. How can convert all these shapefiles to MapInfo with ogr2ogr. I know how I can convert one file. And I can make a batch script writing a line for each file. ...
0
votes
0answers
44 views

Speeding up a GDAL SQL query with indexes or different file formats

I have a query that I'm performing with python and OGR2OGR similar to this: /opt/gdal-custom/bin/ogr2ogr -f CSV /vsistdout/ foo.shp -dialect sqlite -sql "SELECT A, ...
1
vote
0answers
57 views

Using a ShapeFile spatial index with ogr2ogr and ogr.DataSource.ExecuteSQL()

I created a spatial index foo.qix for a foo.shp with ogrinfo -sql "CREATE SPATIAL INDEX ON foo" foo.shp However, when I do a query with ogr2ogr and look at it in strace, it doesn't use that index: ...
1
vote
2answers
73 views

Using ST_Intersects in OGR2OGR

I'm running GDAL 1.11.2, released 2015/02/10. The following displays all the attributes in my shapefile on stdout: /opt/gdal-custom/bin/ogr2ogr -f CSV /vsistdout/ foo.shp -sql "SELECT * FROM foo ...
1
vote
0answers
7 views

Include <link> in GPX when writing from ogr2ogr

http://www.gdal.org/drv_gpx.html seems to indicate that ogr2ogr should be able to write <link>[1] elements into a GPX file, however when using ogr2ogr to convert from PostGIS to GPX, I get the ...
0
votes
1answer
32 views

Importing data to CartoDB using ogr2ogr

First attempt, I want to create a table at CartoDB from another Postgis database: snow:Docker-Postgis alasarr$ ogr2ogr --config CARTODB_API_KEY daf3960b41733ef71e03ea77019642761d547f5b -f CartoDB ...
1
vote
1answer
63 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 ...
1
vote
2answers
57 views

OpenStreetMap boundary relation lost when exporting to spatialite with ogr2ogr?

I am currently working in map for a province of Papua New Guinea. In OpenStreetMap (OSM) I have recently updated and added new relations for boundaries of admin_level=5 and admin_level=6, which were ...
1
vote
1answer
68 views

File Conversion using ogr2ogr gui

I have used 'ogr2ogr' for ESRI shape files conversion to Mapinfo tab files, but issue is that as soon as I open those converted .tab files over Mapinfo, the software stop working with a message ...
2
votes
1answer
41 views

Reproject X coord value in Shapefiles

I convert Bavarien NAS-Data (DHDN 3 Degree Gauszone 4) via ogr2ogr into shapefiles: "C:\Program Files (x86)\QGIS Wien\bin\ogr2ogr.exe" "ESRI Shapefile" -skipfailures Entenhausen.xml This seems to ...
3
votes
3answers
1k views

Why are ogr2ogr SQLite geometry functions not available in command line?

I believe title is all clear.I'm using Ogr2ogr utilities & binaries to read geometry. I used something like this: ogr2ogr -f "SQLite" test2.sqlite test.sqlite -sql "SELECT ...
0
votes
0answers
22 views

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

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 ...
5
votes
1answer
3k views

Importing KML in QGIS - what are all the node elements that QGIS looks for other than Name and Description?

Of all elements given at (ref: http://service.kmlvalidator.com/ets/ogc-kml/2.2/) only Name and Description seem to be recognized on importing KML using QGIS 1.8.0-Lisboa. I would like to know if this ...
0
votes
0answers
49 views

QGIS 'Save As' Reprojection Produces Different Results from ogr2ogr command line

Another 3857 vs 4326 question. When I reproject from EPSG:3857 to EPSG:4326 (and from .shp to .geojson) via the QGIS 'Save As' dialog, I get results that display in the expected place on Google Maps. ...
1
vote
0answers
58 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 ...
4
votes
2answers
2k views

merge shapefile using ogr2ogr and retrieve the attribute of both

Ciao, I have two shape files that I want merge (overlay/intersect) having in the destination the attributes of the two sources file. ogr2ogr file_merged.shp tl_2010_us_uac10_conus_albersUA.shp ...
1
vote
0answers
90 views

How to import UTF-8 encoded Shapefiles into SQL Server?

I am trying to load a shape file to sql, using ogr2ogr and Shape2SQL tools. The shape file uses UTF-8 encoding, specified in a .cpg file, and confirmed when opening the file with QGIS. However, as ...
2
votes
1answer
2k views

D3 adding topojson - no data visible

Yesterday I asked what would be the best method of creating an overlay in a web map that would allow for some interactivity. Create interactive map with no server Thanks to a variety of people who ...
3
votes
2answers
312 views

How to delete empty fields from a Shapefile with QGIS or ogr2ogr?

I have a Shapefile with a lot of empty columns but many of them are empty. Using QGIS or ogr2ogr, how do I remove all attribute columns where everything is NULL?
0
votes
0answers
65 views

ogr2ogr failing to open/convert GML

I'm trying to convert a GML file into GeoJSON using ogr2ogr, I've compiled GDAL, Expat and Xerces from source, but when I run my command I get an error. My convert command ./ogr2ogr -f "GeoJSON" ...
0
votes
1answer
143 views

Shapefile to Mysql error using ogr2ogr

I'm following this tutorial. I installed the “GDAL Complete” Framework from kyngchaos.com and I tested the installation on Mac. I have GDAL 1.11.2, released 2015/02/10. When I am trying to run this ...
0
votes
1answer
43 views

Filter OGR datasource in Python (or XML)

I'm trying to streamline the process whereby we build tiles (of ~30 layers, representing planning zone and zone-overlay boundaries). I have a strong preference for FOSS tools. A couple of our people ...
0
votes
0answers
42 views

Can styling be applied to a kml (from a shp) using ogr2ogr

Is it possible to generate a styled KML using ogr2ogr (ie pen width and colour?) I cannot seem to find anything in the ogr2ogr documentation. My code so far is; ogr2ogr.exe -f "KML" prow-kml.kml ...
1
vote
2answers
83 views

Running the ogr2ogr utilities in a batch file. Problems with command project

I have made a batch file containing a list of two commands. The first (-clipsrc) works properly, but the second not (-s_srs EPSG:4326 -t_srs EPSG:3857). Could anyone tell me where is the fail?. This ...
3
votes
2answers
203 views

How to make a local copy of a large WFS dataset?

We are writing a application in which a part of the job is to fetch a relatively large (>10000 features) and often updated dataset from a WFS server, store a local copy, and do geospatial analyses on ...
2
votes
0answers
51 views

How to clip or erase a csv file with a non-rectangular shapefile?

I can clip a csv file with a ogr2ogr having 4 extents of a rectangular polygon. Is it possible to clip a csv file with a non rectangular shapefile?
0
votes
1answer
90 views

ST_Intersect with ogr2ogr and Spatialite

I am trying to intersect Spatialite datasets with ogr2ogr, the OGR Virtual Format and SQL Syntax. I can't seem to locate whether the error is in my SQL query or my VRT file. Data ...