ByÂ Fiona Hemsley-Flint (GIS Engineer)
Whilst developing the background mapping for the Fieldtrip GB App, it became clear that there was going to have to be some cartographic compromises between urban and rural areas at larger scales; Since we were restricted to using OS Open products, we had a choice between Streetview and Vector Map District (VMD) â€“ Streetview works nicely in urban environments, but not so much in rural areas, where VMD works best Â (with the addition of some nice EDINAâ€“crafted relief mapping) . This contrast can be seen in images below.
Streetview (L) and Vector Map District (R) maps in an urban area.
Streetview (L) and Vector Map District (R) maps in a rural area.
In an off-the-cuff comment, Ben set me a challenge – “It would be good if we could have the Streetview maps in urban areas, and VMD maps in rural areas “.
Since these products are continuous over the whole of the country, I didn’t see how we could have two different maps showing at the same time.
Then, because I like a challenge, I thought about it some more and found that the newer versions of MapServer (from 6.2) support something called â€œMask Layersâ€� Â –Â where one layer is only displayed in places where it intersects another layer.
I realised if I could define something that constitutes an ‘Urban’ area, then I could create a mask layer of these, which could then be used to only display the Streetview mapping in those areas, and all other areas could display a different map – in this case Vector Map District (we used the beta product although are currently updating to the latest version).
I used the Strategi ‘Large Urban Areas’ classification as my means of defining an ‘Urban’ area – with a buffer to take into account suburbia and differences in scale between Strategi and Streetview products.
The resulting set of layers (simplified!) looks a bit like this:
Using Mask layers in MapServer 6.2 to display only certain parts of a raster image.
Although this doesn’t necessarily look very pretty in the borders between the two products, I feel that the overall result meets the challenge â€“ in urban areas it is now possible to view street names and building details, and in rural areas, contours and other topographic features are more visible. This hopefully provides a flexibility Â for users on different types of field trips to successfully implement the background mapping.
Hereâ€™s a snippet of the mapfile showing the implementation of the masking, in case youâ€™re really keenâ€¦
#VMD_layer(s) defined before mask
#Streetview mask layer
#Data comes from a shapefile (polygons of urban areas only):
#Data is a series of tiff files, location stored in a tileindex
#*****The important bit â€“ setting the mask for the layer*****