assigning color information to geo-tiff
Hi,
I would like to assign color information to a srtm-file-geotiff
file as described in the knowledge base ("Terrain visualization
with digital elevation models and GDAL"). I saved the color
information to a text file (saved to a file called ramp.txt) but
now don't know how to link this text file to the map and the
geo-tiff it concerns... How do I do that? Within the style.mss
?
Best regardes
desputin
Comments are currently closed for this discussion. You can start a new one.
Support Staff 2 Posted by AJ on 26 Sep, 2011 07:59 PM
Oops, it looks like a very important step is missing from that section of the article (I will update it shortly). Assigning the colors is a step that happens before you bring the geotiff into TileMill. Use the gdaldem command:
Then you can add the file that gets created as a layer in TileMill
3 Posted by christ.stark on 27 Sep, 2011 07:33 AM
Hi, thanks,
I get an error: gdaldem: command not found. Even though I have installed gdal...
Support Staff 4 Posted by AJ on 27 Sep, 2011 02:43 PM
Are you using Mac OS X? If so try these commands to put the program in your path variable:
5 Posted by christ.stark on 27 Sep, 2011 04:00 PM
No, I am using Linux (Ubuntu, I took the VirtualBox-Image provided by Tilemill)
Support Staff 6 Posted by AJ on 27 Sep, 2011 07:09 PM
Ah, ok. It seems that the
gdaldemcommand only comes with GDAL version 1.7.0 or higher, and the Ubuntu 10.10 and 11.04 versions of GDAL are both 1.6.3.Upgrading this library is somewhat complicated. You can get an installation package from the Ubuntu GIS PPA, however if you do that you will need to compile Mapnik from source as the pre-compiled packages rely on the old version.
Another option is compiling a newer version of GDAL without replacing your current version. That way you can use
/usr/local/bin/gdaldemto prepare your geotiffs. This option is probably simpler. Just a standard./configure && make && sudo make install.7 Posted by christ.stark on 28 Sep, 2011 04:40 PM
Ok, thanks. I did this, installed the newest gdal version1.8.1 with configure, make, make install. I think worked.
[...]
make[1]: Leaving directory/home/ubuntu/Downloads/gdal-1.8.1/apps' for f in LICENSE.TXT data/. ; do /home/ubuntu/Downloads/gdal-1.8.1/install-sh -c -m 0644 $f /usr/local/share/gdal ; done`But the gdal command doesn't seem to work:
ubuntu@ubuntu-VirtualBox:~/Downloads/gdal-1.8.1$ gdaldem color-relief brd-srtm-tm-mercator.tif ramp.txt brd-srtm-tm-mercator-farben.tif gdaldem: error while loading shared libraries: libgdal.so.1: cannot open shared object file: No such file or directoryor
ubuntu@ubuntu-VirtualBox:~/Downloads/gdal-1.8.1$ /usr/local/bin/gdaldem color-relief brd-srtm-tm-mercator.tif ramp.txt brd-srtm-tm-mercator-farben.tif /usr/local/bin/gdaldem: error while loading shared libraries: libgdal.so.1: cannot open shared object file: No such file or directoryDo you know if SAGA Gis or QGIS can also assign colors to geotiffs? Maybe that would be easier.
Support Staff 8 Posted by AJ on 28 Sep, 2011 05:28 PM
Does running this command help at all?
sudo ldconfigQGIS has a plugin that can color geotiffs, but I believe it relies on the same newer version of GDAL. I'm not familiar with SAGA GIS.
9 Posted by christ.stark on 28 Sep, 2011 05:43 PM
I don't get any output but also no error:
'root@ubuntu-VirtualBox:/home/ubuntu/Downloads/gdal-1.8.1# ldconfig root@ubuntu-VirtualBox:/home/ubuntu/Downloads/gdal-1.8.1# '
10 Posted by christ.stark on 28 Sep, 2011 05:44 PM
root@ubuntu-VirtualBox:/home/ubuntu/Downloads/gdal-1.8.1# ldconfig
root@ubuntu-VirtualBox:/home/ubuntu/Downloads/gdal-1.8.1#
Support Staff 11 Posted by AJ on 28 Sep, 2011 05:45 PM
No output is expected. Do you still get an error trying to run
/usr/local/bin/gdaldem color-relief ...?12 Posted by christ.stark on 28 Sep, 2011 05:56 PM
Hi, strangely now it worked.
root@ubuntu-VirtualBox:/home/ubuntu/Downloads/gdal-1.8.1# /usr/local/bin/gdaldem color-relief /home/ubuntu/Downloads/brd-srtm-tm-mercator.tif /home/ubuntu/Downloads/ramp.txt /home/ubuntu/Downloads/brd-srtm-tm-mercator-farben.tif
0...10...20...30...40...50...60...70...80...90...100 - done.
Thank you!
Support Staff 13 Posted by AJ on 28 Sep, 2011 06:11 PM
Glad it worked!
ldconfigrefreshes Linux's dynamically-linked library cache. (This usually happens automatically when you install a program, but I forgot this step is necessary when compiling a new program from source.)AJ closed this discussion on 28 Sep, 2011 06:11 PM.
Dane re-opened this discussion on 03 Oct, 2011 11:02 PM
Support Staff 14 Posted by Dane on 03 Oct, 2011 11:02 PM
Also, color information can now be dynamically assigned with mapnik: http://trac.mapnik.org/wiki/RasterColorizer, though it is not quite yet exposed in carto: https://github.com/mapbox/carto/issues/5
Will White closed this discussion on 24 Oct, 2011 03:47 PM.