gdal

using GDAL/OGR api to read vector data (shapefile)--How?

Hi, I am working on an application that involves some gis stuff. There would be some .shp files to be read and plotted onto an opengl screen. The current opengl screen is using the orthographic projection as set from glOrtho()..and is already displaying a map using coordinates from a simple text file.. now the map to be plotted is to b...

GDAL2Tiles and vectors

I am trying to make an interactive map of a really big warehouse. I have scanned blueprints and am using OpenLayers with a TMS data source (generated using GDAL2Tiles) to display the map. Everything looks fantastic, but I'm at a total loss as to how to create a vector layer on top of it! Ideally, I'd have ~100 or so vectors on top of m...

gdal c# readasarray

hi i was using gdal api to read raster files... i found in some places that python version has readasarray i assume this takes the data of the raster file as two dimensional array, is there any similar option for c#, or at least can you show me how to do it? thanks a lot! ...

Using UTM with geodjango

I'm looking into using the UTM coordinate system with geodjango. And I can't figure out how to get the data in properly. I've been browsing the documentation and it seems that the "GEOSGeometry(geo_input, srid=None)" or "OGRGeometry" could be used with an EWKT, but I can't figure out how to format the data. It looks like the UTM SRID i...

Encoding problems with ogr2ogr and Postgis/PostgreSQL database

Hi! In our organization, we handle GIS content in different file formats. I need to put these files into a PostGIS database, and that is done using ogr2ogr. The problem is, that the database is UTF8 encoded, and the files might have a different encoding. I found descriptions of how I can specify the encoding by adding an options param...

NSTask or equivalent for iPhone

I've an open source project (gdal) that I want to compile and run as part of an iPhone app. I had been expecting to use NSTask but I see now that it was removed in OS 3.0. I've also seen elsewhere that running external applications, though this would be a resource in my app's bundle, is not allowed. Has anyone else found a way to run c...

can't import gdal in python?

Hi, I have gdal installed and running on Ubuntu Jaunty but I can't run gdal2tiles because I get the error: Traceback (most recent call last): File "/usr/local/bin/gdal2tiles.py", line 42, in <module> import gdal ImportError: No module named gdal When I open python and type import gdal I get the same error. I've set LD_LIBRARY...

Geo question: How to generate a .wld file given some ground control points?

OK, so I have a jpeg and a bunch of ground control points (x/y pixels and corresponding lat/lon references). I'd like to generate a .wld world file to accompany the jpeg, from the command line. My coordinate system is Google Maps, i.e. EPSG:900913. I know that I can use gdal_transform to generate a .vrt given the gcps, but what I need...

Which C++ library for ESRI shapefiles to choose?

Does anyone have an experience in processing (reading) ESRI shapefiles (http://en.wikipedia.org/wiki/Shapefile) from C++? I have found at least 2 open source libraries: ShapeLib C library (http://shapelib.maptools.org/) and OGR (http://www.gdal.org/ogr/). Which one is better? Does anybody used one of them? How about the experience? ...

ogr2ogr from PG to SHP changes data-type in .DBF

UpDate: Yes, that was it! Like mloskot said, the whole tabel needs to be dumped. selecting fields with sql loses information about fuield widths. Thanks, that fixed it! Hi All, I have a problem with ogr2ogr. I'm trying to dump a PostgreSQL tabel to a Shapefile. ogr2ogr seems to change the size of data-types like integer and char. H...

Rasterizing a GDAL layer

Edit Here is the proper way to do it, and the documentation: import random from osgeo import gdal, ogr RASTERIZE_COLOR_FIELD = "__color__" def rasterize(pixel_size=25) # Open the data source orig_data_source = ogr.Open("test.shp") # Make a copy of the layer's data source because we'll need to # modify its attribu...

Easy methods of installing and having access to the GDAL library?

The GDAL library homepage implies that people who arrive there already know what they are doing. I work with ArcGIS, and am unfamiliar with intricate setups with library dependencies as GDAL suggests. Is there an easy "package" i can download? I have found maptools.org, and i guess the libraries that has is accessible by any programmin...

GIS: When and why to use ArcObjects over GDAL programming to work with ArcGIS rasters and vectors?

Im just starting off with GDAL + python to support operations that cannot be done with ArcGIS python geoprocessing scripting. Mainly I am doing spatial modeling/analysis/editing of raster and vector data. I am a bit confused when ArcObject development is required versus when GDAL can be used? Is there functionality of ArcObjects that GD...

Cygwin gdal library load error

I built spatialite library then gdal library with spatialite support. Also built mapserver which depends on gdal with success. There was no problem with linking. When I try to execute a gdal utility I get: $ ogrinfo.exe /usr/local/bin/ogrinfo.exe: error while loading shared libraries: cyggdal-1.dll: cannot open shared object file: No ...

Convert GeoTIFF to JPEG and Extract GeoTIFF Headers in Python

I am making a Python script which will read in a GeoTIFF file, and will do both: convert the GeoTIFF into a static JPEG (that is much smaller in size), and create a separate text file which contains the GeoTIFF headers. Using the Python GDAL API, I am able to get the script to open a GeoTIFF file, and print details, such as the RasterXS...

Obtain Latitude and Longitude from a GeoTIFF File

Using GDAL in Python, how do you get the latitude and longitude of a GeoTIFF file? GeoTIFF's do not appear to store any coordinate information. Instead, they store the XY Origin coordinates. However, the XY coordinates do not provide the latitude and longitude of the top left corner and bottom left corner. It appears I will need to d...

Installing GDAL for Python

I am trying to install GDAL for python on a Windows XP machine (Python 2.6 currently installed) following the instructions at http://trac.osgeo.org/gdal/wiki/GdalOgrInPython (as is mirrored in a hundred other places). It says I need both the GDAL source (or Windows binary) and the python bindings. The python binding are be downloaded f...

ogr2ogr problem converting UK Ordnance Survey MasterMap

I'm having trouble using the 'ogr2ogr' utility (part of GDAL 1.7.2) to convert the UK Ordnance Survey MasterMap (GML) into ESRI shapefiles. The 'orientation' field is being ignored when I convert the CartographicText layer, although this field gets successfully translated for the CartographicSymbol layer. All the other CartographicText...

Representation of road topology in a GIS file.

Hello All, I'm just getting into GIS right now with a new project at my work - so I'm still kinda new at all of this. I'm using GDAL to work with the TigerLine Shape files from the previous US census land survey. Within these files you can find (among other things) polyline sets that describe lat/long position of roads and you can fin...

How can I get the installed GDAL/OGR version from python?

How can I get the installed GDAL/OGR version from python? I aware of the gdal-config program and are currently using the following: In [3]: import commands In [4]: commands.getoutput('gdal-config --version') Out[4]: '1.7.2' However, I suspect there is a way to do this using the python API itself. Any dice? ...