Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am developing an AR iOS application. When the iPhone gets the current location, it has to calculate locally the visible point. I want to read the tiff files in my application, and then get the coordinates and altitudes from it.(locally, offline) I am looking for an open source C++ code, or something like this. Please help

share|improve this question
I have extracted from the TIFF file the coordinates and altitudes using VTBuilder. Now I have a txt file with a size of 1 Gb, but this is too large for a mobile application. I don't know if I am on the right way but probably the txt file can be compressed somehow. It has to be decoded locally when I get the current location.. – Emese Fabian Oct 25 '12 at 11:25
So you get the current coordinate from a GPS fix and then find its corresponding point on the tiff file and put a marker there? – R.K. Oct 25 '12 at 11:30
I get the current coordinate from a GPS fix and using the tiff file, I have to get an array of coordinates of the visible points from my current location, this can be made only by using the altitudes of the coordinates. – Emese Fabian Oct 25 '12 at 11:35
Oh, you'll be doing viewshed analysis on your phone. Libgeotiff should be able to get the coordinates and read the values for you though you'll have to implement a viewshed algorithm. – R.K. Oct 25 '12 at 11:40
You should be able to use the RasterLite functionality of SpatiaLite on iOS. It doesn't sound like it is the easiest thing to compile, but it might allow you to do simple elevation queries for particular points. – DavidF Oct 25 '12 at 13:41

With libtiff you can't get altitude from you file. I spent a lot of time trying to do it with libgeotiff. My advice is to install GDAL.


GDALRasterIO( hBand_ , GF_Read , p, l, 1, 1, &pafScanline, 1, 1, GDT_Float32, 0, 0 );
share|improve this answer

Libgeotiff should do the job.

Libgeotiff is an open source library normally hosted on top of libtiff for reading, and writing GeoTIFF information tags.

I think you'll need CPL_DLL GTIFImageToPCS

Translate a pixel/line coordinate to projection coordinates.


This function reads the value of a single GeoKey from a GeoTIFF file.

share|improve this answer
I know the Libgeotiff library but it doesn't have a useful documentation or some examples on how to get data from TIFF files. – Emese Fabian Oct 25 '12 at 11:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.