Example: Connect to a WMS Server for National Map Layers

Manifold's WMS Server dataport connects to web servers using the Web Map Service (WMS) protocol developed by the Open Geospatial Consortium (OGC).  WMS servers provide raster data, that is, images.   They do not provide vector drawings.  


 This topic uses a connection to a web server that is operated by a third party.   Web servers operated by third parties may change their access policies, use different URLs, go offline, or be very slow.  If you have any connection problems with the server in this topic, review the Notes at the end of the Web Servers topic for tips.


In this example, we will connect to a US government server to use a National Map layer that shows shaded relief from USGS.   


In our browser (Microsoft's Bing browser is illustrated) we can visit the National Map page at https://apps.nationalmap.gov/services/ for links to a variety of example WMS servers operated by the US government.  There are numerous layers for the US and some for the entire world.  The USGS also provides a services status page at https://apps.nationalmap.gov/services/  to help debug connections if a service does not seem to be working.


The USGS changes links from time to time.  If the link above does not work, try searching for USGS National Map Web Services in your favorite Internet search engine.  



We click on the Base Maps bar in the web site.



There are many layers available in the Base Maps section.  We scroll the page down to the USGS Shaded Relief entry.   That provides several choices for web server formats, including WMS.   We right-click onto the WMS link.



In the menu that pops open for the WMS link, we choose Copy link from the menu.   The URL we copy is:




The URL above is all on one line.  If the browser displaying this topic wraps it into two lines, when using the URL above make sure to copy and paste it as a single line.

Create a Web Server Data Source

In Manifold, choose File - Create - New Data Source from the main menu, or right-click in the Project pane and from the menu choose Create - New Data Source.



Choose More... to launch the New Data Source dialog.



Enter Shaded Relief as the Name.  We can enter whatever name we like, but it is wise to specify a name that reminds us of what this data source contains.


Choose Web Server: wms as the Type.   


In the Source box we paste the URL connection string we copied earlier:




  Checking or unchecking the Cache data box, which is checked by default, has advantages and disadvantages depending on how fast the server is.  Checking the box stores in cache memory everything Manifold downloads from the server, so that subsequent operations, such as panning and zooming, can take the data from cache and not have to download it again. However, that can result in a fuzzier display than pulling fresh tiles for each view by unchecking the box.  If the server is fast or if we want the sharpest display possible, uncheck the box.  See the discussion at the end of the WMS Servers topic.  


Press Create Data Source.


A new data source called Shaded Relief appears in the Project pane.



We can expand the data source to see it contains a image and the image's table.  This particular WMS server has only a single image layer that it provides, but some WMS servers can provide many layers, even hundreds of layers, which will appear within the hierarchy of folders in the data source.


We could use the image from the data source as is, but it would be more convenient to create a local copy of the image in the project, which we can Style, and to then create a map from that local image. 


For the difference between parts of the project that are resident in remote data sources and those parts of the project that are resident locally, see the Portals to Other Worlds discussion in the  Project Pane topic.

Create a Local Copy of the Image

To give us flexibility styling the image that is served by the WMS server, we will make a local copy of the image, but not the table.



We click the 0 Image to highlight it and press Ctrl-C, the Windows keyboard shortcut for Copy.   Next, we right-click down in the local part of the project, in the blank area below the Map component, and we choose Paste.   


We can use any combination of the usual moves for copy and paste.   For example, after highlighting the 0 Image within the data source, we could have chosen Edit - Copy in the main menu, or we could have pressed the Copy icon in the Project pane toolbar.  Or, we could have right-clicked the 0 Image within the data source and chosen Copy from the context menu.  Likewise, to Paste, we could have clicked into the lower portion of the Project pane and pressed Ctrl-V, the Windows keyboard shortcut for Paste, and so on.



That creates a local copy of the image, also called 0 Image, which we can use as it if were the original image in the data source.   The image we have just created takes its data from the table that is within the data source, but because it is a local structure under our full control in the local project, we can Style it as we like.


Since 0 Image is a goofy, uninformative name for a layer in our project, we take a moment to rename the copy Relief.  

Create a Map

It is convenient to work with layers within a map, so we can always have a "known good" background layer for context.



We create a map by right-clicking into the Relief image and choosing Create - New Map.  



The Relief layer automatically appears as a layer for the new map.  For a base layer, we use the default Bing streets background layer, one of the standard Favorites built into Manifold.


Press Create Map.   A new map appears in the Project pane.


We double-click the Map to open it.


  If we are following along in this example and repeating it, we should be aware that layers served from the National Map servers can sometimes be slow.  This is not Manifold being slow: it is simply a slow server.



The map opens up zoomed to fit, with the Relief layer showing the entire world.  



We zoom further into the map to get the view above, with the central valley of California in view and the darker ridges of the Southern Sierra Nevada mountains in the middle of the view.


With many layers we might get from WMS servers, such as photographic imagery, we would be done with this example.   We have created a WMS server and are successfully using a layer from that WMS server in a map.   However, this particular image layer is formatted using a thematic format that can be improved by using the Style pane, to create a version that is even more useful.


Therefore, although the rest of this example is more about using Style than it is about WMS servers, we will continue to see how to use Style to format an image layer provided by a WMS server.

Style the WMS Image

We cannot see the Bing streets layer because the USGS shaded relief layer is styled to show hill shading using a range of colors from white to black.  The white color completely covers any of the Bing layer below.   We can change that by using the Style pane.



With the focus on the Relief layer in the open Map window, in the Style pane we use the channel selector bar to switch to using Channel 0 only.  This is somewhat of a cheat, because the Relief image is an RGBA image that happens to have the same, grayscale value loaded into all the channels.  So we can use any one of them and pretend it is a single-channel image that can be colored using a palette.



In the Style pane, we Ctrl-click the middle three intervals to select them, and then we press the Delete button in the toolbar to delete them.  We double-click into the color well for the lower interval and we choose transparent color, symbolized with a cross pattern.   Since the Fill method is interpolate, this will take color values in the channel from a low of 120, which will be colored in black color, to a high of 255, which will be colored using transparent color, and will interpolate for values in between to color them with increasing transparency.


Press Upstate Style.



Wow!  What a difference a quick application of the Style dialog makes!  What was opaque white color in the Relief layer is now transparent, so the Bing streets layer can be seen from underneath through that transparency.   Darker portions of the Relief layer are not only darker, but are also more opaque, so the color over the Bing layer with darker shades, exactly the hill shading effect we want.




We zoom into one of the canyons in the Sierra through which the San Joaquin river flows, to see the spectacular detail this WMS layer provides, with more detailed data automatically being served by the WMS server as we zoom further in.  



Turning off the Relief layer, we can see how the hill shading and 3D effect comes entirely from that layer.  Without it, the Bing layer is much less interesting.



We can see how much our work with the Style pane has improved the layer as served by the National Map WMS server.  In the illustration above, we have dragged and dropped the 0 Image layer from the Shaded Relief data source into the map.    The layer not only uses opaque white color that covers up the Bing layer below, in many places it is transparent (using alpha channel transparency, which Manifold correctly handles) where the USGS apparently reckoned hill shading was not necessary.    It is not particularly useful as it is.  



Turning off that layer and turning the Relief layer back on, we can see how using Style to apply a thematic format to the images sent by the WMS server greatly improves their usefulness.  That is a remarkable capability that Manifold provides, the ability to dynamically, on the fly, alter the style and appearance of raster images provided by web servers.


WMS is a remarkably popular web serving technology.  The National Map provides many dozens of layers, and other servers run by the US government and other governments worldwide provide hundreds of thousands, if not millions of layers, which can be used for free.  National Map layers are in the public domain, so we can use these however we like at no charge in our projects.


See Also

Project Pane


Web Servers


File - Create - New Data Source


ArcGIS REST Servers


CSV Servers


Custom Servers


GeoJSON Servers


JSON Servers


OSM Servers


TMS Servers


WFS Servers


WMS Servers


WMTS Servers


Example: Spectacular Images and Data from Web Servers - A must see topic providing a gallery of views illustrating how Manifold can use web servers such as image servers and other free resources to provide a seemingly endless selection of spectacular background maps, satellite images and GIS data with nearly zero effort.


Example: Vector Layers from an ArcGIS REST Feature Server - Visit an ESRI web site, copy a URL, and then use that URL to connect to an ArcGIS REST web server that shows petroleum fields in Kansas, getting the data as a vector drawing layer. Style the layer as if it were local.  ESRI refers to ArcGIS REST servers that provide vector data as feature servers.  


Example: Connect to a WFS Server for State Government Data - Gathering our courage, we connect to a WFS server that provides 1200 vector layers, run by the state of Massachusetts.   We open a layer showing airports and then scrape the vector data into our own local storage.  


Example: Connect to a Custom Server for Cadastral Data - We connect to a custom image server that provides cadastral information originally from the French national cartographic agency, IGN.  We create a map and use the Style pane to re-style the web served image on the fly into a more usable form.


Example: Connect to a Custom OpenRailwayMap Server - We connect to a custom server that provides an OpenRailwayMap view of railroads worldwide, showing railway, tram, and subway infrastructure based on OpenStreetMap data.  Our first try at creating a data source does not work.  After consulting the Log Window we try again with a slight adjustment and our second try works.


Example: Connect to an OSM Vector Server - We connect to an OSM Server that provides a vector layer containing points and lines in the OpenStreetMap database.  We then show how to scrape (copy) data from the OpenStreetMap server into local storage.  We extract building footprints from the local copy.


Example: Raster Layers from an ArcGIS REST Image Server - Visit an ESRI web site, copy a URL, and then use that URL to connect to an ArcGIS REST web server that provide a raster layer showing a mosaic of aerial photographs near Portland, Oregon.