Enhanced Forecast - Marine - Image TileServer

Overview

  • Domain Portfolio: Weather Imagery
  • Domain: graphics - Tile
  • Usage Classification: Standard
  • Geography: Global
  • Attribution Required: No
  • Attribution Requirements: N/A

The Marine - Image Tile Server API features a set of tile-based products utilizing marine forecast data from the Global Forecast System (GFS) forecast model produced by the National Centers for Environmental Prediction (NCEP). It provides the ability to request tiles of varying resolution up to the data’s nativere resolution of ¼ degree (~27.5 km). The API provides a total of 7 days worth of data, delivering 3-hour windows across a span of 7 days with a new set of forecasts generated every 6 hours (00z, 06z, 12z, 18z). The Image Tile Server product provides access to mapping layers pre-rendered with appropriate palettes, ready to be applied to your base map. Layers are served as precut 256x256 png image files for interactive maps and other data visualization, addressed according to a XYZ tile address schema.

The process of identifying available layer data and corresponding layer tiles requires a 3-step process.

  1. Get Inventory Series List which returns the valid timeslice and metadata for each tile layer.
  2. Use the appropriate valid timeslice (ts & fts) as input to the timeslice parameters, and base map tile address as input into the XYZ parameter of the layer tile request.
  3. Get specified Layer Tiles using the data from the Inventory Series response as input into the ‘ts’ and ‘fts’ parameters.

HTTP Headers and Data Lifetime - Caching and Expiration

For details on appropriate header values as well as caching and expiration definitions, see The Weather Company Data | API Common Usage Guide.

Update Frequency

In the Inventory Series each available layer includes a time slice (ts); The time slice (ts) is an Epoch formatted time stamp. This timestamp is used as input into the atomic layer api request for the available layers (with the given timestamp). Each layer timestamp is updated on a frequency dependent on the layer type (Marine). A new Inventory Series request should be made at correlating intervals to the Layer type used in the client application.

For example: if the client application is using Marine layers, then the Inventory Series API should be made in at least 30 minute intervals.

Layer Type Update Frequency
GFS Global Wave Model Layers 6 Hours (00z, 06z, 12z, 18z)

URL Construction

Atomic API URL Examples:

Inventory Series List: Required Parameters: apiKey Optional Parameters:cb, filter

https://api.weather.com/v3/TileServer/series/productSet/marine?apiKey=yourApiKey

https://api.weather.com/v3/TileServer/series/productSet/marine?apiKey=yourApiKey

Optional cb parameter can be added (optional) if a jsonp callback is required. Get Inventory Series List with optional cb parameter:

https://api.weather.com/v3/TileServer/series/productSet/marine?cb=padding_wrapper&apiKey=yourApiKey

Optional filter parameter can be added (optional) to filter results on a specific product:

https://api.weather.com/v3/TileServer/series/productSet/marine?filter=primaryWaveDirection&apiKey=yourApiKey

Forecast Layer: Required Parameters: ts, fts, X:Y:Z, apiKey

https://api.weather.com/v3/TileServer/tile/<layer_name>?ts=<ts>&fts=<fts>&xyz=<X:Y:Z>&apiKey=yourApiKey

https://api.weather.com/v3/TileServer/tile/significantHeightofSwellWaves?ts=1428948600&fts=1428949000&xyz=0:0:1&apiKey=yourApiKey

