NASA OnEarth WMS Service

Topics: Help
Feb 21, 2012 at 7:37 AM

Hi,

Thanks for making such a wonderful product.

Well, as I have very less knowledge about the coordinate projections, i am finding it difficult to get exact tile positions for the visible area, so as to creat the exact bounding box that might be supported by the OnEarth WMS server.

I am trying to fetch the layer whose capabilities xml is as mentioned below:

<Layer queryable="0"><Name>worldwind_dem</Name>      <Title>SRTM derived global elevation, 3 arc-second</Title>      <Abstract> A global elevation model, prepared from the 3 arc-second SRTM dataset by filling some of the problem areas. Prepared by the NASA Learning Technologies. The default style is scaled to 8 bit, non-linear. It is possible to request the elevation data in meters by the short_int tyle and requesting PNG format. The resulting PNG file will be a unsigned 16 bit per pixel image. The values are then the elevation in meters. Values are signed 16 bit integers, but PNG will present them as unsigned, leading to a few areas with very large values (65000+) For elevation values in feet, request PNG format with the style feet_short_int.      </Abstract>      <LatLonBoundingBox minx="-180" miny="-80" maxx="180" maxy="80"/>      <Style> <Name>default</Name> <Title>Default Elevation Style, scaled to 8 bit using a non-linear function</Title>      </Style>      <Style> <Name>short_int</Name> <Title>short int elevation values when format is image/png</Title>      </Style>      <Style> <Name>feet_short_int</Name> <Title>short int elevation values in feet when format is image/png</Title>      </Style>      <ScaleHint min="45" max="10000" />      <MinScaleDenominator>120000</MinScaleDenominator>    </Layer>

and GetMap url could be framed like :

http://wms.jpl.nasa.gov/wms.cgi?Service=WMS&VERSION=1.1.1&request=GetMap&layers=worldwind_dem&srs=EPSG:4326&width=300&height=300&format=image/png&styles=short_int&bbox={0},{1},{2},{3}

I am unable to compute the bounding box that will be supproted by this WMS Server.
I have tried this code in MakeTileImageUrl function
var px1 = Projection.FromTileXYToPixel(pos);
var px2 = px1;
px1.Offset(0,Projection.TileSize.Height);
PointLatLng p1 = Projection.FromPixelToLatLng(px1, zoom);
px2.Offset(Projection.TileSize.Width,0);
PointLatLng p2 = Projection.FromPixelToLatLng(px2, zoom);
return string.Format(CultureInfo.InvariantCulture,
                        UrlFormat,
                        p1.Lng,
                        p1.Lat,
                        p2.Lng,
                        p2.Lat,
                        Projection.TileSize.Width,
                        Projection.TileSize.Height);

Please, could anyone help me here to figure out how to calculate the bounding box supported by the WMS service.
Also, Please put some light how I can calculate the exact tile positions for the visible area for the same WMS service.
Coordinator
Feb 21, 2012 at 8:43 AM

http://onearth.jpl.nasa.gov/wms.cgi?request=GetMap&layers=global_mosaic&srs=EPSG:4326&format=image/jpeg&styles=&width=512&height=512&bbox=21.796875,54.84375,22.5,55.546875

and i get this:

<?xml version='1.0' encoding="UTF-8" standalone="no" ?>
<!DOCTYPE ServiceExceptionReport SYSTEM "http://wms.jpl.nasa.gov/exception_1_1_1.dtd ">
<ServiceExceptionReport version="1.1.1">
<ServiceException>
This server no longer provides full WMS services!
</ServiceException>
</ServiceExceptionReport> 

Feb 21, 2012 at 9:31 AM
Edited Feb 21, 2012 at 10:44 AM

Thanks for the quick reply. 

Well that is what the problem is, some facts found after much research:

  1. acceptable tile height and width is 300 by 300 only
  2. not able to find how bounding box is to be calculated.

Somewhere I found this code and utilized the same for MakeTileImageUrl:

