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

learn more… | top users | synonyms

0
votes
1answer
14 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
15 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 ...
3
votes
1answer
502 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
142 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
26 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
391 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
31 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
32 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 ...
5
votes
1answer
435 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
121 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 ...
0
votes
1answer
20 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
21 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 ...
1
vote
2answers
257 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 ...
0
votes
1answer
71 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
34 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
15 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 ...
0
votes
1answer
167 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: ...
1
vote
1answer
26 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 ...
1
vote
1answer
118 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 ...
0
votes
1answer
51 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
29 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
128 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
25 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
19 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
44 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
272 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 ...
1
vote
0answers
43 views

Limited number of entities exported with ogr2ogr?

I generate shapefiles with a php script that launches ogr2ogr commands. The ogr2ogr commands look like : "C:\OSGeo4W64\bin\ogr2ogr.exe" --config PGCLIENTENCODING LATIN1 -overwrite -f "ESRI Shapefile" ...
1
vote
0answers
145 views

How to correctly import GeoJSON in PostGIS? [closed]

I'm trying to migrate GeoJSON data to PostGIS database and I thought that ogr2ogr is the tool: ogr2ogr -f PostgreSQL PG:"host={} user={} port={} dbname={} password={}" test.geojson -nln ogr_test ...
0
votes
0answers
27 views

Dxf to Shp - Coordinates wrong

I've converted a dxf file to a shape file using the folowing ogr2ogr command: ogr2ogr -s_srs EPSG:31464 -where "LAYER='0'" -f "ESRI Shapefile" dgm.shp DGM1.dxf Or ogr2ogr -where "LAYER='0'" -f ...
1
vote
1answer
64 views

ogr2ogr reprojection works on command line but shifts output when same command run from inside python?

Reprojection with ogr2ogr works fine on command line, but shifts the polygon to northeast when same command is run from inside python using os.system(...) Any ideas why this could be? I hard-coded ...
1
vote
1answer
57 views

Crop and reproject shapefile based on GeoTIFF sample

I have GeoTIFF with these attributes: Size is 495, 309 Coordinate System is: PROJCS["unnamed", GEOGCS["unnamed ellipse", DATUM["unknown", SPHEROID["unnamed",6370000,0]], ...
2
votes
1answer
36 views

How to rename ogr2ogr tables on export to Spatialite?

I'm exporting data from PostGIS to Spatialite using ogr2ogr. The export is working properly, except I need to be able to rename the tables that are being exported. Here's the command I'm using: ...
2
votes
0answers
40 views

ogr2ogr does NOT save “styles”, say “color”, information; how do I get around it?

I'm using ogr2ogr to convert KML to GeoJSON and I'd like to extract style information along with the data. The bash script I am using is: filekml="/tmp/poly.kml" filegeojson="/tmp/poly.geojson" ...
2
votes
2answers
45 views

shell script ogr2ogr export

I'm writing a simple script to export postgis data to geojson. The ogr2ogr command works well, but I'm having problems when I'm passing the parameters. #!/bin/bash echo 'enter country code' read ...
3
votes
1answer
39 views

Lambert_Conformal_Conic: converting from shapefile to geojson fails

I have a shapefile that also contains a proj file that looks like so: PROJCS [ "MGI_Austria_Lambert", GEOGCS [ "GCS_MGI", DATUM [ "D_MGI", ...
3
votes
1answer
72 views

Moving SpatiaLite Table into PostgreSQL using ogr2ogr?

How can I move a Spatialite table from a Spatialite db to a PostgreSQL db using ogr2ogr?
2
votes
2answers
2k views

How do you open shapefiles with ogr2ogr

I'm following along the D3 tutorial, and on this line: ogr2ogr \ -f GeoJSON \ -where "adm0_a3 IN ('GBR', 'IRL')" \ subunits.json \ ne_10m_admin_0_map_subunits.shp run into the following ...
0
votes
0answers
47 views

Copy Z-coordinate from S57 SOUNDG to Shp

I'm trying to create a shapefile from an S57 SOUNDG Layer, where i want to put in in a separate column the Z-coordinate of the SOUNDG Layer in the resulting Shapefile....any ideas on how to achieve ...
1
vote
2answers
46 views

How to restore gdalinfo metadata after ImageMagick processing?

I first print out the file info : $gdalinfo crop.origin.tif result: + gdalinfo crop.origin.tif Driver: GTiff/GeoTIFF Files: crop.origin.tif Size is 1920, 1950 Coordinate System is `' Origin = ...
1
vote
0answers
33 views

QGIS crashes when trying to display features form MySQL

I import shapefiles into MySQL using the following command: ogr2ogr -f MySQL MySQL:GIS,host=localhost,user=root,password=root /home/user/Public/myshape.shp -nln Shape_table -update -overwrite -lco ...
1
vote
1answer
77 views

Convert GML to DXF using ogr2ogr

I cannot make ogr2ogr.exe work. I'm using GDAL 1.11. I keep getting the following error message: ERROR 1: Did not get at least 2 values or invalid number of set of coordinates 709993.98 ...
1
vote
0answers
35 views

ogr2ogr “Error: pointer being freed was not allocated” on mac mavericks

I've successfully installed GDAL via homebrew on mac But while I'm using command ogr2ogr, keep getting error below $ ogr2ogr -f geoJSON tl_2010_20_tract10.json tl_2010_20_tract10.shp ...
2
votes
0answers
54 views

How to export postgis points as blocks in dxf with ogr2ogr

I'm trying to export postgis points as blocks to DXF format. I have a simple table in postgis with columns: CREATE TABLE pod_com_azimuth ( ogc_fid integer, rotation double precision, pointtype ...
2
votes
1answer
96 views

Merge multiple linestring features into a single multilinestring

Using QGis or ogr2ogr how do I convert a vector file containing multiple linestrings features into a single multilinestring feature? At the moment I've been doing this manually by converting the data ...
1
vote
2answers
104 views

How to update polygon longitude if negative?

I have a polygon, with longitude in [-180, 180], with 2 parts around the dateline. I want to make a map centered on the date line. My plane is to: 1./ update the longitude, so that if lon < 0 , ...
1
vote
1answer
31 views

How to connect to CouchBase with ogr2ogr?

I am trying to load a Shapefile to CouchBase (version: 2.5.0 DEV edition, installed on Ubuntu), but with no success. According to this documentation it is possible like this: ogr2ogr -f couchdb ...
0
votes
1answer
42 views

ogr2ogr - Looping through files in a folder on a Mac

I am attempting to use OGR2ORG on Mac OS X to loop through 30 shapefiles, change their projection and save the files into a new directory. I am new to using Macs and the OGR2OGR command line ...
3
votes
1answer
43 views

ogr2gui geojson to csv do not export coordinates

I tried to convert ogr2gui to convert geojson files to csv. The geojson file contains point data only. The resulting csv only contains attribute data, no coordinates. Is there a way to get the ...
0
votes
0answers
54 views

How can you calculate the union/merge two polygons in ogr2ogr?

I want to calculate the union/merge two overlapping polygons using ogr2ogr (as I have 300+ to do). I want the output to be the same as you would get if you used the 'Merge shapefiles to one' command ...