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
3answers
21 views

convert csv to kml or geojson, etc using ogr2ogr (use “latitude” and “longitude” attributes for coordinates)

I've just unsuccessfully tried to use ogr2ogr to convert CSV into KML like so: ogr2ogr -f "KML" output.kml input.csv The csv has "latitude" and "longitude" columns. The attributes are all loaded ...
0
votes
0answers
30 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
32 views

clipping ESRI shapefiles along with shx and dbf

I've seen other answers detailing how one can clip a .shp file with ogr2ogr but this just returns a clipped set of geographic features. I also want to clip the .shx and the .dbf in the same manner. ...
3
votes
3answers
106 views

Plotting Geo Points with “by arc centered at” Instructions

A recent Supreme Court decision redefined the legal boundaries of California along the Pacific Ocean: http://www.theverge.com/tldr/2014/12/15/7397085/supreme-court-california-boundaries-map I am ...
0
votes
0answers
23 views

How can I prevent ogr2ogr from trying to get the SRID from PostGIS?

I'm running ogr2ogr for a PostGIS to GeoJSON export like this: ogr2ogr -s_srs EPSG:4326 -f GeoJSON unique_geoms.json "PG:host=localhost dbname=local_data user=local_user password=local_pass" -sql ...
0
votes
0answers
13 views

PGeo: MDB Tools driver not found

I'm trying to load a Access .gdb(.mdb) database into postgis using ogr2ogr. I'm running Ubuntu 14.04 with gdal 1.10. I've install both unixODBC and mdbtools as per the instructions at ...
1
vote
1answer
52 views

Finding an ogr2ogr equivalent of SelectLayerByLocation

So I'm trying to take individual grid point buffers and only select the regions that the points intersect with (via SelectByLocation). Generally I run the following code to: Explode multipart ...
1
vote
0answers
41 views

Importing 2014 TIGER County Shape Files to 2012 SQL Server?

Last year, I figured out how to import TIGER Census Block shape files into 2012 SQL Server with no issues. I assumed I would use similar code to do the county shape files but I keep getting a few ...
3
votes
1answer
79 views

ogr2ogr window closes after termination

I'm using ogr2ogr for export from PostGIS to FileGDB. It works fine, but after termination the command window closes immediately. Is there a way to keep it open and get some kind of message or report ...
2
votes
1answer
43 views

ogr2ogr + MapInfo TAB + SQLite (SpatiaLite) = unicode problems

I'm adding MapInfo TAB files to SQLite (SpatiaLite) database using those arguments: ogr2ogr -f "SQLite" dataset.sqlite somelayer.tab -dsco spatialite=yes Source file somelayer.tab have ...
2
votes
2answers
62 views

How to export thousands of features from PostGIS to a single GeoJSON file?

I know how to export one feature from a PostGIS database using ogr2ogr: $ogr2ogr -f GeoJSON out.json "PG:host=localhost dbname=xxx user=xxx password=xxx" -sql 'select id, county, wkb_geometry from ...
1
vote
0answers
25 views

Import .gfs file into PostGIS?

Is it possible to import a .gfs file into PostGIS? I can open the .gfs file in QGis, so I assume it is a geographic file of some kind: but I'm not sure how to get it into PostGIS. I have Googled but ...
2
votes
1answer
35 views

ogr2ogr: Can I add a field when I import to PostGIS?

I have a bunch of GeoJSON files that I want to import to a PostGIS database. I can import individual files perfectly as follows: ogr2ogr -f PostgreSQL PG:"host=x user=x dbname=x password=x" ...
1
vote
1answer
32 views

How to define layer style for KML layer within OGR Virtual Format?

I have the following OGR virtual format data source, which includes a few GeoJSON files and one KML file: <OGRVRTDataSource> <OGRVRTUnionLayer name="union"> ...
0
votes
0answers
30 views

error converting shapefile to geoJSON with Ogre online tool

I am using on online tool built with ogr2ogr to convert shapefiles to geoJSON: http://ogre.adc4gis.com/ It's worked well except for one shapefile, and I can't see why... The shapefile has only six ...
0
votes
1answer
17 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 ...
2
votes
0answers
30 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
34 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
20 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
54 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
1answer
40 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 ...
1
vote
2answers
80 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 ...
0
votes
1answer
34 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
32 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 ...
3
votes
2answers
124 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 ...
1
vote
0answers
40 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 ...
0
votes
1answer
19 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 ...
1
vote
1answer
41 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
45 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
50 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
0answers
52 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 ...
2
votes
1answer
57 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
27 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
34 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
47 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
100 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
56 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
40 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
33 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
80 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
44 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
23 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
86 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 = ...
2
votes
1answer
57 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
81 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?
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 ...
1
vote
0answers
47 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" ...
2
votes
0answers
300 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
33 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 ...