var num = 1 << (11 - zoom);
        double MinLatitude = 90;
        double MinLongitude = -180;
        var width = 300 * num * 0.00083333333333333339;
        var extentsRect = new Rect(MinLongitude + (width * pos.X),
                                  (MinLatitude - (width * (pos.Y + 1))),
                                  width,
                                  width);
 
        return string.Format(CultureInfo.InvariantCulture,
                               UrlFormat,
                               extentsRect.Left,
                               extentsRect.Top,
                               extentsRect.Right,
                               extentsRect.Bottom,
                               Projection.TileSize.Width,
                               Projection.TileSize.Height);
dont know how it works, but the problem is works only for zoom level 2.
After so much search not able to figure out how I can use the wms service.However, somewhere I found the stats matrix for the wms service (might be wrong)
Height: 216000, Index: 0, PixelFormat: Gray16, Resolution: 1, ShiftX: 0, ShiftY: 0, SizeInBytes: 1940406272, TileCountX: 1440, TileCountY: 720, TileHeight: 300, TileWidth: 300, Width: 432000
Height: 108000, Index: 1, PixelFormat: Gray16, Resolution: 2, ShiftX: 0, ShiftY: 0, SizeInBytes: 588640256, TileCountX: 720, TileCountY: 360, TileHeight: 300, TileWidth: 300, Width: 216000
Height: 54000, Index: 2, PixelFormat: Gray16, Resolution: 4, ShiftX: 0, ShiftY: 0, SizeInBytes: 1220901888, TileCountX: 360, TileCountY: 180, TileHeight: 300, TileWidth: 300, Width: 108000
Height: 27000, Index: 3, PixelFormat: Gray16, Resolution: 8, ShiftX: 0, ShiftY: 0, SizeInBytes: 1378967296, TileCountX: 180, TileCountY: 90, TileHeight: 300, TileWidth: 300, Width: 54000
Height: 13500, Index: 4, PixelFormat: Gray16, Resolution: 16, ShiftX: 0, ShiftY: 0, SizeInBytes: 729000000, TileCountX: 90, TileCountY: 45, TileHeight: 300, TileWidth: 300, Width: 27000
Height: 6900, Index: 5, PixelFormat: Gray16, Resolution: 32, ShiftX: 0, ShiftY: 0, SizeInBytes: 186300000, TileCountX: 45, TileCountY: 23, TileHeight: 300, TileWidth: 300, Width: 13500
Height: 3600, Index: 6, PixelFormat: Gray16, Resolution: 64, ShiftX: 0, ShiftY: 0, SizeInBytes: 49680000, TileCountX: 23, TileCountY: 12, TileHeight: 300, TileWidth: 300, Width: 6900
Height: 1800, Index: 7, PixelFormat: Gray16, Resolution: 128, ShiftX: 0, ShiftY: 0, SizeInBytes: 12960000, TileCountX: 12, TileCountY: 6, TileHeight: 300, TileWidth: 300, Width: 3600
Height: 900, Index: 8, PixelFormat: Gray16, Resolution: 256, ShiftX: 0, ShiftY: 0, SizeInBytes: 3240000, TileCountX: 6, TileCountY: 3, TileHeight: 300, TileWidth: 300, Width: 1800
Height: 600, Index: 9, PixelFormat: Gray16, Resolution: 512, ShiftX: 0, ShiftY: 0, SizeInBytes: 1080000, TileCountX: 3, TileCountY: 2, TileHeight: 300, TileWidth: 300, Width: 900
Height: 300, Index: 10, PixelFormat: Gray16, Resolution: 1024, ShiftX: 0, ShiftY: 0, SizeInBytes: 360000, TileCountX: 2, TileCountY: 1, TileHeight: 300, TileWidth: 300, Width: 600
This might be helpful to you.

working url:
http://wms.jpl.nasa.gov/wms.cgi?Service=WMS&VERSION=1.1.1&request=GetMap&layers=worldwind_dem&srs=EPSG:4326&width=300&height=300&format=image/png&styles=short_int&bbox=-12,2,-4,10

Also, I am not able to understand why any bounding box that is contained within -180, -80, 180, 80 should work, but is not.
Feb 21, 2012 at 3:52 PM

It seems like I need to write a Projection class for it to work, so that the tile positions can be calculated correctly and therefore the tile bounds for url can be figured out correctly. Can anyone please help me here...