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

learn more… | top users | synonyms

4
votes
3answers
977 views

How to preserve non-ASCII characters in ogr2ogr import?

I want to import a list of international place names and their locations into a SQL Server database using ogr2ogr. The source data is a CSV file encoded in UTF-8. I've prepared a five-record sample ...
0
votes
1answer
13 views

ogr2ogr - gpx to PostGIS has wrong timezone adjustment

A gpx track point: <trkpt lat="52.321775959804654" lon="-72.647269548848271"> <time>2014-10-01T16:07:19Z</time> </trkpt> is imported with ogrogr in my PostGIS ...
1
vote
1answer
425 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 ...
1
vote
1answer
209 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: ...
2
votes
0answers
14 views

ogr2ogr fileGDB translating points

I am converting data from spatialite to fileGDB (and reverse) for a project using QGIS and ArcGIS. When I convert using ogr2ogr (or QGIS) from spatialite to fileGDB, the points are translated ...
0
votes
0answers
28 views

Overlapping gpx imported to PostGIS with ogr2ogr

I can successfully import track points from gpx file into my PostGIS database the usual way: ogr2ogr -f "PostgreSQL" PG:"dbname=ABC user=usrname password=123" firsttracklog.gpx However, I have a ...
0
votes
0answers
14 views

Projection of COSMO-EU?

I have data points of COSMO-EU data stored in WGS84 coordinates. Now I try to transform them into coordinate system where the points becomming arranged to a regular grid. Does anybody knows the Proj4- ...
0
votes
1answer
28 views

ogr2ogr convert DXF to GeoJSON with defined geometry

I trie to convert a DXF file into a GeoJSON file with: ogr2ogr -f 'GeoJSON' -sql "SELECT * FROM entities WHERE layer = 'geom_test'" test.json dfxtest.dxf Is it possible to convert only geometries ...
1
vote
2answers
72 views

OGR2OGR and SQL: selecting 30 biggest places from a country?

I use ogr2org to filter naturalearth places.shp : ogr2ogr -f GeoJSON -where "ADM0NAME = 'India' AND POP_MAX > 500000" places.tmp.geo.json ne_10m_populated_places.shp I would prefer to select the ...
1
vote
1answer
36 views

OGROGR and SQL: unexpected reserved keyword error?

As I do the following query on naturalearth places.shp : ogr2ogr -f GeoJSON -sql "SELECT * FROM ne_10m_populated_places WHERE ADM0NAME = 'India' ORDER BY POP_MAX DESC LIMIT 1,30" places.tmp.geo.json ...
0
votes
1answer
29 views

Export shapefile From PostGIS

I've a website where I'm giving the functionality of creating and editing line features. I'm using Leaflet-Draw plugin for drawing, PostGIS for storing the data and GeoJSON to display it on map. My ...
0
votes
1answer
20 views

Problem 'unable to open datasource" with ogr2ogr to reproject shape file

