[mapserver-users] Multi-Resolution Terrain Map File

Brent Fraser bfraser at geoanalytic.com
Tue Dec 27 22:24:11 EST 2011


Xander,

    You could have a look at using GDAL's virtual format (VRT) to point 
to your original data and specify the nodata value in the VRT (you could 
even get exotic by using TILEINDEXs of VRTS).

   Another option is to instead use the PROCESSING "LUT=..." directive.  
This may allow you to specify the target nodata value as well as the 
source nodata value when you tweak the directive for each of your 
elevation layers.  But I haven't tried it...

Best Regards,
Brent Fraser


On 12/27/2011 9:04 AM, Enzmann, Alexander R. wrote:
> Brent,
>
> Thanks for the tips.  Was able to make some progress.
>
> A couple of quick notes on the source data - it is either text based (.asc) or GeoTIFF.  In either case, individual pixels are 16 bit signed values (meters).  The intended use is to use it as terrain (WMS access to terrain information in .bil or .tif formats), not to generate colored images.  So while GDAL is great for turning the source uncompressed data into LZW compressed GeoTIFF files, the tools for shading/coloring aren't useful in this application.
>
> OFFSITE might work if I can figure out how to use it for a 16 bit signed value instead of RGB.  If I try something like this:
>      OFFSITE -9999
> The parse fails.  Using a color like this:
>     OFFSITE 0 0 0
> Gives a useable result, pulling content from the coarse (SRTM30) terrain when there are negative values in the higher resolution terrain.  I suspect it works for the wrong reason (e.g., negative values in the source data are mapped to the color 0).
>
> However, it isn't quite the right result.  What I'm really looking for is the ability to specify the value(s) where the source data has missing values (typically -9999 or -32768) or a range of data to ignore (Google Earth Fusion allows this) such as: -32768:-20000,-9999,0.
>
> Xander
>
> This is a nearly working .map file:
>
> # Query that would pull a piece of the earth:
> MAP
>    NAME "ASTER"
>    EXTENT -180 -90 180 90
>    SIZE 512 512
>    UNITS DD
>    IMAGETYPE bil
>
>    PROJECTION
>      "init=epsg:4326"
>    END
>
>    OUTPUTFORMAT
>      NAME "asc"
>      DRIVER "GDAL/AAIGrid"
>      MIMETYPE "application/asc"
>      EXTENSION "asc"
>      IMAGEMODE INT16
>    END
>
>    OUTPUTFORMAT
>      NAME "bil"
>      DRIVER "GDAL/EHdr"
>      MIMETYPE "image/bil"
>      EXTENSION "bil"
>      IMAGEMODE INT16
>    END
>
>    OUTPUTFORMAT
>      NAME "bil16"
>      DRIVER "GDAL/EHdr"
>      MIMETYPE "application/bil16"
>      EXTENSION "bil"
>      IMAGEMODE INT16
>    END
>
>    OUTPUTFORMAT
>      NAME "gtiff_16"
>      DRIVER "GDAL/GTiff"
>      MIMETYPE "image/tiff"
>      EXTENSION "tif"
>      IMAGEMODE INT16
>    END
>
>    WEB
>      IMAGEPATH "/tmp/"
>      IMAGEURL "/tmp/"
>      LOG "/tmp/srtm.err"
>      METADATA
>        wms_title "ASTER Terrain"
>        "ows_enable_request" "*"
>      END
>    END
>
>    #
>    # Coarse (30 ArcSecond) terrain.  There is worldwide coverage, so this
>    # is good for areas uncovered by SRTM data, as well as for high
>    # scale values.
>    #
>    LAYER
>      NAME "aster"
>      TILEINDEX "SRTM30/bathmetry.shp"
>      TYPE RASTER
>      STATUS ON
>
>      METADATA
>        "wms_title" "SRTM 30 ArcSecond Bathmetry"
>        "wms_group_title" "aster"
>        "wms_srs" "epsg:4326"
>        "wms_style" "Default"
>        "wms_extent" "-180 -90 180 90"
>      END
>
>      MAXSCALEDENOM 1000000000
>      MINSCALEDENOM          1
>    END
>
>    #
>    # Moderate resolution (1 ArcSecond) terrain.  Coverage is available worldwide
>    # for most land areas between latitudes -80 and +80.
>    #
>    LAYER
>      NAME "aster"
>      TILEINDEX "/mcgi/Terrain/asterz.shp"
>      TYPE RASTER
>      PROCESSING "RESAMPLE=BICUBIC"
>      STATUS ON
>
>      METADATA
>        "wms_title" "ASTER 1 ArcSecond Terrain"
>        "wms_group_title" "aster"
>        "wms_srs" "epsg:4326"
>        "wms_style" "Default"
>        "wms_extent" "-180 -80 180 80"
>      END
>
>      MAXSCALEDENOM 1000000
>      OFFSITE 0 0 0
>    END
>
> END
>
> -----Original Message-----
> From: Brent Fraser [mailto:bfraser at geoanalytic.com]
> Sent: Friday, December 23, 2011 9:01 PM
> To: Enzmann, Alexander R.
> Cc: mapserver-users at lists.osgeo.org
> Subject: Re: [mapserver-users] Multi-Resolution Terrain Map File
>
>    You could use the OFFSITE value in the higher resolution layer.
> Basically in this scheme, mapserver would render each layer, and any
> place with an OFFSITE value would show the value from the layer under
> it.
>
>    A more basic problem is how do you want the elevation value to be
> rendered  to a visible image?  You could use GDAL to pre-process the
> SRTM DEMs (http://www.perrygeo.net/wordpress/?p=7), or use mapserver to
> classify the DEM values to colors on the fly.
>
> Best Regards,
> Brent Fraser
>
>> How do I construct a map file that can handle different resolutions of
>> terrain, with fallback to lower resolution when a no-value is found?  In
>> Google Earth Fusion, I can specify multiple terrain sources and tell it
>> which value(s) represent missing data, and it will then process the
>> terrain, checking for availability of each type of terrain, falling back
>> if there isn't any in a geographic area and falling back if there is
>> missing data.
>>
>> For simple fallback based on area coverage, I can use a map file like the
>> one below (using 30 Arcsecond SRTM and 1 Arcsecond DTED).  Now, what would
>> I need to do to have it use/interpolate data from the 30 Arcsecond values
>> when there is a missing data/NODATA/hole in the DTED?  In the file below,
>> gdaltindex has been used to generate the coverage shapefiles.
>>
>> The example below is a simple one, and it would be really helpful to be
>> able to have multiple terrain sources and a way to automatically fill
>> voids the same way that transparency works with raster image layers.
>> Specifying that terrain values are posts and not pixels would be good too,
>> but lower priority.
>>
>> Xander
>
>



More information about the mapserver-users mailing list