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

0
votes
1answer
796 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 ...
0
votes
4answers
100 views

Trouble converting .osm to .pbf with Osmosis

I would like to convert a shp file to map file. I know should use these steps: shp -> osm -> pbf -> map For step 1 I use a python script : ogr2osm.py For step 2 I use osmosis, but I get ...
0
votes
0answers
25 views

Does a road connect one grid cell to an adjacent grid cell?

So here is the problem I am working on. I have an OpenStreetMap roadmap which I overlaid with a 2-D cartesian grid. So for a given grid square, I want to find out if a road segment continues from the ...
3
votes
2answers
231 views

Need help assigning values to field using OGR in python

I've got a similar question to this one How to programatically populate a shapefile field with polygon areas in OGR?, but the solution doesn't seem to be working for me. I am trying to import a ...
1
vote
0answers
86 views

Using ogr2ogr to download GeoJSON files from ArcGIS MapServer

I am trying to download as a GeoJSON file a line feature from a ArcGIS MapServer REST Service run by the National Park Service (link is here) so that I can open the data in QGIS. Using the guide ...
6
votes
3answers
1k views

Is it possible to create 3D dxf with OGR?

Does anyone know if it's possible to create a 3D dxf with OGR. I would like to assign our contour lines a z value and export them to dxf for some cad work. PS I know FME can do this, however I would ...
1
vote
0answers
31 views

Transformation of OGR style data

I have been using GDAL/OGR in a project and it is going quite well. I have been re-projecting data from various source formats into a single CRS (using the C# bindings), but one issue I have come ...
1
vote
1answer
77 views

Equivalent function to shapely's envelope in ogr?

I wrote a very simple python function that gives me the envelope/bounding box/...based on two coordinate pairs (ower left and upper right corner): # ... def get_bounding_box(self, ll_corner, ...
1
vote
1answer
206 views

Import shp to Postgis using Python and ogr

I just export a Postgis Table to shp using this tips but I'm not able to import a shp to Postgis using the same library(ogr). Any idea? Thanks a lot f.
2
votes
1answer
780 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 ...
4
votes
1answer
270 views

How to use the OGR/GDAL configure options in QGIS python environment

I’m looking for a solution how to use the OGR/GDAL configure options (--config) in the qgis python environment. http://trac.osgeo.org/gdal/wiki/ConfigOptions Setting special configure options is ...
1
vote
1answer
75 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" ...
2
votes
1answer
38 views

ogrinfo returns a negative coordinate for extent of mif data file

I'm trying to get the extent of a MIF file using ogrinfo. The MIF file is supposed to be in epsg:23030 projection. This is: PROJCS["ED50 / UTM zone 30N", GEOGCS["ED50", ...
5
votes
1answer
2k views

R : convert a spatial polygon objet to spatial polygon data frame

My goal is to modify an existing shapefile by merging certain polygons. After importing the shapefile and using the UnionSpatialPolygons command, I get the polygon outline that I want. However, this ...
3
votes
3answers
562 views

PostGIS: parse geometry wkb with OGR

I'm trying to pull a LineString geometry out of PostGIS and parse it with OGR (python bindinds). from osgeo import ogr import psycopg2 connection = psycopg2.connect("...") cursor = ...
0
votes
0answers
60 views

Getting “Segmentation fault: 11” with ogr in Python

This is the code I'm trying to run: In [1]: from osgeo import ogr In [2]: datasource = ogr.Open('testdata.shp') In [3]: datasource.GetLayerCount() Out[3]: 1 In [4]: layer = ...
0
votes
0answers
77 views

GEOS assertion failed

The following script fails, if I import the 'rasterstats' library. import rasterstats import ogr geom1 = ogr.CreateGeometryFromWkt('POLYGON ((415924.806155724043492 ...
0
votes
1answer
48 views

Is it possible to get all projections form OGR?

I'm working on a project where the user can give my program so GIS data which may or may not have which projection it is using. So is it possible to get a list of all the projections from OGR or ...
1
vote
1answer
108 views

ogrinfo sql example

I'm having trouble learning how to query my shapefiles for certain features. I have a shapefile that looks something like this when I summarize it using the following command: ogrinfo -al -geom=OFF ...
4
votes
2answers
249 views

How to access Shapefile metadata using OGR?

I'm trying to use ogrinfo to get some details on a shapefile I downloaded. Currently, the only way I know how to do this is to load it into QGIS and manually click around to find any information on ...
0
votes
1answer
251 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
177 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
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 ...
2
votes
3answers
114 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
1answer
82 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
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 ...
1
vote
0answers
86 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 ...
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 ...
1
vote
0answers
315 views

OGR-Driver GML axis order handling (GDAL, QGIS)

By default the OGR-Driver will swap the axis order to longitude, latitude for geographic coordinate systems. "Since OGR 1.8.0, the GML driver has coordinate system support. This is only reported ...
6
votes
3answers
3k views

Where do I find the ogr2ogr command for Mac OS X Lion?

I am looking for the equivalent of FWTools for Mac OS X, Lion. Is there anything I can easily install and get that command?
1
vote
3answers
254 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 ...
2
votes
2answers
111 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
401 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 ...
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?
0
votes
1answer
182 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
3answers
131 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 ...
1
vote
2answers
498 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 ...
3
votes
2answers
182 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 ...
1
vote
2answers
60 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
351 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.
2
votes
2answers
623 views

How to read csv with WKT geometry in Arcmap?

I have found several parcels I need on a county map viewer. However, the only option to download any of the data is found on a click context menu to "Copy selection as csv" which gives me this: ...
1
vote
4answers
277 views

Does shapefile or MapInfo TAB have advantage as source format for OGR conversion to GeoJSON?

I'm relatively new to OGR and GIS in general. Most of the sources I look at give a choice of ESRI shapefile and MapInfo formats. I'm using ogr2ogr to convert these to GeoJSON for import into ...
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
156 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
116 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
1answer
381 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 ...
2
votes
3answers
123 views

OGR: Meaning of “2.5D extension as per 99-402”

I'm looking at the enum defs in ogr_core.h. I see a bunch with comments that read: 2.5D extension as per 99-402. What in the world does that mean? Presumably it's referencing a spec or RFC? ...
1
vote
0answers
310 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 ...
6
votes
2answers
353 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: ...