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

learn more… | top users | synonyms

3
votes
2answers
53 views

How to have GDAL print layers of GeoPDF AND say which are raster vs vector

My Objective: I would like to use GDAL to convert a GeoPDF. I want the vector layers as shp files and the raster layers as tif files. I want to do this in a programmatic way. Edit: In reality, I ...
0
votes
0answers
25 views

Problem importing sqlite into Postgres (with PostGis) using ogr2ogr

I am trying to import a very large sqlite file into Postgres SQL 9.3. The first tool I tried to use was OGR2GUI (http://www.ogr2gui.ca/). The 64 Bit version does nothing, whilst the 32 bit version ...
1
vote
0answers
12 views

Error trying to import data to CartoDB using ogr2ogr

I have a local install of CartoDB in my Ubuntu 14.04. I have created a CartoDB account called "development" and been playing with it for a while. Now I'd like to import some data from a shapefile ...
0
votes
1answer
31 views

Spatial query ST_CONTAINS returns empty result

I want to create a database view in Postgres/PostGIS which returns a subset of the points stored in another table called locations. The subset is defined by an area stored in yet another table called ...
1
vote
0answers
19 views

How to install CartoDB driver for ogr2ogr?

I'm trying to import data from my postgis DB directly into CartoDB. I've seen in this forum's post that I can do that with ogr2ogr, a GDAL tool, in this way: ogr2ogr -t_srs EPSG:4326 --config ...
1
vote
0answers
20 views

ogr2ogr: export intersected gml using shapefile

I'm trying to do the same as the ogr2ogr example given by http://gis.stackexchange.com/a/119404/6458 The difference is that my inputs are a GML and a shapefile. Export.shp should only contain the ...
2
votes
1answer
52 views

Execute ogr2ogr from python

I tried to execute ogr2ogr from python with this shell command: ogr2ogr.exe --config PG_LIST_ALL_TABLES YES -f "PostgreSQL" -append PG:"host=hostnamet user=username password=password dbname=dbname" ...
2
votes
2answers
28 views

Using “ogr2ogr -sql” without an input fiile

Lets say I just wanted to turn WKT to GeoJSON on the command line I could do this: /opt/gdal-custom/bin/ogr2ogr -f CSV /vsistdout/ foo.sqlite \ -dialect sqlite \ -sql "SELECT ...
0
votes
0answers
37 views

Speeding up a GDAL SQL query with indexes or different file formats

I have a query that I'm performing with python and OGR2OGR similar to this: /opt/gdal-custom/bin/ogr2ogr -f CSV /vsistdout/ foo.shp -dialect sqlite -sql "SELECT A, ...
1
vote
0answers
42 views

Using a ShapeFile spatial index with ogr2ogr and ogr.DataSource.ExecuteSQL()

I created a spatial index foo.qix for a foo.shp with ogrinfo -sql "CREATE SPATIAL INDEX ON foo" foo.shp However, when I do a query with ogr2ogr and look at it in strace, it doesn't use that index: ...
1
vote
2answers
62 views

Using ST_Intersects in OGR2OGR

I'm running GDAL 1.11.2, released 2015/02/10. The following displays all the attributes in my shapefile on stdout: /opt/gdal-custom/bin/ogr2ogr -f CSV /vsistdout/ foo.shp -sql "SELECT * FROM foo ...
1
vote
0answers
6 views

Include <link> in GPX when writing from ogr2ogr

http://www.gdal.org/drv_gpx.html seems to indicate that ogr2ogr should be able to write <link>[1] elements into a GPX file, however when using ogr2ogr to convert from PostGIS to GPX, I get the ...
0
votes
1answer
28 views

Importing data to CartoDB using ogr2ogr

First attempt, I want to create a table at CartoDB from another Postgis database: snow:Docker-Postgis alasarr$ ogr2ogr --config CARTODB_API_KEY daf3960b41733ef71e03ea77019642761d547f5b -f CartoDB ...
1
vote
1answer
64 views

File Conversion using ogr2ogr gui

I have used 'ogr2ogr' for ESRI shape files conversion to Mapinfo tab files, but issue is that as soon as I open those converted .tab files over Mapinfo, the software stop working with a message ...
1
vote
2answers
48 views

OpenStreetMap boundary relation lost when exporting to spatialite with ogr2ogr?

I am currently working in map for a province of Papua New Guinea. In OpenStreetMap (OSM) I have recently updated and added new relations for boundaries of admin_level=5 and admin_level=6, which were ...
1
vote
1answer
45 views

ogr2ogr from personal geodatabase to spatialite produces “non-spatial” tables

I have around 4 GB of data in 10 separate Personal Geodatabases, each of which contains multiple feature classes. I'm trying to convert the smallest one to SpatiaLite via ogr2ogr, in preparation for ...
2
votes
1answer
41 views

Reproject X coord value in Shapefiles

I convert Bavarien NAS-Data (DHDN 3 Degree Gauszone 4) via ogr2ogr into shapefiles: "C:\Program Files (x86)\QGIS Wien\bin\ogr2ogr.exe" "ESRI Shapefile" -skipfailures Entenhausen.xml This seems to ...
0
votes
0answers
22 views

Can ogr2ogr “reverse clip” (or “clip out” or “erase” or “difference”) one shapefile from another? [duplicate]

Is there a means in ogr2ogr to "clip out" one shapefile from another? I know ogr2ogr -clipsrc B.shp out.shp A.shp will remove any part of A.shp that is NOT in B.shp. Is there an ogr2ogr command to ...
0
votes
0answers
38 views

QGIS 'Save As' Reprojection Produces Different Results from ogr2ogr command line

Another 3857 vs 4326 question. When I reproject from EPSG:3857 to EPSG:4326 (and from .shp to .geojson) via the QGIS 'Save As' dialog, I get results that display in the expected place on Google Maps. ...
1
vote
0answers
46 views

How to clip a big shapefile from another shapefile's extent

I am working on mangroves in Sundarbans (Bangladesh / India), using Landsat pictures. I need to equalize them in reflectance, before classification, for the evolution of the biomass in this region. I ...
1
vote
0answers
68 views

How to import UTF-8 encoded Shapefiles into SQL Server?

I am trying to load a shape file to sql, using ogr2ogr and Shape2SQL tools. The shape file uses UTF-8 encoding, specified in a .cpg file, and confirmed when opening the file with QGIS. However, as ...
0
votes
0answers
58 views

ogr2ogr failing to open/convert GML

I'm trying to convert a GML file into GeoJSON using ogr2ogr, I've compiled GDAL, Expat and Xerces from source, but when I run my command I get an error. My convert command ./ogr2ogr -f "GeoJSON" ...
0
votes
1answer
57 views

Keeping Properties When Converting JSON to SHP

I'm trying to convert the Nielsen map of DMAs from a JSON to a shapefile. The properties of the json is as formatted like this: "id": 546, "properties": { "name": "dma:", ...
0
votes
1answer
37 views

Filter OGR datasource in Python (or XML)

I'm trying to streamline the process whereby we build tiles (of ~30 layers, representing planning zone and zone-overlay boundaries). I have a strong preference for FOSS tools. A couple of our people ...
0
votes
0answers
39 views

Can styling be applied to a kml (from a shp) using ogr2ogr

Is it possible to generate a styled KML using ogr2ogr (ie pen width and colour?) I cannot seem to find anything in the ogr2ogr documentation. My code so far is; ogr2ogr.exe -f "KML" prow-kml.kml ...
1
vote
2answers
68 views

Running the ogr2ogr utilities in a batch file. Problems with command project

I have made a batch file containing a list of two commands. The first (-clipsrc) works properly, but the second not (-s_srs EPSG:4326 -t_srs EPSG:3857). Could anyone tell me where is the fail?. This ...
2
votes
0answers
43 views

How to clip or erase a csv file with a non-rectangular shapefile?

I can clip a csv file with a ogr2ogr having 4 extents of a rectangular polygon. Is it possible to clip a csv file with a non rectangular shapefile?
0
votes
1answer
69 views

ST_Intersect with ogr2ogr and Spatialite

I am trying to intersect Spatialite datasets with ogr2ogr, the OGR Virtual Format and SQL Syntax. I can't seem to locate whether the error is in my SQL query or my VRT file. Data ...
0
votes
0answers
28 views

Merging polygons in SHP

Is it possible to merge polygons, using ogr2ogr cmdline tools? I.e. taking a SHP file and generate a new one, where records are merged when a field has the same value?
3
votes
2answers
191 views

How to make a local copy of a large WFS dataset?

We are writing a application in which a part of the job is to fetch a relatively large (>10000 features) and often updated dataset from a WFS server, store a local copy, and do geospatial analyses on ...
1
vote
1answer
44 views

ogr2ogr does not set osm_id for all multipolygons

I used ogr2ogr to convert from osm data (pbf) to spatialite : ogr2ogr -progress -f SQLite -dsco spatialite=yes france.simple.spatialite france-latest.osm.pbf then, a large part of the imported data ...
1
vote
1answer
57 views

GDAL does not recognize EPSG code of a shapefilefile regrojected by ogr2ogr

I am using ogr2ogr to reproject shapefiles. For example: ogr2ogr -s_srs EPSG:1234 -t_srs EPSG:3857 dest.shp srs.shp ogr2ogr then creates dest.shp, dest.shx, dest.dbf and dest.prj as expected. The ...
0
votes
1answer
55 views

How to export Extent as shapefile from multiple shapefiles using OGR?

I want to export EXTENT as Rectangular shp file from multiple shape using OGR2OGR?
1
vote
2answers
83 views

Extracting difference between two massive shapefiles using QGIS?

I have two massive shapefiles and I need to create a difference shapefile output between the two. I have a layer where I have satellite coverage (orange) and then a layer where I have high resolution ...
0
votes
0answers
58 views

ogr2ogr converting ESRI shape to Mapinfo interchange

I'm trying to convert .shp files to .mif files on Ubuntu Linux using ogr2ogr: "ogr2ogr -f "MapInfo file" -dsco FORMAT=MIF mprec.mif mprec.shp" I don't get any errors but when I open the resulting ...
1
vote
0answers
34 views

ogr2ogr latitute longitude conversion formats

trying to convert shape files into mysql tables. Able to create table and load data successfully using OGR2OGR. Only challenge I see is latitude/longitude is not exactly the same format as one of my ...
2
votes
1answer
56 views

Perform affine transformation on shapefile with OGR, GDAL, or other command line tools?

Transformations with WKT or EPSG code are made easy with ogr2ogr, but are there tools for me to define my own affine transformation to apply to the coordinates of a shapefile? Or, in general, is ...
3
votes
1answer
65 views

ogr2ogr postgres import: check if dataset exists

I have a PostGIS database which I update daily with ogr2ogr using CSV files. This works great. Is there a way to check whether the actual value of a column already exists in the table (e.g. ...
3
votes
1answer
32 views

Reprojecting to same srs shifting the layer

I am using ogr2ogr to reproject a shapefile. Here is what I have done. I have a shapefile A.shp. I used the following command to create B.shp: ogr2ogr -t_srs EPSG:3857 B.shp A.shp Now I reprojected ...
0
votes
1answer
94 views

How to set encoding when using ogr2ogr to export from oracle db to mapinfo table?

I am trying to automate the export of spatial data from a oracle database to mapinfo .tab files. Using this thread I made my script. However I can't see how to set the encoding right. My data have ...
1
vote
0answers
59 views

Suppress verbose output when something goes wrong with ogr2ogr

Whenever ogr2ogr is not able to read a file, it seems to produce pages of output: Unable to open datasource `file.geojson' with the following drivers. -> ESRI Shapefile -> MapInfo File ...
1
vote
1answer
130 views

How Does Ogr2Ogr Simplify Work?

Can someone explain how the ogr2ogr simplify works? I am trying to use raster data which has a spectral resolution of 30m. The vector file that I am trying to import into Google Fusion is large in ...
1
vote
1answer
53 views

How to convert from .shp to .csv using python and either gdal_translate of ogr2ogr

I am trying to convert .shp files to csv using either gdal_translate or ogr2ogr and python but its not work. if i run the following from qgis its not giving an error but at the same time its not ...
0
votes
0answers
19 views

Different KML size from ArcGIS and Ogr2Ogr

I have been converting shapefiles to KML. It seems that using ArcGIS to make a KML (by converting shapefile to feature layer and then using feature layer to kml tool) results in a much larger sized ...
3
votes
1answer
50 views

How do I call ogr2ogr from a C# application?

I have an ogr2ogr (GDAL) command that I run to export points from a database to an XML file. ogr2ogr-f GPX c:\temp\points.gpx PG:"host=localhost port=5432 dbname=SpatialPlayground schemas=public ...
1
vote
1answer
868 views

How do I resolve “relation does not exist”

I have a view, named PointsForGpxExport, that contains points I want to export to a GPX file. The ogr2ogr command I'm trying to use for the export is included below. When I run the command, a GPX file ...
1
vote
2answers
177 views

Reducing Size of KML file (After converting from Shapefile)

I have a shape-file of size 224 mega byte. I am using ArcGis to convert it to a KML file. The process involves converting the shapefile to a feature layer and then converting the layer to KML. An ...
0
votes
0answers
30 views

How to convert dc to shp with free software?

Someone can tell me how to convert data from a .dc file (DesignCAD file) to a shp file or postgresql with free softwares? I can do that easily with all versions of dxf or dwg files but not with dc.
0
votes
0answers
47 views

ogr2ogr re-projection produces empty shapefile

I use the following to re-project a shapefile to EPSG 4326 using ogr2ogr: ogr2ogr -s_srs "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" -t_srs "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" ...
0
votes
0answers
15 views

OGR2OGR converting Interlis to Shapefile fails

I tried an convert of a Interlis 1 file to Shape. For each table there is the following warning: Warning 1: No field definition found for table: Biens_fonds__PosPoint_limite I used different ...