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
347 views

Converting mixed mapinfo tab files

Hi I need a little help/ ideas on how to convert tab files. The problem: I have many TAB files produced daily by 3 party app, I need to batch import the files into postgres. Most files import fine, ...
0
votes
1answer
246 views

ogr2ogr extract shp-file by extent with bash script

I'm batch extracting features from shp-files in a directory with this bash script: Is there a way to avoid the loop? I somewhere read that you can process folders but I was not able to get the right ...
3
votes
2answers
177 views

Is it possible to create CAD file from shapefile and also create CAD blocks from the database fields

I am trying to find out if there is any software or plugin/code that I can bundle that will take a shapefile and export it to a CAD file with CAD blocks generated so our CAD mappers can just move the ...
3
votes
1answer
466 views

Export KML ExtendedData with OGR2OGR

I would like to export with ogr2ogr the data I have in a kml as ExtendedData <Placemark> <ExtendedData> <SchemaData schemaUrl="#15540_punti"> ...
1
vote
1answer
79 views

BBox missing when converting TIGER to GeoJSON

I can't get the bounding boxes of polygons if TIGER/Line shape files when converting them to GeoJSON using FWTools. The other default information is present and there is no difference between the ...
1
vote
3answers
134 views

Why is ogrinfo showing no layers from an ESRI FileGDB?

I have an ESRI File Geodatabase (FileGDB) (size is 15+GB), which has over 10 layers, when I open it up in ArcGIS, everything seems to be working. I want to move this database to postgreSQL with OGR ...
0
votes
2answers
1k views

How to move and open shapefiles with ogr2ogr?

I'm a total newb following along the d3 map tutorial. at this line: ogr2ogr \ -f GeoJSON \ -where "adm0_a3 IN ('GBR', 'IRL')" \ subunits.json \ ne_10m_admin_0_map_subunits.shp I get ...
5
votes
4answers
2k views

How to convert multipoint layer to point

I have a Spatialite layer which is multipoint (following a QGIS Save As from shapefile). I need it to be PostGIS and POINT. I have tried ogr2ogr -nlt POINT and got 'new row for relation "xxx" violates ...
2
votes
1answer
489 views

Can you explain this WKT multipolygon format?

