Tagged Questions
1
vote
0answers
14 views
How do I get the domain from an OGRSpatialReference?
I would like to know what the projected bounds are for a spatial reference using OGRSpatialReference. Is there some way to use the GetProjParm method to get this information?
An example of what ...
5
votes
1answer
66 views
Python - OGR: Transform coordinates from meter to decimal degrees
I have a point in a shapefile. The shapefile is in a WGS_1984_Web_Mercator Projected Coordinate System. I want to get the coordinates of that point in decimal degrees with GDAL/OGR in Python.
I am ...
0
votes
0answers
29 views
Python GDAL/OGR: check lines geometries connectivity
I'm working with shapefiles representing roads, so basically it's stored as (poly)lines.
I need to perform a road connectivity checking. In other words, I want to ensure that roads meant to ...
1
vote
1answer
18 views
OGR UnionCascaded gives strange lines (flat polygons)
I'm using OGR to perform a union using UnionCascaded. All my polygons have been created by GDAL polygonize which ensures that all polygons follow pixel edges and should therefore align nicely. But I ...
2
votes
3answers
99 views
How to test if geometry is inside another?
I need to tell whether geometries from a shapefile are inside other geometries or not.
For example, I want to test if there are trees (represented as points in trees.shp) inside the urban areas ...
7
votes
1answer
104 views
How to rename field names in a shapefile?
I need to rename the field names (attributes) in a shapefile. Is there an easy way to do this from the command line?
2
votes
1answer
76 views
OGR - Weird GeomType -2147483645 on polygon shapefile
I am trying to import a shapefile (multipolygon) in an app with ogr but I got an error about invalid geom type. If I inspect the data with ogr like this:
datasource = ogr.Open("c:\\temp\\data.shp")
...
0
votes
1answer
86 views
OGR OSM-driver unable to open datasource
I want to read an OSM file with OGR. I use Version GDAL 1.9.1, released 2012/05/15.
To read a SQLITE file works fine:
$ ogrinfo test.sqlite
INFO: Open of `test.sqlite'
using driver `SQLite' ...
1
vote
4answers
98 views
Get vector features inside a specific extent
The problem:
I have a very large vector layer with many features and a much smaller raster layer in a defined region. I want to get only those vector features which are within the raster layers ...
0
votes
0answers
38 views
Using GDAL/OGR exes in php
could you point me in the next logical direction? I wanted to use the gdal and run the exe commands through my web application, but have no clue what the next step should be after running the ...
0
votes
2answers
37 views
OGR GetX() returns always zero
I am trying to get the first x-coordinates of a polygon. However I only get zero in return. What could cause that?
import os, sys, gdal, ogr
from gdalconst import *
driver = ...
2
votes
1answer
44 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 ...
3
votes
1answer
77 views
GDAL OGR distance different than in ArcGIS
I want to determine the shortest distance between a point and a line. I use the following Python script to do so. If I compare the result of the script with the result of ArcMap's Near Analysis, I get ...
3
votes
1answer
73 views
OGR Info - Check for spatial index?
If we want to get information about a vector layer (shapefile for example) we could use ogrinfo:
ogrinfo -so myshapefile.shp mylayer
This returns a lot of pertinent information about the shapefile. ...
0
votes
1answer
193 views
Installing GDAL with Java Bindings (gdal.jar) on Ubuntu 12.10
I am trying to build a postgis importer for mutliple shapefiles. After geotools took orders of magnitude longer than shp2pgsql to import my data, I decided to attempt to use the java bindings to GDAL ...
4
votes
1answer
71 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
58 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
57 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
135 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 ...
10
votes
1answer
558 views
How do I get the pixel value of a GDAL raster under an OGR point without NumPy?
I am working on a computational model of the abundance of wild pollinators across a landscape. The model itself is complete, and I am now struggling with a post-processing step.
I have my GDAL ...
5
votes
1answer
91 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 ...
3
votes
1answer
489 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
2answers
191 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 ...
0
votes
0answers
128 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 ...
5
votes
0answers
92 views
How to detect a GDAL/OGR 'Warning'?
When I run a batch script using a GDAL/OGR program, I can detect if an error occured by checking ERRORLEVEL for the value 1.
When using GDAL/OGR in python or .NET, I get an exception when an error ...
3
votes
3answers
293 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 ...
5
votes
2answers
222 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 ...
4
votes
2answers
231 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, ...
5
votes
1answer
213 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 ...
3
votes
2answers
226 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 ...
1
vote
0answers
126 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 ...
2
votes
1answer
110 views
Latest version of ogr2ogr fails with Layer Creation
I am able to succesfully run the ogr2ogr in adding S57 data to PostgresDB. The version I use is GDAL 1.7.0b2, FWTools 2.4.7 and release date 2010/01/19
I upgraded my version to GDAL 1.9.1 and ...
3
votes
2answers
551 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 ...
5
votes
1answer
211 views
GDAL.RasterizeLayer not ported to the C# bindings?
I am trying to use the OSGeo.GDAL.Gdal.RasterizeLayer(…) from GDAL 1.9.2 and it requires some SWIGTYPE parameters:
OSGeo.GDAL.Gdal.RasterizeLayer(
OSGeo.GDAL.Dataset dataset,
int bands,
...
0
votes
1answer
260 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
92 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 ...
2
votes
2answers
296 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 ...
3
votes
1answer
136 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 ...
1
vote
3answers
219 views
Getting Field value for a given coordinate out of ESRI Shapefile using GDAL/OGR
I have a bunch of ESRI shapefiles that contain Land Cover data across Canada (provided by Geobase). I need to query the files and obtain the value of a certain field (called COVTYPE) in a given ...
7
votes
2answers
269 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 ...
8
votes
1answer
191 views
Is there a way to properly have GDAL raise exceptions in Python?
I am working with GDAL in Python and have wanted to get GDAL to raise exceptions so that I can do something useful with them. For instance if a file cannot be opened with gdal.Open() I would like to ...
6
votes
4answers
616 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 ...
3
votes
2answers
234 views
Eliminate small polygons from shapefile
I downloaded GTOPO30 *.DEM files, and extracted a contour line at 2000m altitude using gdal_contour. In the resulting shapefile, I have many small polygons in areas where the altitude is close to that ...
9
votes
1answer
229 views
OGR/GDAL threading results in low core utilization
I'm trying to process some raster data using ogr/gdal and I can't seem to get full utilization of all the cores on my machine. When I only run the process on a single core, I get 100% utilization of ...
4
votes
1answer
350 views
ArcGIS SP4 fails to open file geodatabases created with ogr2ogr
I've been using the new FileGDB support in gdal-1.9.0 to create file geodatabases that can be opened in ArcGIS. For example (I'm doing this all on one line, so I'm not certain this will run as ...
1
vote
1answer
1k views
UnboundLocalError: local variable 'x' referenced before assignment
I am trying to execute this code,
import osgeo.ogr
def findPoints(geometry, results):
for i in range(geometry.GetPointCount()):
x,y,z = geometry.GetPoint(i)
if results['north'] == ...
1
vote
0answers
94 views
Is Django's LayerMapping capable of putting a static value into all features?
I'm using GeoDjango's LayerMapping utility to try and import a set of features. The catch is that aside from the attributes in the source layer, I want all the destination features to have the same ...
9
votes
2answers
1k views
API documentation for Gdal/Ogr with C#
I want to assign projection to shapefile in my web C# application, for this i am using Gdal/OGR/OSR C# bindings and add osr_csharp.dll and ogr_csharp.dll references. But i am facing some difficulty ...
19
votes
2answers
1k 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 ...
5
votes
2answers
429 views
Can I change the GDAL/OGR library that QGIS uses?
I have been adding a new format to OGR, all seems well and OGRInfo works. Now I would like to test my code out using QGIS. Is there an easy way to switch which GDAL lib QGIS uses on a windows box? ...
