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

2
votes
1answer
177 views

OGR CreateLayer returns TypeError

I'm trying to create a shapefile layer based on the spatial projection of an already existing raster. (Ultimately, this will be used in gdal.Polygonize to get a shape from my raster data.) However, I ...
2
votes
0answers
85 views

Custom python datasource to QGIS

I'm working on a homebrew spatial feature data format, and using Python to write it's API. It occoured to me that use some tool like QGIS to display my data would be very nice to have, for debug/test ...
8
votes
4answers
1k views

How to build a geographic database of GPS logs?

On our aerial wildlife surveys we typically generate dozens of GPX files, and usually convert most of them into shapefiles for display in a GIS application. GPX files are a terrific way of keeping all ...
4
votes
1answer
819 views

How to programatically populate a shapefile field with polygon areas in OGR?

I'm trying to programatically populate a shp field with polygon areas: import sys import ogr ds = ogr.Open( 'tttttttttt.shp', update = 1 ) if ds is None: print "Open failed./n" sys.exit( 1 ...
8
votes
2answers
1k views

How to buffer a vector shapefile using ogr python?

I am trying to learn how to use ogr in python using the country and populated places datasets from http://www.naturalearthdata.com/downloads/50m-cultural-vectors/. I am attempting to use filters and ...
4
votes
1answer
199 views

How to use -lco options in gdal_contour?

I'm trying to create contours from geotiff raster with gdal_contour. My output format is Postgresql and I would like to ovewrite the existing table. When I do: gdal_contour -a 1 -f PostgreSQL -i 50 ...
2
votes
1answer
57 views

QGIS QgsOgrProvider library

I asked a question here: http://stackoverflow.com/questions/14790463/qgis-copy-layer-in-c-plugin and I was suggested to find the library which provides QgsOgrProvider::createEmptyLayer() function. Can ...
2
votes
1answer
307 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: ...
2
votes
2answers
393 views

Using osgeo modules in ArcGIS10.1 and QGIS 1.8 python shells

This is related to an old question of mine - Issues with osgeo - qgis.core and arcpy modules Now in new versions of all the software QGIS Lisboa (1.8), ArcGIS 10.1 and pyScripter 2.5.3. They all use ...
5
votes
2answers
987 views

Why does this simple Python OGR code create an empty polygon?

Please excuse my ignorance...I am new to Python OGR. I am trying to create a simple square polygon and fail...this produces an empty polygon. Where did I go wrong? from osgeo import ogr driver = ...
4
votes
3answers
922 views

Python OGR: convert a point geometry into polygon

I'm writing a routine for creating the convex hull envelop around shapefiles of islands. I could read the data, extract polygons vertices into a geometry and then compute the convex hull. Now I need ...
8
votes
3answers
3k views

Get all vertices of a polygon using OGR and Python

I'm having a little trouble with the Python OGR API. What I am trying to do is get all the coordinates of each vertex of the outer ring of a polygon. This is what I have so far: import osgeo.ogr ...
2
votes
2answers
530 views

Updating polygon geometry: deleting inner rings with python

I've searched, but can't find clear explanations how can I simply delete inner rings from existing polygons with python or extract outter rings and overwrite the geometry. Seems GDAL/OGR should be the ...
3
votes
1answer
152 views

shapefile batch clip and merge combined

I have two shapefiles, one is polyline, the other polygon. For each polygon I would like to clip the polyline vectors inside. Using arcpy I already found part of a possible solution: ...
21
votes
1answer
2k views

Can ESRI's File Geodatabase API be Redistributed?

ESRI's file geodatabase API can now be used with GDAL/OGR - http://www.gdal.org/ogr/drv_filegdb.html however each individual seems to have to login to ESRI and download the API files individually. For ...
2
votes
1answer
83 views

How to interpret the OSGeo4w software version under Advanced Install option?

When choosing to install QGIS Desktop using the OSGeo4w advanced install option, I noticed that there are what looks like ambiguous software versions to choose. For example, currently QGIS Desktop ...
1
vote
1answer
82 views

SHAPE FILE to TIGER with OGR