I am confused by the output I'm getting from ogr2ogr when converting a shapefile to WKT. What I'm expecting to see is something in the form below (from Wikipedia): MULTIPOLYGON (((40 40, 20 45, 45 ...
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. ...
3
votes
1answer
673 views

Setting geometry types importing to PostGIS with OGR

I'm using ogr2ogr to import data into a PostGIS database. Each dataset I need to import has (theoretically) the same exact data structure, but it appears that they are not the same geometry types. ...
2
votes
1answer
300 views

Converting from shp to geojson fails

I'm following Mike Bostock's tutorial, let's make a map, but for a map of Mexico. I want to display state boundaries. I was able to get the map of Mexico from Natural Earth Data's world maps. My ...
1
vote
0answers
288 views

How to import 3D geometries from DXF, VRML or X3D into PostGIS 2

we plan to develop a webbased 3D GIS using PostGIS 2 and GeoServer with a W3DS. The architecture works fine, but i have problems to import 3D geometries into PostGIS. The geometries come from AutoCAD ...
1
vote
1answer
71 views

How does ogr2ogr determine which transformation to use and how big would the introduced error be?

I want to convert TIGER data GEOGCS["GCS_North_American_1983", DATUM["North_American_Datum_1983", SPHEROID["GRS_1980",6378137,298.257222101]], PRIMEM["Greenwich",0], ...
2
votes
3answers
662 views

Ogr2Ogr SQLite Geometry Functions

I believe title is all clear.I'm using Ogr2ogr utilities & binaries to read geometry. I used something like this: ogr2ogr -f "SQLite" test2.sqlite test.sqlite -sql "SELECT ...
1
vote
1answer
159 views

Ogr_wrap problem

I'm having problems with my csharp project in developing a console application.I've added references of ogr_csharp.dll & osr_csharp.dll & gdal_csharp.dll. In the line Ogr.RegisterAll(); ...
3
votes
0answers
144 views

How do I clip Geojson FeatureCollection with another Geojson polygon

I have a GeoJSON file that contains one FeatureCollection with a bunch of features that are polygons. I also have the boundary of the continental USA in another GeoJSON file. I'd like to clip the ...
1
vote
1answer
245 views

Projecting shp from GK3 to UTM32 with BeTa2007

I've experimented with projections of shapes, used the official provided grid beta2007 for germany and noticed differences between transforming by double exporting over custom CRS in QGIS and ...
2
votes
1answer
350 views

How to debug ogr2ogr ERROR 1: Did not get at least 2 values or invalid number of set of coordinates?

I'm trying to convert a government data contour GML (http://geo.data.linz.gv.at/katalog/geodata/hoehenschichten/2011/1m-Hoehenschichten.gml) to Shapefile. It seems like it was created by FME: ...
3
votes
1answer
327 views

Does ogr2ogr Convert from PostGIS to File Geodatabase (FGDB_BULK_LOAD YES) work?

I am trying to export a lot of data from a PostGIS database to a File Geodatabase. The command I used to use was ogr2ogr -progress -append -f "FileGDB" -gt 66536 -sql "SELECT * FROM line" ...
4
votes
1answer
754 views

Can't export a polygon shapefile to MySQL using ogr2ogr?

I am having problems with ogr2ogr and keep getting different versions of the error: ERROR 1: MySQL error message: The used table type doesn't support SPATIAL indexes. Description: ALTER TABLE ...
2
votes
1answer
981 views

How to use non-native spatial data from MS SQL Server with ogr2ogr?

I have some tables in MS SQL Server (2012) with WKT string columns. I want to export these data to a MapInfo tab file. Currently I am using the following command: ogr2ogr -f "MapInfo File" ...
2
votes
0answers
223 views

How to convert shapefile to mapinfo file preserving special characters?

I have to convert a bunch of shapefiles to mapinfo files on a machine without a MapInfo license, so I am using ogr2ogr to perform this task. The problem is that when opening the mapinfo files in ...
0
votes
1answer
94 views

Should a GDAL Plugin be the same version as GDAL aready built into QGIS

Should a GDAL Plugin be the same version as the GDAL that's aready built into the QGIS version installed? Or,can another different version of GDAL be built and it installed as a Plugin for QGIS, ...
3
votes
1answer
457 views

ogr2ogr from Postgres to GeoJSON missing crs key

I'm using ogr2ogr to convert some OSM data for Greenland (not really important for the question), from a PostGIS database to a file containing GeoJSON. The problem is that the GeoJSON gets written ...
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 ...
4
votes
1answer
287 views

Can ogr2ogr be used to append multiple DBF files?

Can ogr2ogr be used to append multiple DBF files? It works with SHP files, but I can't see how to do it with DBF files on their own. It ought to be possible, considering DBF is a subset of SHP.
3
votes
2answers
1k views

How did QGIS fix a shapefile's character encoding, and can I do this on the command line with ogr2ogr?

Solved: I'm not sure why, but it works fine if I specify --config SHAPE_ENCODING "ISO-8859-1" in my ogr2ogr command. For whatever reason, this allowed ogr2ogr to go from the original TigerLine ...
4
votes
1answer
3k views

How to re-project shapefiles?

I wanted to re-project a QGIS project, but there is no such option. When searching for an answer I see ogr2ogr suggested for this task, by re-projecting each vector layer (shapefile in this example). ...
2
votes
2answers
632 views

What can go wrong in UTM to WGS1984 conversion (shifted data)

I try to convert .shp files to OSM data with shp2osm and ogr2osm but the output data is shifted. Semi-Cross-Posting Warning: I have already asked a questions on the OSM help site, but this questions ...
8
votes
2answers
1k views

How to reduce the file size of GeoJSON data?

For my project I am trying to convert the tiger shapefile information for us states into GeoJSON format However when I use the ogr2ogr tool the data file is about 20 MB. I have seen the geoJSON file ...
3
votes
1answer
400 views

ogr2ogr / GDAL remove features in FileGDB while in use by ArcGIS Server map service

I'm using ogr2ogr to pull features out of Oracle and put them into a File GeoDatabase. The FGDB is being used by an active ArcGIS Server map service. This is all done for performance / reducing DB ...
2
votes
1answer
210 views

Ogr2Ogr: Failed to create GPX file output.gpx

When i try to export an shapefile to gpx using ogr2ogr. ogr2ogr -f GPX output.gpx D:\mypaste\input.shp -sql "SELECT Id AS name FROM layername" It gives me the following error "Failed to create GPX ...
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 ...
5
votes
2answers
533 views

OGR to read from oracle, and then write a CSV

I need to read an Oracle (not spatial) table with OGR. I have no problem with ogrinfo. I use this command: ogrinfo -ro OCI:user/password -sql "select * from HR.EMPLOYEES" I have this kind of ...
3
votes
2answers
497 views

Why does Ogr2Ogr Postgres import fail?

I have a lot of S57 files that need to be imported to PostgresDB. The process takes over 2 hours. In order to improve performance, I have tried using PG_USE_COPY to use copy instead of DB inserts. I ...
10
votes
3answers
5k views

How to create a GeoJSON that works with D3?

I'm simply trying to convert a .shp file to a geoJSON format using: ogr2ogr -f geoJSON output.json input.shp After executing the command nothing seems to be wrong. Here's an excerpt from the ...
2
votes
0answers
397 views

Ogr2ogr: Unable to open datasource problem

I downloaded the Precints shapefile from the City of Boston's data hub, and I'm trying import it into SQLServer (I'm running the Express verson). I've already created the database in the SQLServer ...
3
votes
4answers
3k views

How do I use ogr2ogr to convert a GML to shapefile in Python

I am trying to convert a GML to an ESRI shapefile using ogr2ogr utility in a python script. I have successfully installed the GDAL/OGR package via osgeo but I am now struggling to find/understand ...
5
votes
1answer
1k views

OGR Shapefile to CSV: Using Python to get WKT for multipart Polys.

Using ogr2ogr and python, I'm running into a wall with trying to create a csv with WKTs for a shapefile that contains multipart polygons. Currently this is this code I'm using (found it on interweb): ...
2
votes
1answer
1k views

Shapefile to MSSQL with ogr2ogr fails to make connection

I am using ogr2ogr from OSGeo4W on my Windows 7 box to import a shapefile into a SQL Server database on one of my servers. I was able to successfully complete the conversion using shp2sqlserver, but I ...
5
votes
1answer
2k views

Importing KML in QGIS - what are all the node elements that QGIS looks for other than Name and Description?

Of all elements given at (ref: http://service.kmlvalidator.com/ets/ogc-kml/2.2/) only Name and Description seem to be recognized on importing KML using QGIS 1.8.0-Lisboa. I would like to know if this ...
0
votes
1answer
994 views

How current is GDAL in Java

I have used the ogr2ogr to import various formats to Postgres and have used GDAL utilities. Is there a complete Java port for these tools? Or are they simply wrappers calling JNI to C++ code? I have ...
3
votes
2answers
1k views

merge shapefile using ogr2ogr and retrieve the attribute of both

Ciao, I have two shape files that I want merge (overlay/intersect) having in the destination the attributes of the two sources file. ogr2ogr file_merged.shp tl_2010_us_uac10_conus_albersUA.shp ...
0
votes
1answer
688 views

Ogr2Ogr doesn't work with QGIS 1.8

I'm trying to use Ogr2Ogr.exe to import some shapefiles. It came installed with QGIS 1.8. When I try and run it, i get the following error: C:\Program Files (x86)\Quantum GIS Lisboa\bin>ogr2ogr ...
3
votes
1answer
498 views

Change Layer name when converting from GeoJSON

I am converting GeoJSON files to other formats (including KML) using ogr2ogr. As you may know, there is no field in a GeoJSON file to specify the name of the layer, causing every conversion to have ...
9
votes
5answers
2k views

How can I update ogr2ogr to include the PostgreSQL driver?

I'm trying to use ogr2ogr to upload a shapefile to a remote PostGres installation. When I ran this command: celenius:~ celenius$ ogr2ogr -f PostgreSQL PG:"host=255.34.00.00 user=postgres dbname=mydb ...
6
votes
1answer
4k views

How to import KML file, with custom data, to Postgres/PostGIS database?

By custom, I don't mean a different structure of KML file, but in <description></description> section, I have data with HTML tags of this kind: <?xml version="1.0" ...
2
votes
1answer
314 views

GDAL 1.9.1 ogr2ogr KML to PostGIS not incuding ExtendedData

I have a KML file utilizing a Schema in the document and ExtendedData in each placemark. The ExtendedData does not seem to pass in conversion to PostGIS or shapefile. Any assistance would be much ...
1
vote
0answers
163 views

Trying to use OS Translator plugin and cant find ogr2ogr.exe

I have installed the OS Translator plugin from the Faunalia Repository but when I try to use the plugin I get a "Can't find ogr2ogr[.exe], can't continue" error message. I have tried reinstalling the ...