The OGR Simple Features Library is a C++ open source library (and command line tools) providing access to vector file formats.

learn more… | top users | synonyms

1
vote
2answers
32 views

Comparing projections of two datasets when SRID not available

Similar to this question: How to test if two GDAL datasets are in the same projection? However, the above does not cover cases where an SRID is not available. It can often be the case that an SRID is ...
0
votes
1answer
248 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 ...
5
votes
1answer
176 views

How can I get Google Fusion Tables to work in QGIS?

I am using GDAL/OGR 1.10 and QGIS 2.0.1. I am trying to load a google fusion table into QGIS using the method mentioned in this blog post. The only difference is that I am not declaring a email and ...
1
vote
1answer
81 views

How can I use the proj string in java code?

I want to do projection from UTM/oblique mercator CRS to WGS84. And I know the solution to use a proj.4 string in commandline like+proj=omerc +lat_0=51.4 +lonc=7 +alpha=-10 +k=1 +x_0=0 +y_0=0 +gamma=0 ...
1
vote
0answers
84 views

How to compile QGIS with Oracle Spatial support for Linux?

I compiled it on Fedora and Ubuntu, but got error "Cannot get Oracle select dialog from provider." while trying to add Oracle layer. Packages in repositories don`t have oracle spatial support. Can ...
1
vote
1answer
161 views

Why does OGR driver.Open() for File Geodatabase give AttributeError: NoneType object has no attribute Open?

There are a number of existing Questions that hint at a possible Answer to this Question, but none seem to be providing me with the solution to my problem: How to access feature classes in file ...
0
votes
1answer
37 views

Debug/Improve Performance of GRASS v.in.ogr

I'm trying to import shapefiles (in this case, OpenStreetMap data) into GRASS (grass70-svn) using v.in.ogr; and it is painfully, brutally slow. At first I thought this was because I was using the ...
2
votes
2answers
110 views

Can I use the LEFT (string) operator in ExecuteSQL()?

In QGIS I can use the LEFT operator on a dataset like this: LEFT( "Name2",3) ='031' What is the syntax for using this expression with ogr in python? Isn't this the right syntax? ...
1
vote
1answer
392 views

OGR Layer Intersection

I am using what I would describe as the most primitive method of doing intersection with OGR. The short script below describes how I do it. Is there a best way of doing this? from osgeo import ...
0
votes
1answer
180 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 ...
2
votes
1answer
85 views

How can I delete a shapefile using OGR?

In my QGIS Python plugin, I use shapefile layers and I am having a problem rewriting existing shapefiles. Is it possible to delete a shapefile from disk using OGR?
2
votes
3answers
113 views

Shapefile with overlapping polygons: calculate average values

I have a very big polygon shapefile with hundreds of features, often overlapping each other. Each of these features has a value stored in the attribute table. I simply need to calculate the average ...
1
vote
2answers
59 views

Ogr2ogr - shape to postgis - is there a way to use and preserve an existing primary key?

I've been struggling with this for a while, tried a few different ideas inspired by these pages: http://www.gdal.org/ogr2ogr.html http://www.gdal.org/ogr/drv_pg.html ...
0
votes
2answers
346 views

OS X Mavericks: accessing GDAL from Terminal issue

I successfully installed QGIS on my iMac with OS X 10.9.1 Mavericks using the installers provided by Kyngchaos. However, I'm having troubles accessing GDAL / ogr from terminal. It's giving me the ...
2
votes
2answers
58 views

How to get EPSG with OGRinfo?

Is it possible to get the EPSG code of a shapefile with ogrinfo? I know I can get layers SRS WKT with ogrinfo -so -al stands1.shp, but I am looking for the EPSG code.
1
vote
2answers
90 views

Difference between OGRGeometry and Geometry in C++ and python

According to the documentation, there is a python version of OGRGeometry's C++ class (http://www.gdal.org/ogr/classOGRGeometry.html) which is http://gdal.org/python/osgeo.ogr.Geometry-class.html ...
5
votes
1answer
155 views

ogr2ogr csv conversion with latlon in one column

I have a csv with "lat\,lon" in a single column. I am trying to convert it with ogr2ogr to another format, and cannot figure out how to format the VRT file to accept this format. I cannot do ...
0
votes
1answer
114 views

How to use ogr2ogr for batch conversion? [duplicate]

I have a thousand of arc coverage would like to covert to shapefile. How can I use the ogr2ogr to convert it in batch rather than convert it one by one? It takes a lot of time! :( Thanks for any idea! ...
1
vote
2answers
493 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
1answer
379 views

OSX 10.9 + QGIS 2.0.1 - Missing osgeo module

Running the following: QGIS 2.0.1 (via Kyngchaos) OSX 10.9 GDAL/OGR 1.10.1 (via Homebrew). Recently, I've become unable to use the OpenLayers plugin, which is complaining that I'm missing the ...
0
votes
1answer
781 views

How to clip a line layer based on polygons with QGIS?

I have a line layer and a polygon layer. Both files have the same SRS. I want in a new shape file only the lines covered by the polygons. I tried in QGIS the Vector -> Geoprocessing -> Clip ...
1
vote
0answers
304 views

Importing Census TIGER Shape Files to SQL Server 2012?

I've been doing my research on how to import shape files into Microsoft SQL Server 2012. and am still unable to figure out how to do it after hours of playing around with it. I'll document what I've ...
4
votes
1answer
187 views

Loading a multipoint shapefile in R

This issue has only been raised in the community once, two years ago, to the best of my knowledge. I think it's high time to raise the issue again! readOGR, from the rgdal package, cannot handle ...
0
votes
0answers
160 views

Compiling MySQL and Sqlite drivers for GDAL/OGR 1.10.1

IF YOU WANT SHORT QUESTION GOTO QUESTION SECTION I have builded GDAL 1.10.1 with the instructions in BuildingOnWindow. By the default OGR drivers dont support MySQL, PostgreSQL/PostGIS, Sqlite, ESRI ...
0
votes
0answers
122 views

Running OGR conversion to dxf within QGIS

I would like to automate a conversion process which converts a polygon vector dataset (either sqlite or shp) to a dxf using a named column as layer name for the dxf file. The column / layer name is ...
6
votes
2answers
351 views

Convert points to lines with Python GDAL

I have a dictionary with points. The points are derived from a raster (see image below). The points are not sorted and are not in order. The dictionary looks for example like this: pointDict = {0: ...
0
votes
2answers
220 views

How to convert gml to geojson using Python and ogr with geometry transformation?

Does anyone have an idea how to convert gml to geojson (with attributes) using Python with ogr bindings? It should be possible to transform geometries to different coordinate system. I can not use ...
3
votes
1answer
69 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 ...
1
vote
1answer
158 views

Automatically determine polygon overlap 'islands'

I have a shapefile with many polygons. Some partly overlap with each other, some are not overlapping. I'm considering a polygon to be overlapping given a minimum area of overlap. 'Islands' of partly ...
5
votes
1answer
184 views

ogr2ogr selecting features by attributes

I am writing a shapefile after some processing; however, in the final step I need to do some selection by attributes from the the shapefile. I am using the command in a shell with the aim of using it ...
0
votes
1answer
147 views

Why do Shapefiles and GeoJSON behave differently in GDAL Python?

I have a test.shp. I loop over the file, buffer the features, and write the buffers to a new file. I tested writing the buffers to a Shapefile and to a GeoJSON. If I try to use the new buffer layer ...
2
votes
2answers
91 views

Python-OGR: nested loop only loops once

I have a polygon file buffer_stands.shp with 20 features and I have a line file OSMroads.geojson with 9 features. I expected the script to loop through the buffers and print out for each buffer loop ...
1
vote
3answers
253 views

KML to Shapefile using GDAL (LIBKML) - MultiGeometry data not transforming

I am trying to convert a KML file to Shapefile using GDAL (ogr2ogr). Regular KML files convert fine but KML files containing MultiGeometry features (eg: Geometry containing both Point and Polygon) do ...
0
votes
1answer
52 views

How to load interlis1 files directly into QGIS 2.0.1 Dufour 64Bit (W7Pro)

with earlier version of QGIS (1.8) it was possible to load data in interlis 1 format directly. If I try now it says something like unknown format. Is this because I'm using the 64Bit version of the ...
0
votes
1answer
45 views

OGR FeatureCount returns '-1' with OSM data

I am trying to read in an OSM file with OGR. import ogr driverOSM = ogr.GetDriverByName('OSM') roadsDs = driverOSM.Open('data/map.osm', 0) roadsLayer = roadsDs.GetLayer() The feature count returns ...
3
votes
2answers
180 views

Homebrew OGR with FGDB support on OSX 10.9

This answer worked beautifully in 10.8, but isn't working immediately in 10.9. The link to download the FileGDB API still works, but there are a bunch of options available I don't remember from ...
0
votes
0answers
36 views

How to retain crs data when datum-shifting using ogr2ogr?

I'm converting a shapefile from OSGB36 to WGS84 using ogr2ogr like so: ogr2ogr -f "ESRI Shapefile" new.shp original.shp -s_srs EPSG:27700 -t_srs EPSG:4326 However, the original contains the ...
1
vote
1answer
96 views

Fiona: won't install in Debian7.x-64bits/Python2.7

I need to install Fiona in my Debian7.x-64bits/Python2.7 machine. I already installed GDAL/OGR, pip, virtualenv, and six. I am using Python 2.7 so argparse is also installed. The installation protocol ...
1
vote
0answers
61 views

What is the best way to handle geometries between Python functions?

What is the best way to handle geometries between different Python functions? For example: I have a function that exports a line from grass.script. The line will be a parameter of another function ...
3
votes
1answer
202 views

How to change the field value of a Shapefile using GDAL/OGR?

I am trying to change the field value of a shapefile. However it doesn't change the value. What's wrong with my code? import ogr driver = ogr.GetDriverByName('ESRI Shapefile') fn = 'dist.shp' ...
2
votes
1answer
183 views

How to run OGR in ArcGIS Scripts?

When I run my script outside ArcGIS it works because during execution script uses a GDAL and OGR modules from osgeo. When I use script as a tool in ArcGIS it does not work. In PySripter I can import ...
1
vote
1answer
63 views

OGRFeature::DestroyFeature fails

I am using OGR to read features from a shape file; when the feature is destroyed I am getting an error 0xC0000005: Access violation reading location 0xffffffffffffffff. This secton of the code looks ...
2
votes
1answer
775 views

QGIS 2.0 without MySQL connector

On a mac (Mountain Lion), after a major upgrade to GDAL (1.10) and related frameworks from KyngChaos page, QGIS 2.0 doesn't show any MySQL connector: Add Vector > Database > ... The driver ...
1
vote
0answers
49 views

Why is the performance of ogr methods different on different OS?

This question actually comes forth from an earlier question of mine . A short introduction. I was writing a program that performs near analysis and creates buffers for a set of points. On my Linux ...
5
votes
2answers
508 views

Python: how to speed up spatial search (nearest point)?

I'm working on a program that determines the closest location from a given point. The point cloud I'm testing against is very big (~800.000). However, this doesn't really explain why my implementation ...
2
votes
1answer
450 views

ogr2ogr specify lat/long order on conversion to GeoJSON

When using ogr2ogr to convert a polyon from a .shp file to GeoJSON, I noticed that it writes the coordinates in order lat, long. I noticed this because whenever I tried to view the GeoJSON on a map, ...
1
vote
0answers
81 views

How to join attributes by location with command line

I would like to joint the attributes of 2 shapefiles by location but with a command line (linux). This feature is easy in QGIS but it is VERY slow. Is there a way of doing this with ogr or pyqgis ? ...
2
votes
1answer
343 views

Clip and copy files to same directory structure using OGR/GDAL with Python

We need to clip all our data (many TB) by a new boundary and save it while maintaining the same data structure. I want to use OGR/GDAL as the data is in shp/tab/kml/geoTif/ecw etc. I can find the ...
0
votes
0answers
32 views

How to split a feature using GDAL

I want a feature to be cut into 2 or more based on deviation of a segment i.e., the angle between 2 successive segments. At places, I may also require to merge 2 or more features.
1
vote
2answers
139 views

will ogr get coordinates in geographic coordinate system or projected coordinate system when using getPoint(int,OGRPoint*)

Consider the code that I have written in the stackoverflow question How to extract vertexes of geometries in ESRI shapefiles using ogr library with c++, I have used the code to show shapefiles on an ...