Layer Name URL Example
Inventory Series https://api.weather.com/v3/TileServer/series/productSet/marine?apiKey=yourApiKey
GFS Global Wave Model Layers GFS Global Wave Model Layers
Forecast Layer - Significant height of combined wind waves and swell https://api.weather.com/v3/TileServer/tile/significantHeightofCombinedWindWavesAndSwell?ts=<ts>&fts=<fts>&xyz=<X:Y:Z>&apiKey=yourApiKey
Forecast Layer - Primary wave direction at surface https://api.weather.com/v3/TileServer/tile/primaryWaveDirection?ts=<ts>&fts=<fts>&xyz=<X:Y:Z>&apiKey=yourApiKey
Forecast Layer - Primary wave mean period at surface https://api.weather.com/v3/TileServer/tile/primaryWavePeriod?ts=<ts>&fts=<fts>&xyz=<X:Y:Z>&apiKey=yourApiKey
Forecast Layer - Significant height of primary swell waves https://api.weather.com/v3/TileServer/tile/significantHeightofSwellWaves?ts=<ts>&fts=<fts>&xyz=<X:Y:Z>&apiKey=yourApiKey
Forecast Layer - Primary swell direction https://api.weather.com/v3/TileServer/tile/directionofSwellWaves?ts=<ts>&fts=<fts>&xyz=<X:Y:Z>&apiKey=yourApiKey
Forecast Layer - Primary swell mean period at surface https://api.weather.com/v3/TileServer/tile/periodofSwellWaves?ts=<ts>&fts=<fts>&xyz=<X:Y:Z>&apiKey=yourApiKey
Forecast Layer - Significant height of primary wind waves at surface https://api.weather.com/v3/TileServer/tile/significantHeightofWindWaves?ts=<ts>&fts=<fts>&xyz=<X:Y:Z>&apiKey=yourApiKey
Forecast Layer - Primary wind waves direction at surface https://api.weather.com/v3/TileServer/tile/directionofWindWaves?ts=<ts>&fts=<fts>&xyz=<X:Y:Z>&apiKey=yourApiKey
Forecast Layer - Primary wind waves mean period at surface https://api.weather.com/v3/TileServer/tile/periodofWindWaves?ts=<ts>&fts=<fts>&xyz=<X:Y:Z>&apiKey=yourApiKey
Forecast Layer - Ten-meter wind direction https://api.weather.com/v3/TileServer/tile/marineWindDirection?ts=<ts>&fts=<fts>&xyz=<X:Y:Z>&apiKey=yourApiKey
Forecast Layer - Ten-meter wind speed at specified height level above ground https://api.weather.com/v3/TileServer/tile/marineWindspeed?ts=<ts>&fts=<fts>&xyz=<X:Y:Z>&apiKey=yourApiKey

NOTE: Products make use of a land/sea mask to exclude data over bodies of land.

Retrieving Tiles:

Request a 256x256 image tile or UTFGrid for a given layer. The XYZ parameters must be integer coordinates describing the tile position according to the XYZ tiling scheme. Once the client has parsed the series list and determined what layer they wish to display, they then need to request the appropriate tiles for their base map viewport. If the viewport contains tile addresses outside of this window, no call is needed as the tile will be empty. Clients will use the data returned in the Inventory Series response as input into the layer tile request via a series of calls, providing the layer, timestamp, and the X:Y:Z tile address.

Data Elements & Definitions

Field Name Description Type Sample
Inventory Series      
seriesInfo

The seriesInfo describes the available layers and the relevant information in the response to make the secondary call for the actual tiles and include:

  • layer name: e.g. “marineWindspeed”

  • native zoom level: e.g. “nativeZoom”:6,

  • max zoom level: e.g. “maxZoom”:11,

  • bounding box defining opposite corners of the available region

  • series is time slice data required for secondary call for layer imagery

object

{

"seriesInfo": {

"marineWindspeed": {},

"marineWindDirection":{},

}

}

nativeZoom The native zoom level is the default zoom level for the corresponding image. integer 6
maxZoom The max zoom level is the maximum zoom level available for the corresponding image. integer 11
bb

The bounding box (bb) defines the top left tile (tl) and bottom right (br) tile of the bounding box using the geocode locations defined by latitude (lat) and longitude (lng) tile address scheme. The bb (bounding box for valid tile addresses, defined by opposing geocodes) & Equates to Layer Tile Input - Valid X:Y:Z addresses within the bounding box, defined by two geocodes.

tl : Top Left Corner, lat: top left latitude, lng: top left longitude

br: Bottom Right Corner, lat: bottom right latitude, lng: bottom right longitude

