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
1answer
8 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
47 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?
1
vote
2answers
24 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
21 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
45 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
13 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
1answer
27 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 ...
0
votes
0answers
19 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 ...
1
vote
1answer
45 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
0answers
28 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
23 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
35 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 ...
0
votes
0answers
39 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 ...
3
votes
1answer
29 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
1answer
35 views

ogr2ogr: How to get center point of line?

How to get the center point of a line using ogr2ogr command line? I am unable to get a proper script to get this work.
0
votes
1answer
64 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
35 views

Will ogr2ogr correctly merge features from several OSM files to resulting set

In GDAL >= 1.10, ogr2ogr contains osm driver I want to try this feature and migrate OSM to PostGIS (I'm aware of osm2pqsql existence) I have several relatively small OSM files and wonder if ...
1
vote
2answers
63 views

Convert shapefiles from WGS84 to Miller Projection

I have some shapefiles of the world from Natural Earth at WGS84. I would like to convert them to the Miller Projection. I have ogr2ogr, but I'm not sure what the parameters for this conversion ...
0
votes
1answer
77 views

Add GPX files to postgreSQL database and add one column with a given value

I already found out how to add a gpx track information into my postgres database: `ogr2ogr -append -f PostgreSQL "PG:dbname=your_db user=xxxx password=yyyy" filename.gpx` Everything works fine but ...
0
votes
0answers
74 views

Export GeoJSON to MSSQL with UTF-8 encoding

I'm testing this command to migrate GeoJSON data to MSSQL table: ogr2ogr -f MSSQLSpatial "MSSQL:server=.\SQLEXPRESS;database=geodb;trusted_connection=yes" test.json -nln test It works beautifully, ...
0
votes
1answer
90 views

How to dissolve naturalearth vectordata with gdal?

trying to use the workflow described by @aflaciano at How to render area that crosses 180°? I did the following: 1) downloaded and installed gdal-111-1600-x64-core.msi from ...
1
vote
3answers
120 views

Dismiss invalid Polygons in PostGIS

I Have a massive Dataset from OpenStreetMap and imported it into a Postgres-Database using ogr2ogr. I got several warnings during this process because of multipolygons with too little vertices. Now I ...
1
vote
2answers
66 views

How to align/georeference distorted vector layers in QGIS?

I've got a shapefile which has been digitized from a strongly distorted historical map, and would like to align it as nicely as possible to another precise shapefile layer. The transformation must ...
2
votes
2answers
149 views

Error exporting data from Oracle to shp using ogr2ogr

I have an oracle table which I would like to query/make a selection. I would then like to export the selection to a shp file. I'm using gdal and ogr2ogr. Following the guidelines here and here I ...
1
vote
2answers
123 views

PostGIS to GeoJSON with GDAL: how to get lat/longs?

I'm trying to convert line features from PostGIS to GeoJSON files, as follows: from psycopg2 import * from subprocess import call conn = connect(dbname='gis') cur=conn.cursor() cur.execute("SELECT ...
0
votes
1answer
226 views

ogr2ogr : Converting KML to GeoJson

I have a requirement convert .HML file to GeoJSON or JSON. Can you please recommend open source command line tools on GNU/Linux(2.6.32-358.14.1.el6.x86_64)? I have installed gdal, I am getting beloow ...
1
vote
1answer
85 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
1answer
65 views

Import non spatial data into SQL Server using ogr2ogr

I am trying to import a CSV files in to SQL Server 2012 using ogr2ogr. The spatial data imports without any problems, but I cannot work out why the non spatial tables fail. I can import the data using ...
0
votes
1answer
59 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
77 views

Reproject CSV file to different projecton using ogr2ogr

I have a CSV file "visivisi.csv" with two columns "x,y" which is in my country local projection. The proj4 line is +proj=tmerc +lat_0=0 +lon_0=24 +k=0.9996 +x_0=500000 +y_0=0 +ellps=GRS80 ...
0
votes
1answer
114 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
0answers
18 views

GDal problem: “Unable to open datasource” when I run “ogr2ogr” command [duplicate]

I am trying to load gdb file to postgis, I created a database "test", then run a command using "ogr2ogr". sudo ogr2ogr -f "PostgreSQL" PG:"dbname=test user=postgres" planning.gdb FAILURE: Unable to ...
1
vote
2answers
45 views

ogr2ogr MIF to KML fails on writing kml in linux

