You have two options for visualizing Web Map Service (WMS) data in LuciadRIA: you can either visualize it as tiled data or as images. This article discusses the differences between the two options, and recommends the best approach for your WMS visualization needs.

WMS is a web service that can generate an image from a part of a map. You can configure:

  • The resolution of the image in number of pixels

  • A bounding box that defines the part of the world you want to show

  • The WMS layers that contain the data you want to visualize alongside other parameters.

For more information about visualizing WMS data, see the OGC WMS documentation.

What does LuciadRIA offer for WMS visualization?

LuciadRIA offers API components for tuning the visualization to your needs. To choose the most suitable components, you typically need to make a trade-off between:

  • Performance: WMS is flexible by nature, but not necessarily fast. You can visualize WMS data quickly in LuciadRIA, but with reduced visualization quality.

  • Quality: if visualization quality is crucial for your application, you can choose to visualize WMS data with a higher visual fidelity, but with performance drawbacks.

This article provides you with the technical background necessary to make an informed decision.

Deciding between WMS visualization options

Table 1. Overview of WMS model pros and cons
Options What does it do? Pros ✔ Cons ⛔ Recommended for

WMSTileSetModel

The WMSTileSetModel defines a multi-leveled tile structure on top of the WMS.

When it visualizes the WMSTileSetModel in a RasterTileSetLayer, LuciadRIA defines a tile structure on your WMS data, and calculates what tiles are in the view. Next, it loads images from the WMS server that correspond with the pixel size and bounds of the tiles.

Fast

LuciadRIA caches the WMS images, and re-uses the tiles available in the cache.

Supported on WebGL maps

Lower quality

  • The application only shows defined tile levels. If you navigate the map to a scale level between two tile levels, LuciadRIA renders the tile level closest to that scale level, possibly with unexpected results.

  • WMS isn’t aware of the tiling structure imposed by LuciadRIA. This may result in visual artifacts, like cut-off or duplicated labels.

Serving satellite imagery as background data.

WMSImageModel

The LuciadRIA map sends an image request to the WMS server each time you pan or zoom the map.

High quality and fidelity

The WMS server generates an image that corresponds exactly to the size and the scale level of the map.

Slower

When you navigate the map, LuciadRIA discards the current WMS image, and you have to wait for the WMS server to update the map with a new image. The selected image format has a significant impact on performance.

Not supported on WebGL maps

  • Rendering a WMS layer with labels

  • Visualizing WMS data for which you defined exact, scale-level-dependent styling.

You can try out both the tiled and non-tiled visualization approach in the Data Formats sample.

If you’re using a hardware-accelerated WebGL map, you can select only a WMS tileset model. You can associate any coordinate reference system with the model. On a 2D WebGL map, choose the map reference for the highest quality. On a 3D WebGL map, using the WGS-84 reference is recommended.

If you are using a map that’s not hardware-accelerated, you can choose between a WMS tileset or image model. The reference associated with the WMS model must be the same as the map reference.

Visualizing WMS data quickly

The fastest way to visualize image raster data is by tiling the data. The WMSTilesetModel defines a multi-leveled tile structure on top of the WMS. WMS isn’t tiled by nature, but LuciadRIA can still render WMS data in a tiled way. When it visualizes the WMSTileSetModel in a RasterTileSetLayer, LuciadRIA defines a quad tree tile structure on your WMS data. Depending on your view parameters for scale and view extent, LuciadRIA calculates what tiles are in the view. Next, it loads images from the WMS server that correspond with the size and bounds of the tiles.

The advantage of this approach that LuciadRIA can cache those WMS images. When you pan or zoom the map, it can typically re-use a large number of tiles, which results in a much more interactive map. It must download only uncached tiles that weren’t visible before from the WMS server.

The disadvantage of WMS data tiling is that it reduces the quality of the raster data and may result in strange visual artifacts. For example:

  • LuciadRIA shows only defined tile levels. If you navigate the map to a scale level that sits between two tile levels, LuciadRIA renders the tile level closest to that scale level. If your WMS server applies a distinct style level at that map scale, the visualization results may not be what you expect. In that case, you should use a WMSImageModel.

  • WMS isn’t aware of the tiling structure imposed by LuciadRIA. If the generated WMS image has labels, these labels may end up in a different position on two adjacent tiles. This might result in unwanted artifacts where labels are cut off at the tiling boundary, or labels for a single object appear more than once.

If you use a Luciad WMS server, you have several options for reducing or preventing those effects: you can use label placers that avoid placing a label that crosses the boundary of a map request or that place only one label for a given feature, and place it always at its focus point for example.

Visualizing WMS data with high quality

To visualize WMS data in LuciadRIA with the best possible quality, use a WMSImageModel in combination with a WMSImageLayer. If you use those components, the LuciadRIA map sends a request to the WMS server each time you pan or zoom the map.

The advantage of this approach is that it yields the best visualization fidelity. The WMS server generates an image that corresponds exactly to the scale level of the map, given the width and height of your map and the mapBounds that you want to see.

The disadvantage is reduced performance: LuciadRIA discards the WMS image displayed before you navigated the map because it can no longer use it. Depending on the speed at which the WMS server can render images, you may have to wait a long time before the map updates.

Also note that the selected image format has a significant impact on performance. For example, encoding to image/jpeg is typically a lot faster than encoding to image/png. That’s why image/jpeg is the preferred format for satellite imagery without transparent sections.

Choosing a WMS visualization strategy based on the nature of your data

These are some guidelines for choosing a strategy based on the type and purpose of the data you want to display:

  • If you use WMS to serve satellite imagery as background data, you’re better off using a tiled visualization approach.

  • If your WMS layer is rendered with labels, you’re better off using an image approach.

  • If you have exact, scale-level-dependent styling in place for your WMS data, you’re better off using an image approach. The tiling visualization approach only shows data at pre-defined scale levels and doesn’t generate images between tile levels. You can’t choose the scale levels that the WMSTileSetModel generates.

Using BASE layers in your map

You can define a layer type for a layer in LuciadRIA. If you add a RasterTileSetLayer with LayerType BASE to the map, the map always snaps to a tile level when you zoom in and out on the map. As a result, LuciadRIA renders the background raster data with the best visual quality, because it doesn’t scale the tiles.

LuciadRIA renders vector data on top of the base layer accurately. It may scale raster layers on top of the base layer, though, if their tile tree structure doesn’t correspond with the tile tree structure of the base layer. It decides the tile tree structure by the bounds of the model, the size of the tiles, and the number of tile rows and columns at tile level 0.