Base Map tile address: e.g.

  • Google = XYZ scheme

  • Mapbox = XYZ scheme

  • Bing = Quadkey scheme

decimal

"bb": {

"tl": {

"lat": "-180.05",

"lng": "90.05"

},

"br": {

"lat": "180.05",

"lng": "-90.05"

}

},

tl The response which defines the top left tile address defining the bounding box of the layer, tile addresses falling outside the bounding box will always be empty. decimal

"lat": "-180.05",

"lng": "90.05"

br The response which defines the bottom right tile address defining the bounding box of the layer, tile addresses falling outside the bounding box will always be empty. decimal

"lat": "180.05",

"lng": "-90.05"

series The series provides the relevant details required to pull the tiles associated with a layer, with the details contained in an array of values, associating each available time slice (ts) with a set of corresponding forecast time slices (fts). epoch

{

"ts": 1437425100,

"fts": [1437445800]

},

ts The time slice (ts) is an Epoch formatted time stamp. The example (ts) equates to: GMT: Mon, 20 Jul 2015 20:30:00 GMT epoch 1437424200
fts Forecast Time Slice (fts) is an Epoch formatted time stamp. The example (fts) equates to: GMT: Tue, 21 Jul 2015 02:00:00 GMT epoch 1437444000
Tile Layers      
ts The time slice (ts) is an Epoch formatted time stamp. The example (ts) equates to: GMT: Mon, 20 Jul 2015 20:30:00 GMT epoch 1437424200
fts Forecast Time Slice (fts) is an Epoch formatted time stamp. The example (fts) equates to: GMT: Tue, 21 Jul 2015 02:00:00 GMT epoch 1437444000
xyz

The xyz is the tile address scheme. Each tile is given an X and Y coordinate ranging from (0) in the upper left to (2zoom -1, 2zoom -1) in the lower right of a Mercator Projected map.

  • x ranges from 0 (left edge is 180°W) to 2zoom -1 (right edge is 180°E) with TileX = floor(mapPixelX / 256)

  • y ranges from 0 (top edge is 85.0511°N) to 2zoom -1 (bottom edge is 85.0511°S) with TileY = floor(mapPixelY/256)

  • z is the zoom level defined for the image

integer 0:0:1

JSON Sample - The Series List:

The Image Tile Server API will serve a series list, in Json / Jsonp, which will describe the layers that are available, the time slices which are currently available, the native zoom for the layer, the maximum zoom for the layer, and a bounding box confining the layer. The Series list will contain entries for each layer such as:

Forecast Layer: marineWindspeed
{
"seriesInfo": {
"marineWindspeed": {
"nativeZoom": 5,
"maxZoom": 13,
"bb": {
"tl": {
"lat": "-180.0",
"lng": "90.0"
},
"br": {
"lat": "179.959936523",
"lng": "-90.00000762939453"
}
},
"series": [
{
"ts": 1458304200,
"fts": [
1458329400,1458328500,1458327600,1458326700,1458325800,1458324900,1458324000,1458323100,1458322200,1458321300,1458320400,1458319500,1458318600,1458317700,1458316800,14583159
00,1458315000,1458314100,1458313200,1458312300,1458311400,1458310500,1458309600,1458308700,1458307800,1458306900,1458306000,1458305100]
},
{
"ts": 1458303300,
"fts": [] (fts Series data collapsed for presentation only)
}
]
},
"marineWindDirection": {}, (Layer & Series data collapsed for presentation only)
“significantHeightofCombinedWindWavesAndSwell”: {},
“significantHeightofCombinedWindWavesAndSwell”: {} (Additional layers omitted for presentation only)
}
}

Address Tile Scheme

Converting between QuadKey and XYZ:

The subsequent tile layer requires a tile address in the XYZ scheme. The XYZ parameters must be integer coordinates describing the tile position according to the XYZ tiling scheme.

