11 REST for Named Layers
In addition to the fully-featured base maps from Bing Maps, Google Maps, and Mapfluence, Mapfluence includes a set of "named layers" that enable one or more features of the Mapfluence base map (e.g. roads, place names, boundaries, etc.) to be overlaid as a layer. The following named layers are available:
Named layers are typically used in two types of situations:
Note: For best appearance, use the default (Mapfluence) base map when using named layers.
The following steps illustrate how to create a map with both named and class layers. Suppose, for example, that we want to see if there's any difference in the concentration of roads in the different types of U.S. Census Bureau place classifications (city, town, or CDP), but we don't care about the names of the places or roads themselves. We'll show the census places with a class layer. Beneath the class layer we'll put the named layer for land cover, which will (at default full opacity) cover all land areas on the base map, thereby removing from view the base map's cities, roads, place names, etc. Over the class layer we'll put a named layer for roads. We won't use a base map specifier, so the base map (only the water areas of which will be visible) will default to Mapfluence.
1. Start with the host, version, API key, and endpoint. At this point the rendered result would show only the Mapfluence base layer:
2. Add a layer definition (separating each property value pair with a pipe) for the land-only named layer. If this layer definition is appended to the basic path above, the rendered result will no longer show any features other than basic land areas:
3. Add a class layer definition. After appending this layer definition to the path from the two steps above, the rendered result will show the three types of places as colored semi-transparent overlays.
- mode=class: the layer type, in this case class.
- select=umi.us_census00.place.place_type: the source of the attribute by which the geometries will be classified, in this case an attribute table classifying places by type (city, town, or CDP).
- from=umi.us_census00.place_geometry: the source of the geometries that will be overlaid, which is the geometry table in the Mapfluence dataset covering U.S. places.
- date=2009-01-01T08:00:00Z: a date, which is used to filter the results using the date attribute in the specified geometry table (the from property) and attribute table (the select property).
- values=city,town,CDP: a list of attribute values that are to be included in the map, in this case the types (classes) of place.
- border=000000_1.3: the color and line weight of the border, which shows the boundaries between geometries.
- styles=c00000,00c000,0000c0: a list of colors that will be used to render the geometry associated with the value at the same index in the values list (e.g. ff0000 for CDPs, 00ff00 for cities, 0000ff for towns). These colors could alternatively be expressed as valid HTML color names (red, green, blue).
- opacity=0.4: the overall opacity of the layer. This is an alternative to adding an alpha channel specification to the end of each color in the styles property.
Note: In a class layer, styles is plural.
4. Add a layer definition for the roads-only named layer. After appending this layer definition to the path from the three steps above, the rendered result will show overlaid roads.
5. Add a query string after the base map code to specify the map's centerpoint, size, and zoom, which we use in this case to focus the map on Marin County, in the San Francisco Bay Area:
6. Put it all together and you have the complete REST path for the map:
Here's an excerpt of the map, showing the Roads named layer overlayed on the place-type class layer and the Mapfluence base map, that is returned from the above URL (to see the full map in a new window, click here):
Note: For complete details on the purpose and valid values of named layer properties, both required and optional, refer to the Named Layer page of the Mapfluence REST API Reference at http://developer.urbanmapping.com/docs/mapfluence/rest/2.0/reference/tile/layer/Named.