How do I convert SHAPE FILE to TIGER using GDAL (OGR). I try but throw following error:(layer number)is not a known TIGER/Line layer.
3
votes
1answer
416 views

Simplify polygon in OGR

We use ArcObjects pretty heavily and simplify polygons using something similar to the ITopologicalOperation::Simplify(void). No tolerance is passed in as the parameter (it uses the XY tolerance of ...
4
votes
2answers
319 views

How do I Capture GDAL projection and create matching output (OGR or GDAL) shape files?

Working in C++, using GDAL and OGR: Depending on what the user has supplied for image input, I need to output point (or other) shape files in the same projection as the input raster images. The ...
5
votes
1answer
137 views

GDAL/OGR Determine if dataset is raster or vector

I am writing a script using the GDAL/OGR Python bindings and it is possible that the user may provide a raster dataset or a vector dataset as input. If the user provides a vector dataset, the script ...
2
votes
2answers
209 views

Why are the output point shapefile PRJ files empty?

I have tried evry thing I could find (using C++) to create a new .prj file for an output point shape file using OGR. While I get no compilation or execution errors and ArcMap accepts the file as a ...
3
votes
2answers
465 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 ...
4
votes
2answers
325 views

how to cast integer to float in an ogrinfo sql statement?

I have a shapefile for which I would like to add the values in a column. As the sum exceed the capacity of an integer, I need to cast values to a float. I tried the following: ogrinfo -sql "SELECT ...
0
votes
1answer
475 views

Why do I get an OGR error when attempting to save an edited Shapefile?

I often get an ogr error when I try to save a shapefile after working on it in Qgis ( adding features, removing, modifying attributes.. ) The error says : "OGR ERROR : Attempt to delete shape with ...
7
votes
2answers
3k views

How to convert GML Surface to SHP Using OGR?

I have a very large .gml file with multiple layers in it. I would like to export one of these layers to .shp. It is a polygon layer (of lakes). However, I am getting the error: ERROR 1: ...
2
votes
1answer
319 views

How to bulk delete shapefile columns?

I have shape-file with next attribute table: - name of features, unique number for each feature of layer I must split shape-file by NAME field, but in result in attribute tables of layers should be ...
5
votes
2answers
967 views

How to create a shapefile consisting of 2 lines using Python OGR?

How would you create a shapefile consisting of 2 lines using Python OGR? First line is no problem, but how do you reuse MyLine and Feature objects to create the second line? Ultimately this will ...
10
votes
2answers
2k views

How to add custom Feature attributes to ESRI Shapefile with Python?

I am seeking a way to take an existing ESRI Shapefile that has a Feature set of 200 countries. Each country Feature has an attribute of "NAME." My objective is to create a Python script that adds an ...
7
votes
4answers
1k views

Are there GUI resources for gdal and ogr?

For those who are new to the programming side of GIS, I feel that a lot of great tools and resources are inacessible. I am interested in GUI based wizards for handling geoprocessing with libraries ...
4
votes
3answers
334 views

ogrinfo bash script failure

I need to recursively document a bunch of Shapefiles using orginfo in many directories. For example, $ tree -P *.shp . ├── acfish2s │   └── acfish2.shp ├── airports │   ├── airport_runways.shp │   ...
4
votes
2answers
518 views

How to programmatically create exports from PostGIS database into different file formats (e.g. shapefile, dxf, dgn,…)?

Is there a kind of wrapper/library written in python which would enable me to programatically create exports from postgis database into different file formats (most common being, shapefile, dxf, ...
3
votes
3answers
612 views

DXF to georeferenced SHP

I know how to set projection and georeference bounds of scanned TIFF file, by using gdal, but I don't know how to do the same for vector file. For example I georeferenced TIFF file by using this ...
2
votes
0answers
125 views

Ogr: How to add layer description to dgn?

I have created a dgn-file using Ogr, but can't find a way to fill out the description for this layer programatically. (something like _dgnLayer.Description = "Highways") opts.Add("SEED=" + ...
5
votes
2answers
408 views

Read an ArcGIS Feature dataset using GDAL

I am new to GDAL in Python and would like to use it to create a list of populated layers in a ArcGIS mdb Feature datasets. I have the code below that provides a list of all the populated layers but ...
5
votes
1answer
393 views

Slow FileGDB Performance in GDAL

I am attempting to write many ASPRS LAS point files into an ESRI File Geodatabase using my compilation of GDAL 1.9.2. The FileGDB driver for GDAL/OGR appears to be incredibly slow when writing large ...
4
votes
1answer
4k views

Convert Shapefile to MySql

I have used Grass GIS imported a .shp file; I now want to export this file to MySQL. I understood that MySQL will contain the function of all three the files necessary in a Shape file system (.shp - ...
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): ...
4
votes
2answers
956 views

Shape-file encoding problem in QGIS 1.9.0 (built with GDAL 1.9.2)

I have googled a lot but failed to find the answer. My configuration is: Ubuntu 11.10 Quantum GIS - 1.9.0-Master 'Master' (caae7b7) GDAL 1.9.2, released 2012/10/08 Shape-files refuse to open in ...
3
votes
1answer
174 views

msWFSGetFeature(): WFS server error. FLTApplyFilterToLayer() failed

I have the following code that generates a map with a couple of layers. var PIDS = ...
1
vote
2answers
308 views

How to use -where SQL in an ogr2ogr loop in GDAL/OGR (bash)?

I'm using the following code: while read line; do for att in $line; do ogr2ogr -where "newcode='$att'" -f "ESRI Shapefile" $OUTPUT/$att.shp $INDATA done done < $SCRIPT/newcodes.txt The text file ...
3
votes
1answer
320 views

How to stop writeOGR from abbreviating Field Names when using “ESRI Shapefile” driver

I'm currently using the following script to add some attribute data from a table to lots of individual shapefiles: library(rgdal) specieslist <- read.csv("SpeciesList1.txt", header=F) attdata ...
3
votes
2answers
840 views

How to Open a File Geodatabase with ogr? [duplicate]

Possible Duplicate: How to access feature classes in File Geodatabases with python and gdal? I have installed: python-2.7.msi GDAL-1.9.1.win32-py2.7.exe import ogr driver = ...
0
votes
1answer
819 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 ...
2
votes
1answer
827 views

Opening .lyr file via rgdal/OGR

According to this answer I can read in a .lyr file via OGR as long as it was made with ArcGIS version 10. I have such a file (from the ArcGIS Maps & Data page) but I can't quite make R's readOGR ...
1
vote
1answer
328 views

ogr: how to use epsg database for RD New projection?

I'm trying to assign this EPSG projection to my newly created shapefiles using ogr. The OGR Projections Tutorial says: ...any geographic coordinate system in the EPSG database can be set by it's ...
4
votes
1answer
331 views

ogr2ogr when importing from fgdb and use in python

I want import data from my GDB to PostGIS. It works fine on some datasets (all records -data- is imported or nothing is imported) from a gdb but just doesn't import others. I can't find any ...
3
votes
3answers
612 views

How to merge a large amount of polygon-features in a script?

We have a very large shapefile with over 30000 features and want to merge it with a script on a server. Currently we try it with QGIS, but the processing takes way too much time. Is there a way to do ...
2
votes
1answer
144 views

Why does ogr's CreateLayer() return None?

Why does ogr's driver method CreateLayer return None? I'm using python 2.7 with gdal 1.9.1. path = r'D:\_tempAuto' out_shp = '%s\test_OGR.shp' % (path,) driver = ogr.GetDriverByName('ESRI ...
1
vote
0answers
189 views

Naming layers in DXF using OGR2OGR

We have been using ogr2ogr to export data from PostGIS into DXF. Using the default behaviour of the export, all data are put into layer '0'. We would put data into a layer name from the PG table name. ...
7
votes
2answers
457 views

How to catch PostgreSQL/PostGIS errors in GDAL/OGR Python bindings?

Is it possible to catch PostgreSQL output error messages in OGR after a query has failed? For example conn.ExecuteSQL('SELECT * FROM non_existing_table;') In Postgres this returns an error ...