The tile address format is determined by the underlying base map that a client chooses to use. For example:

  • Google uses XYZ scheme

  • Mapbox uses XYZ scheme

  • Bing uses the QuadKey scheme

The Bing Base Map tile address requires conversion from QuadKey to the XYZ scheme; see linked reference: - Bing Maps Reference - https://msdn.microsoft.com/en-us/library/bb259689.aspx.

Example code to convert the QuadKey tile address to XYZ scheme

object QuadKey {
  def getQuadKey(x:Int, y:Int, level:Int):String = {
    val quadKey = new StringBuilder()
    (level to 1 by -1).foreach( zoomLevel => {
      val mask = 1 << (zoomLevel-1)
      quadKey.append(appendValue( (x & mask) != 0, (y & mask) != 0) )
    })
    quadKey.toString()
  }
  def appendValue(xMask:Boolean, yMask:Boolean):Int = (xMask,yMask) match {
    case (true, true) => 3
    case (_, true)    => 2
    case (true, _)    => 1
    case _            => 0
  }

  def getXYZoom(quadKey:String):XYZ =
 {
    var x = 0
    var y = 0
    var zoom = quadKey.length

    (zoom to 1 by -1).foreach(i => {
      val mask = 1 << (i - 1)
      val cell = quadKey.charAt(zoom - i).toInt
      if ((cell & 1) != 0)
      {
        x = x + mask
      }
      if ((cell & 2) != 0)
      {
        y = y + mask
      }
    })
    XYZ(x, y, zoom)
  }}

object QuadKey {

def getQuadKey(x:Int, y:Int, level:Int):String = {

val quadKey = new StringBuilder()

(level to 1 by -1).foreach( zoomLevel => {

val mask = 1 << (zoomLevel-1)

quadKey.append(appendValue( (x & mask) != 0, (y & mask) != 0) )

})

quadKey.toString()

}

def appendValue(xMask:Boolean, yMask:Boolean):Int = (xMask,yMask) match {

case (true, true) => 3

case (_, true) => 2

case (true, _) => 1

case _ => 0

}

def getXYZoom(quadKey:String):XYZ =

{

var x = 0

var y = 0

var zoom = quadKey.length

(zoom to 1 by -1).foreach(i => {

val mask = 1 << (i - 1)

val cell = quadKey.charAt(zoom - i).toInt

if ((cell & 1) != 0)

{

x = x + mask

}

if ((cell & 2) != 0)

{

y = y + mask

}

})

XYZ(x, y, zoom)

}}

Base Map Implementation: Google

Using the Google API, a custom weather layer is done by extending the ImageMapType. The Google API will make a number of calls to the ImageMapType.getTile() when the layer is displayed. The getTile() function takes the tileCoord: Point, and a zoom: Int variable, which create the XYZ parameter needed in the Tile request url.

Weather Imagery Layers: Color Palette Legends

Please use SSDS Catalog for additional information on palettes.

significantHeightofCombinedWindWavesAndSwell : Forecast Layer - Significant height of combined wind waves and swell

significantHeightofSwellWaves : Forecast Layer - Significant height of primary swell waves

significantHeightofWindWaves : Forecast Layer - Significant height of primary wind waves at surface

Weather image color palette 1

primaryWaveDirection : Forecast Layer - Primary wave direction at surface

directionofSwellWaves : Forecast Layer - Primary swell direction

directionofWindWaves : Forecast Layer - Primary wind waves direction at surface

marineWindDirection : Forecast Layer - Ten-meter wind direction

Weather image color palette 2

primaryWavePeriod : Forecast Layer - Primary wave mean period at surface

periodofSwellWaves : Forecast Layer - Primary swell mean period at surface

periodofWindWaves : Forecast Layer - Primary wind waves mean period at surface

Weather image color palette 3

marineWindspeed : Forecast Layer - Ten-meter wind speed at specified height level above ground

Weather image color palette 4

Document Revision History

Revision Date Notes
1.0 March 30, 2021 Initial versioned document;
1.1 April 14, 2021 Added associated colortables;