I have no idea why i get the following error: FAILURE: Unable to open datasource `Sydney2.shp' with the following drivers. I have already checked successfully the shape with ogrinfo. I am using the ...
1
vote
0answers
31 views

What is causing invalid spatial reference error using ogr2ogr converting PostGIS to FileGDB in a Feature Dataset?

I am trying to use ogr2ogr to convert a layer from PostGIS to a FileGDB. I want the layer to be created inside a Feature Dataset. The spatial reference of the source layer is EPSG:3500. The spatial ...
3
votes
2answers
111 views

Piping data to ogr2ogr

Is it possible to directly pipe data to ogr2ogr? I'm trying to curl a GeoJSON file and pipe it to ogr2ogr to covert it to another format. Without using a pipe, I was able to achieve this by first ...
5
votes
1answer
453 views

Ogr2Ogr exported this boundary 90 degrees incorrectly

I've got some GEOGRAPHY data in my Sql Server 2008. I wish to export it as a shapefile (so I can import it into QGIS) and when I do, it's rotated 90 degrees to the left and then flipped 180 degrees to ...
0
votes
1answer
11 views

Merging separate country features together into one region

I am trying to creating a map of the UK where Scotland and England are merged into one shape and not separate shapes for each country. As a minimum working example, I'm following Mike Bostock's Let's ...
3
votes
2answers
525 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
1answer
953 views

How to Import ESRI Geodatabase format .gdb into PostGIS

I ran into a problem when loading a ESRI Geodatabase format .gdb into PostGIS. I have data 2.5GB GDB file. I followed some tutorials on the internet, but it seems that doesn't work out. I created a ...
1
vote
1answer
36 views

GeoJson based on shapefile : large coordinates

I'm quite new to GeoJson (for use with d3), and in need of some help. When I convert my available shapefile (.shp) with ogr2ogr to a GeoJson-file, the resulting coordinates are very big numbers (in ...
1
vote
3answers
40 views

Lossless conversion from shapefiles to XML/JSON/Text

I'm a software developer and I need to create a custom tool that imports ESRI shapefiles (shp + shx + dbf), manipulates the content and then exports new shapefiles. To avoid a complex binary reading ...
2
votes
1answer
45 views

Can ogr2ogr write data to a file geodatabase feature dataset?

I am dumping postgis tables into a file geodatabase and it works great--the result is a file geodatabase full of featureclasses. But is it possible to write these featureclasses into feature ...
0
votes
1answer
118 views

Why do I get an error when I try and clip a shapefile to a shapefile using ogr2ogr?

I want to clip a shapefile to a shapefile. The input shapefile is a 1 m vector grid generated in QGIS. The tile I'm clipping to is just a simple polygon (the geometry is contained within the 1 m ...
1
vote
1answer
158 views

How to call ogr2ogr from command line with Python 2.7 from ArcGIS 10.2 for Desktop?

I am trying to access ogr2ogr in the command line, and this is the message I receive: 'ogr2ogr' is not recognized as an internal or external command, operable program or batch file. This is ...
0
votes
0answers
28 views

Google Tracks convert kml to shape and preserve attributes

I've been attempting to convert a Google Tracks kmz file to an ESRI shapefile using the GDAL and libkml(http://www.gdal.org/drv_libkml.html) which I built on my Ubuntu 14.04 (64-bit) system. The kml ...
0
votes
1answer
132 views

ogr2ogr GeoJSON GeometryCollection

All, I have a Postgres/PostGIS DB with two geometries in a single table. I want to export them as a GeoJSON GeometryCollection (see here) but I can't seem to get the GEOMETRY_AS_COLLECTION layer ...
1
vote
2answers
271 views

How to convert Shapefile to TopoJSON with grouping neighbor shapes by some criteria

I have a shapefile with countries, which I convert to GeoJSON using ogr2ogr and then converting that json to another TopoJSON, using topojson command-line tool. Everything works like charm, but now I ...
2
votes
1answer
51 views

Export PostGIS line to AutoCAD with graphical direction information

Some time ago I managed to export from PostgreSQL to AutoCAD DXF format a line (LINESTRING) using ogr2ogr program with a PostgreSQL Query, and it works (I can visualise it by the QuantumGIS). Now I ...
0
votes
1answer
93 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 ...
1
vote
1answer
131 views

Aggregate/dissolve MySQL geometry

On Centos, I have a MySQL 5 database with a MyISAM table that has a geometry column with a spatial index, containing US county boundaries. Trying to combine/aggregate/dissolve some of these into as ...
1
vote
1answer
129 views

How to Set the Vertical Coordinate system when creating 3D Shapefile?

I have data of wells in CSV format, which I'm converting to a 3D shapefile, using ogr2ogr. The latitude and longitude are in WGS84, while the depth is from the WGS84 geoid. I have the OSGeo4W ...
0
votes
1answer
22 views

Watching folder for arrival of files to batch process?

Is there a way to maintain a watch on a folder to enable automatic file type conversion? I have a program that dumps DXF files - I batch convert all files to both shapefile and mapinfo format. It ...
0
votes
0answers
29 views

ogr2ogr export to KML from SQLite, when using SELECT for fields Linestrings are lost

I'm using: ogr2ogr -sql "SELECT * FROM 'trails_utm_utf8' ORDER BY name ASC" -f KML trails.kml trails_utm_utf8.sqlite -s_srs EPSG:900913 -t_srs EPSG:4326 to reorder, re-project and export to KML ...
2
votes
1answer
144 views

Natural Earth: How to get the position of all provinces that belong to a state

This question is about Natural earth 1:10 states and provinces.shp file. I'm using ogr2ogr and want to know the name of the id i need to pass . In purpose of pulling out the right states regions. ...
2
votes
1answer
37 views

Removing Empty Geometry with ogr2ogr

I'm running ogr2ogr converting from Shape -> Shape to clean up Shapefiles before they are added to PostGIS via shp2pgsql. The problem I'm encountering is when the Shapefile contains records that have ...
1
vote
1answer
66 views

How can I convert GeoJSON with multiple Polygons and MultiPolygons into single MultiPolygon?

Is this even possible? I have a GeoJSON file with multiple polygons and multipolygons, and I need to set styling on them (in Leaflet.js). I'd like to create a single, large MultiPolygon from the ...
0
votes
1answer
43 views

How to preserve GPX track point (trkpt) info when performing ogr2ogr with sql ST_union operation

I am performing GDAL ogr2org operation with ST_union(Geometry) on tracks from GPX file to split those at intersection points. Track points have elevation and depth info. In GPX track point entry looks ...
0
votes
1answer
26 views

Lost Foreign key during conversion of SQLite to PostgreSQL using ogr2ogr

I want to centralise several small sqlite databases into a single, big, postgresql database. I am using ogr2ogr to convert my sqlite / spatialite (v3.7.17 / v4.1.1) databases, each one consisting of ...
1
vote
1answer
27 views

Only my geometry layers are exported from spatialite to postgis

I have a spatialite database (v4.1.1 / SQlite v3.7.17) consisting of one geometry table and several attribute tables linked to the geometry table by foreign keys. I want to export all tables to a ...
0
votes
1answer
78 views

dealing with geometry that should be geography (bad coordinates)

I'm working on a project with a few publicly available datasets. One of them is from the USGS, it's their prediction of peak ground acceleration in 50 years. Here's a link, and here's what it looks ...
0
votes
2answers
38 views

How can I efficiently divide a KML file by area, while using ogr2ogr?

I have a work process which uses an ogr2ogr text command to convert a MapInfo TAB file to a KML file. I'm very pleased with this because it maintains the original symbology (a simple 2 colour system ...
0
votes
0answers
21 views

Adding a column to several feature classes in a file gdb using ogr2ogr

I'm trying to add the same column to 25 feature classes in an ESRI FileGDB. I managed to do this for one feature class by using ogr2ogr: ogrinfo C:\temp\test.gdb -sql "ALTER TABLE table01 ADD COLUMN ...
1
vote
1answer
29 views

How to calculate the intersection between WFS layer and a PostGIS table

I need to calculate the intersections betweek a WFS layer and the geometries stored in PostGIS table. Then I should save the geometries of the intersections in a separate PostGIS table. Do you have ...
0
votes
1answer
68 views

Passing options to ogr2ogr using python subprocess.Popen

I'm trying to programatically import some shpefiles to postgis, since I need to catch the exit code of the process I decided to use subprocess.Popen. I've managed to import the files using: cmd = ...
0
votes
1answer
31 views

GDAL: Update spreadsheet from polygons in a shapefile

I am a beginner with GIS data, and have been looking for an answer but have not yet found it. I have a spreadsheet with lat/long points. I also have a shapefile with several numbered polygons over a ...
3
votes
1answer
179 views

Debugging ogr2ogr “AddGeometryColumn failed” and “Terminating translation prematurely after failed translation of layer”

As noted in the title, I'm getting the following error: ERROR 1: AddGeometryColumn failed for layer pretty_polys, layer creation has failed. ERROR 1: Terminating translation prematurely after failed ...
1
vote
1answer
31 views

3D rubber sheeting using ground control points

I have 3d lines that I would like to rubber sheet or rectify in 3D (including z rectification). I used ogr2ogr with -gcp, however all the vertex of a polyline were set to a single elevation, and since ...
2
votes
1answer
33 views

ogr2ogr update failing to update shapefile int PostGIS

I have a bunch of shapefiles that I am looping in with a bash script to load and update files but the ogr2ogr fails. I am running gdal 1.92 on ubuntu 14.04. for file in `ls *.shp`;do ogr2ogr ...
0
votes
1answer
63 views

Delete empty attribute columns of 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?
2
votes
4answers
1k views

How to convert KML with tracks to Shapefiles?

I downloaded a KML track from Google Latitude. The service allows to download the tracked route from the user's profile providing a link such as: ...
1
vote
3answers
286 views

Create ESRI shape file with attributes from mySQL

I have some geometry which can be perceived as regions within a country and wish to create a shape file which contains all the regions along with some attributes (e.g. name, population, area code, etc ...