netCDF to color GEOTIFF
Andrea MARELLI
andrea.marelli at EXT.JRC.IT
Wed Nov 30 02:01:34 PST 2005
Hi Alaric,
I've spent 2 weeks trying to display maps from netcdf files and now, with
Norman Barker's help, I can do it.
You don't need to convert into GeoTiff, but you can open directly from
NetCDF.
Try to open the mapfile below with this URL:
http://myhost/cgi-bin/mapserv?map=test.map&mode=map&layer=sst
&map_projection=init=epsg:4326
ATTENTION!!!: you must force the projection in the URL
########## MAP FILE ##############
MAP
NAME "test"
EXTENT -20 22 45 75
SHAPEPATH "/data"
IMAGETYPE PNG24
SIZE 740 602
UNITS dd
DEBUG on
PROJECTION
"proj=latlong"
"init=epsg:4326"
END
LAYER
NAME "sst"
STATUS ON
TYPE RASTER
DUMP TRUE
DATA "sst.nc" #Your NetCDF file. It MUST be CF compliant!!!!!!
PROJECTION
"proj=latlong"
"init=epsg:4326"
END
PROCESSING "SCALE=-10,40"
PROCESSING "SCALE_BUCKETS=50"
CLASS
NAME "30"
EXPRESSION ([pixel] >= 30)
COLOR 79 8 8
END
CLASS
NAME ""
EXPRESSION ([pixel] >= 29 and [pixel] < 30)
COLOR 104 8 8
END
CLASS
NAME "28"
EXPRESSION ([pixel] >= 28 and [pixel] < 29)
COLOR 176 8 8
END
CLASS
NAME ""
EXPRESSION ([pixel] >= 27 and [pixel] < 28)
COLOR 200 8 8
END
CLASS
NAME "26"
EXPRESSION ([pixel] >= 26 and [pixel] < 27)
COLOR 224 64 8
END
CLASS
NAME ""
EXPRESSION ([pixel] >= 25 and [pixel] < 26)
COLOR 224 112 8
END
CLASS
NAME "24"
EXPRESSION ([pixel] >= 24 and [pixel] < 25)
COLOR 224 160 8
END
CLASS
NAME ""
EXPRESSION ([pixel] >= 23 and [pixel] < 24)
COLOR 224 208 8
END
CLASS
NAME "22"
EXPRESSION ([pixel] >= 22 and [pixel] < 23)
COLOR 232 232 8
END
CLASS
NAME ""
EXPRESSION ([pixel] >= 21 and [pixel] < 22)
COLOR 160 224 8
END
CLASS
NAME "20"
EXPRESSION ([pixel] >= 20 and [pixel] < 21)
COLOR 112 208 8
END
CLASS
NAME ""
EXPRESSION ([pixel] >= 19 and [pixel] < 20)
COLOR 72 184 8
END
CLASS
NAME "18"
EXPRESSION ([pixel] >= 18 and [pixel] < 19)
COLOR 56 152 8
END
CLASS
NAME ""
EXPRESSION ([pixel] >= 17 and [pixel] < 18)
COLOR 8 136 8
END
CLASS
NAME "16"
EXPRESSION ([pixel] >= 16 and [pixel] < 17)
COLOR 8 128 80
END
CLASS
NAME ""
EXPRESSION ([pixel] >= 15 and [pixel] < 16)
COLOR 8 144 80
END
CLASS
NAME "14"
EXPRESSION ([pixel] >= 14 and [pixel] < 15)
COLOR 8 160 80
END
CLASS
NAME ""
EXPRESSION ([pixel] >= 13 and [pixel] < 14)
COLOR 8 184 112
END
CLASS
NAME "12"
EXPRESSION ([pixel] >= 12 and [pixel] < 13)
COLOR 8 224 112
END
CLASS
NAME ""
EXPRESSION ([pixel] >= 11 and [pixel] < 12)
COLOR 8 232 200
END
CLASS
NAME "10"
EXPRESSION ([pixel] >= 10 and [pixel] < 11)
COLOR 8 232 232
END
CLASS
NAME ""
EXPRESSION ([pixel] >= 9 and [pixel] < 10)
COLOR 8 200 200
END
CLASS
NAME "8"
EXPRESSION ([pixel] >= 8 and [pixel] < 9)
COLOR 8 168 168
END
CLASS
NAME ""
EXPRESSION ([pixel] >= 7 and [pixel] < 8)
COLOR 8 136 160
END
CLASS
NAME "6"
EXPRESSION ([pixel] >= 6 and [pixel] < 7)
COLOR 8 104 152
END
CLASS
NAME ""
EXPRESSION ([pixel] >= 5 and [pixel] < 6)
COLOR 8 96 120
END
CLASS
NAME "4"
EXPRESSION ([pixel] >= 4 and [pixel] < 5)
COLOR 8 56 104
END
CLASS
NAME ""
EXPRESSION ([pixel] >= 3 and [pixel] < 4)
COLOR 8 32 120
END
CLASS
NAME "2"
EXPRESSION ([pixel] >= 2 and [pixel] < 3)
COLOR 8 8 176
END
CLASS
NAME ""
EXPRESSION ([pixel] >= 1 and [pixel] < 2)
COLOR 8 8 240
END
CLASS
NAME "0"
EXPRESSION ([pixel] >= 0 and [pixel] < 1)
COLOR 144 8 240
END
CLASS
NAME ""
EXPRESSION ([pixel] < 0)
COLOR 144 0 111
END
END
TEMPLATEPATTERN 'template*'
WEB
TEMPLATE 'template.php'
IMAGEPATH 'temp/'
IMAGEURL 'http://myhost/temp/'
LOG '/temp/mapserver.log'
END
END
############# END OF MAPFILE #################
Hope it will works!!
Bye,
Andrea
-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of Alaric S. Haag
Sent: Tuesday, 29 November, 2005 20:02
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: [UMN_MAPSERVER-USERS] netCDF to color GEOTIFF
Hello all, (my first post...)
I have been working with mapserver and the FWTools package, etc, for a few
weeks. I hope this question isn't too far off the mapserver-sepcific realm.
And please forgive the length of the post, just trying to be thorough.
Short question: How are people generating COLOR GeoTIFFs?
My goal is to render satellite images (spec. sea-surface temps) as a raster
layer IN COLOR. I can get the data to a netCDF, or even HDF. With
"gdal_translate" I can get a grayscale GeoTIFF that mapserver displays fine.
Ideally, I'd like to render essentially with a "value palette" (ala GMT .cpt
files), that is, render value (ranges) with assigned color (ranges). I'm
imagining others need similar capabilities, so I'm hoping someone can point
me in the right direction.
I thought I was getting close by pulling the GeoTIFF into OpenEV and
"reclassifying" and exporting, but the result seems to be an 32-bit RGBA
that mapserver can't (?) display. I have "mogrify'd" that down to 256
colors, but get grayscale back ("ColorInterp=Gray" is there a way to change
that?)
A few caveats:
- I'd like to avoid "commercial" solns like ERDAS, or Arc...
- I'd love a command-line solution that I can "cron"...
Am I just looking at a GDAL library coding project?
Thanks for any feedback!
Alaric
More information about the MapServer-users
mailing list