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

learn more… | top users | synonyms

1
vote
2answers
42 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
42 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
39 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
9 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
0answers
10 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
29 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
34 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
17 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
27 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
24 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
44 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
27 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
16 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
17 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
41 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
22 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
48 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" ...
1
vote
1answer
26 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
0answers
20 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 ...
0
votes
1answer
55 views

ogr2ogr: Failed to process SRS definition: EPSG:3857. Is this a valid EPSG coordinate system?

I've some trouble with ogr2ogr .... Using the following command .... ogr2ogr -f PostgreSQL -t_srs EPSG:3857 PG:"dbname='postgis_cookbook' user='*' password='*'" -lco SCHEMA=chp01 global_24h.vrt ...
1
vote
1answer
100 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
0answers
49 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
61 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
149 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
47 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
45 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
129 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 ...
1
vote
1answer
39 views

Lost relation when importing from OSM to PostgreSQL with ogr2ogr

I am currently trying to import all administrative boundaries (countries, states, cities, etc) from OSM. I downloaded a small file from Geofabrik (Corsica), in order to run my tests. I understand ...
1
vote
1answer
100 views

In Ogr2OGR: what is SRS?

I am trying to understand this command: ogr2ogr -f "MapInfo File" original.tab wgs84.shp -s_srs EPSG:27700 -t_srs EPSG:4326 I don't understand the s_srs and t_srs paramaters. The help file says ...
1
vote
1answer
99 views

Merge multiple geometry type TAB files in QGIS/OGR

I have a number of vector layers with all types of geometry (point, line/multiline, poly) and I want to combine them into a single layer in QGIS. I know MapInfo can do it but with the other 99% of my ...
1
vote
1answer
57 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
2answers
97 views

Dissolve/aggregate polygons with ogr2ogr or gpc?

I have a large number of polygons representing the boundaries of US counties which I need to merge into as few polygons as possible. Is it possible to do this with non-commercial software, or ...
1
vote
2answers
53 views

Which format to choose to convert to ShapeFiles?

Given the following format options: all.json, all.xml, all.xls, all.csv, all.kml, all.gjson Which one is the best/easiest to convert the data into standard ERSI Shapefiles which contains the ...
0
votes
0answers
27 views

ESRI 3D generate file format to ShapeZ

Can GDAL (ogr2ogr) convert ESRI 3D generate file format (class PointZ, LineZ and PolylineZ) to 3D Shapefiles? The format description can be found here: 3D Formats information. The PolylineZ format ...
1
vote
1answer
95 views

Python ogr2ogr language character encoding

In python script i'm exporting .shp files to .csv/.gpx/.kml import ogr, ogr2ogr ... ogr2ogr.main(["","-f", "CSV", csvfile, shpfile, "-lco", "GEOMETRY=AS_WKT", "-lco", "SEPARATOR=SEMICOLON"]) ...
0
votes
0answers
20 views

From NBM to UWN

Okay, I'll start this off by saying that I'm not a GIS expert by any means. I'm also working with data and places that most people don't work with, but I'm hoping it can be boiled down to basics. I've ...
0
votes
0answers
42 views

Export additional data with ogr2ogr

I am trying to import my ESRI-shapefile with OGR2OGR to an existing mysql table. This works fine but unfortunately only the featureID and the geometry data is exported. How do I add the labels of the ...
1
vote
1answer
198 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 ...
0
votes
1answer
46 views

check if the district belongs to the province

I'm building map viewer using d3js and data from WFS service. In Poland we have 3 levels of administrative divisions: province district community Using WFS service I can get exact boundaries of ...
1
vote
1answer
83 views

When trying to convert an .e00 file into a shapefile with ogr2ogr, getting “ERROR 4: This looks like a compressed E00 file”

When I ran this command: ogr2ogr topo.shp flowe86hyp.e00 I got this error: ERROR 4: This looks like a compressed E00 file and cannot be processed directly. You may need to uncompress it first ...
0
votes
1answer
84 views

Convert from Gauss-Kruger to Bing coordinates / projection

I am trying to convert a shapefile with ogr2ogr from Gauss-Kruger (zone 4) to Bings coordinate system / projection using the advice given in ...
1
vote
2answers
55 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 , ...
3
votes
1answer
53 views

Ogr2ogr does not support file name with non-ASCII character?

I tried to use the following script to convert shapefile to mif: ogr2ogr -f "MapInfo File" D:\docs\arcgis_data\shp_mif\BOU.mif D:\docs\arcgis_data\shp\BOU.shp it works. But I found that if the ...
1
vote
1answer
32 views

Ogr2ogr driver error when convert shapefile to mif [closed]

I use the following script to convert shapefile to mif: ogr2ogr -f "MapInfo File" D:\docs\arcgis_data\shp_mif\BOU.mif D:\docs\arcgis_data\shp\BOU.shp But I got the error: ERROR 6: Unable to open ...
4
votes
1answer
126 views

ogr2ogr: How to specify element type for DXF creation

I am trying to create a DXF from a Polygon Shapefile using ogr2ogr: ogr2ogr -f DXF parcels.dxf parcels.shp The problem is that the polygons are written as hatch elements. How do I specify that ...
0
votes
0answers
61 views

ogr2ogr converting MS SQL Server spatial view to MapInfo TAB -error in datum and encoding

Running this ogr command: ogr2ogr -f "MapInfo File" "D:\V_GeoNode.tab" "MSSQL:Server=xxx\SPECIFIC;Database=db1;UID=xxx;PWD=xxx" -sql "select * from V_GeoNode" -a_srs "EPSG:25832" It returns a ...
0
votes
1answer
62 views

how can the ogr2ogr help to merge a shp file?

I have over 30 shp files which is named "street.shp" into the sub-folder. There is over 30 sub-folders. In the sub-folder, there is another shp files which may be named a building.shp...etc. I only ...
1
vote
2answers
237 views

How to change shapefile longitude from -180 - 180 to 0 - 360?

I have a shapefile of world countries, with longitude between -180° and 180°. How can I change the shapefile (eg. with ogr2ogr) for having longitude between 0 and 360°. Following OSGEO/Trac ...
1
vote
2answers
82 views

sqlite version error with ogr2ogr

I am trying to randomly select some points from a shape file using ogr2ogr and an SQL query via sqlite but it seems to baulk at the sqlite version: ogr2ogr -sql "SELECT * FROM probe_2004to2012 WHERE ...
3
votes
1answer
52 views

New attribute creation using ogr and regex

I've got a folder full of dxf files with elevation values included as part of a long text attribute. I've written a regex expression to extract the elevation value, and would like to add it as a new ...