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
-
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 FabianCommented Oct 25, 2012 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.Commented Oct 25, 2012 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 FabianCommented Oct 25, 2012 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. en.wikipedia.org/wiki/Viewshed_Analysis– R.K.Commented Oct 25, 2012 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.– DavidFCommented Oct 25, 2012 at 13:41
2 Answers
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.
Example:
GDALRasterIO( hBand_ , GF_Read , p, l, 1, 1, &pafScanline, 1, 1, GDT_Float32, 0, 0 );
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.
and CPL_DLL GTIFKeyGet
This function reads the value of a single GeoKey from a GeoTIFF file.
-
I know the Libgeotiff library but it doesn't have a useful documentation or some examples on how to get data from TIFF files. Commented Oct 25, 2012 at 11:40