Announcement

Collapse
No announcement yet.

Worldwind and mapserver WMS: serving DTED elevation data

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Worldwind and mapserver WMS: serving DTED elevation data

    Dear All,

    I definitely and successfully have used Worldwind WMS Server (WW api 1.5.0) for serving DTED files before and am very satisfied with it (quite responsive and accurate).
    But, because "better is always enemy to the good", I am trying to set up a map file in my new mapserver installation with DTED layers. So far I am successfully serving raster tiles of other kind like MrSID and GeoTiff.

    As a starting point I used information in http://forum.worldwindcentral.com/sh...erver-Question and http://forum.worldwindcentral.com/sh...a-to-WorldWind.

    Is there any possibility for any one of you to show me an example DTED layer in the top map file of a mapserver (latest edition deployed in a Linux VM)?
    Should I merge all DTED files in DTED1 and DTED2 with gdal_warp and how? (So far I tried to convert all dt1 and dt2 files into geotiff with gdal_translate and then merge them with gdal_merge.py into one geotiff. Then I wrote a LAYER in my top map file serving it as raster but I had no success).

    Thanks in advance and Best Regards...
    Nick
    Last edited by nbellsp; 06-09-2015, 04:50 AM.

  • #2
    SOLVED: Worldwind and mapserver WMS: serving DTED elevation data

    Dear All,

    After about a month of experimenting I finally managed to serve DTED files with BIL format from my mapserver Linux installation.
    As you may know, DTED files come in the form of DTED0/<Dir1>/<file1>.dt0...DTED0/<DirN>/<fileN>.dt0, DTED1/<Dir1>/<file1>.dt1...DTED1/<DirN>/<fileN>.dt1 and DTED2/<Dir1>/<file1>.dt2...DTED0/<DirN>/<fileN>.dt2.
    First thing is to use gdalwarp (you need to install gdal) to mosaic (connect together) all .dt0s, .dt1s and .dt2s inside each Dir. For example:
    cd DTED1
    gdalwarp E006/*.dt1 e1_006.tif
    gdalwarp E007/*.dt1 e1_007.tif
    ........................................ .. (or create a script for such a job)
    Then: gdalwarp *.tif dted1.tif (mosaicing all files in DTED1)
    You do the same for DTED2 files and produce one dted2.tif mosaic.
    Then use gdal_merge -o dted_whole.tif -co "TILED=YES" -co "BLOCKXSIZE=256" -co "BLOCKYSIZE=256" -co "BIGTIFF=YES" -co "COMPRESS=JPG" dted1.tif dted2.tif to produce the final tiled mosaic of dted raster (dted_whole.tif).
    Now you are ready to go with a map file as the attached one...mapfile.map.txt

    Finally in your program use the following code to get elevations:

    // Parse the capabilities document from the WMS
    final String GET_CAPABILITIES_URL = "http://localhost/wms?request=getCapabilities";
    WMSCapabilities caps = WMSCapabilities.retrieve(new URI(GET_CAPABILITIES_URL));
    caps.parse();

    // Configure parameters for the Spearfish elevation model.
    AVList params = new AVListImpl();
    params.setValue(AVKey.LAYER_NAMES, "dtedElev");
    params.setValue(AVKey.DATA_CACHE_NAME, "Earth/DTEDElev");
    params.setValue(AVKey.IMAGE_FORMAT, "application/bil16");
    params.setValue(AVKey.BYTE_ORDER, AVKey.LITTLE_ENDIAN);
    params.setValue(AVKey.MISSING_DATA_SIGNA L, -9.999999933815813E36);

    Factory factory = (Factory) WorldWind.createConfigurationComponent(A VKey.ELEVATION_MODEL_FACTORY);
    final ElevationModel spearfish = (ElevationModel) factory.createFromConfigSource(caps, params);

    Globe globe = worldWindowGLCanvas1.getModel().getGlobe (); //worldWindowGLCanvas1 is the WWGL instance you may declare in your program
    globe.setElevationModel(spearfish);

    That's it...Best Regards...
    Nick
    Last edited by nbellsp; 06-08-2015, 07:32 PM.

    Comment


    • #3
      I am using mapserver v6 and having the following issues:
      1. The attached map file gives me an error when I queried the mapserver for capabilities:
      ======================================== ================================
      <Layer queryable="0" opaque="0" cascaded="0">
      <Name>dtedElev</Name>
      <Title>DTEDElevations</Title>
      <!--
      WARNING: Optional Ex_GeographicBoundingBox could not be established for this layer. Consider setting the EXTENT in the LAYER object, or wms_extent metadata. Also check that your data exists in the DATA statement
      -->
      <Attribution>
      <Title>DTED Elevations</Title>
      </Attribution>
      </Layer>
      ======================================== ================================


      To fix this warning, I added the following line to the map file:
      ======================================== =================================
      LAYER
      NAME "dtedElev"
      METADATA
      "wms_title" "DTEDElevations"
      "wms_attribution_title" "DTED Elevations"
      "wms_extent" "-180 -90 180 90" <<<<<<<----------I added this line. Not sure what the right values to use here
      END
      TYPE RASTER
      STATUS ON
      DATA ELEVATIONS/DTED/dted_whole.tif
      END # LAYER
      ======================================== ==================================


      2. After adding the wms_extent to get rid off the Warning, my client (Java) WW (as posted in post #2 above) always show elevation of 0. So, I don't think the client is receiving the elevation from the mapserver. Can someone help?

      Comment

      Working...
      X