I have a bunch of MIF files which I would like to translate to KML format. ogr2ogr -f "KML" geo-mif geo-kml FAILURE: Unable to open datasource `geo-kml' with the following drivers. seems that ...
1
vote
1answer
84 views

Load data to exists table with ogr2ogr

Could I load spatial data to Oracle when table structure was created before this step? Specifically I have problem with default name of attribute OGR_FID . If my primary key has different name, I ...
2
votes
2answers
76 views

How to save python ogr2ogr shapefile to memory, and stream to web client as zip

I'm trying to accomplish something similar to the site http://ogre.adc4gis.com/ I want to be able to manipulate a geojson file, and send it to the client as a shapefile, in a single zip file. I'm ...
0
votes
1answer
40 views

How do I use ogr2ogr with python GDAL? [duplicate]

I've just installed GDAL, but I don't know how to import/use ogr2ogr. I've tried: from osgeo import gdal from osgeo import ogr and searched both for ogr2ogr, but it wasn't there.
0
votes
0answers
17 views

converting from JSON to Shape files [duplicate]

I have a quick question about converting JSON to Shapefile. I'm trying to convert multiple polygon geometry JSON files into a single shape file and I'm not sure what kind of json this is ?[I'm ...
1
vote
0answers
26 views

ogr2ogr giving “ERROR 1: Failed connect to 192.168.4.18:8181; Operation timed out” error?

This is my command, which was working OK yesterday: ogr2ogr -f "GeoJSON" ../geojson/myfile.geojson ../data/gml/myfile.gml -s_srs EPSG:27700 -t_srs EPSG:4326 The output is this: ERROR 1: Failed ...
0
votes
2answers
48 views

Is there any way to use open source tools to make sure that lines on a map dont overlap?

I am a generalist developer getting the hang of basic gis. I made this geojson map by clipping and converting different shapefiles. The problem is that the precincts of New Orleans extend into the ...
0
votes
0answers
47 views

How to use ogr2ogr to remove features from a shapefile using sql statements (Unable to open datasource `action/North' with the following drivers.)

OK, I've spent the obligatory 15-25 minutes on this and haven't gotten anywhere so, here's the command I'm trying to get to work right now: ogr2ogr -f "ESRI Shapefile" -where "area > 4000" ...
1
vote
1answer
81 views

ogr2ogr/python overwrite PostGIS table

Using ogr2ogr command line I can overwrite or append to an existing PostGIS table like: ogr2ogr -f "PostgreSQL"-overwrite PG:"host=myserver port=54321 user=user dbname=mydbname password=mypassword" ...
2
votes
1answer
37 views

How can I see the layers in an .OSM file?

I have an osm file. I am trying to convert it to geojson with ogr2ogr. I get an error that ogr2ogr can't handle multiple layers. How can I tell what layers are in the file and remove them? I see from ...
3
votes
1answer
48 views

How can you prevent ogr2ogr from truncating trailing zeros when setting coordinate_precision=0 and saving to GeoJSON?

This weekend I started using ogr2ogr and discovered that it's a great tool for converting from one spatial reference system to another. I used it to convert a shapefile to GeoJSON, from WGS84 to a ...
2
votes
1answer
175 views

Converting JSON/GeoJSON files to Shapefiles

I have a quick question please about converting JSON/GeoJSON files. I'm trying to convert some JSON files into something I know how to work with (shapefile, R objects or PostGIS). I'm afraid I have ...
0
votes
1answer
94 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 ...
4
votes
1answer
127 views

How do I teach ogr2ogr about a projection?

I have JSON generated from ArcGIS that I want to convert to GeoJSON in EPSG 4326. This fails: $ ogr2ogr -f GeoJSON -t_srs EPSG:4326 out.geo.json in.arcgis.json OGRGeoJSON ERROR 6: EPSG PCS/GCS code ...
2
votes
1answer
403 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 ...
1
vote
1answer
81 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 ...
1
vote
1answer
61 views

If using ogr2ogr to load a PostGIS DB, does the PG string need host and port arguments?

The ogr2ogr command in this question How to Import ESRI Geodatabase format .gdb into PostGIS was missing the host and port arguments, or so I thought. My answer included something like this ogr2ogr ...
0
votes
1answer
279 views

Will MapInfo only read PostGIS data that has been loaded via EasyLoader?

NMZ says in this thread that MapInfo will only read data in PostGIS that has been loaded by MapInfo's EasyLoader. I wasn't sure if this was still the case so I've loaded data into postgis via ogr2ogr ...