The Publishing tool can be used to highlight a map feature when embedding Mappin into other web pages. Imagine you have an existing web portal with information on local recreational areas. A page already exists on that site about Dunvant Rugby & Football Club and you now wish to add a map of the club there too.
In this instance you could embed Mappin into the existing page using an
<iframe/> element, setting its
src attribute to:
https://YOU.cloudmappin.com/PROJECT#publish?layer=Playing%20fields&attr=Name&key=Dunvant%20Rugby%20Football%20Club&zoom=11 (where YOU is your customer ID and PROJECT is the name of your Mappin project)
The parameters in the URL tell Mappin to search for a feature in the Playing fields layer with attribute Name equal to Dunvant Rugby Football Club and to centre the map on it at a zoom level of 11
So now the embedded map on the club’s page will display something similar to this:
By default, the attribute and value used to locate the feature is shown. We can define which attributes are displayed here by setting their associated Search visible settings in the attribute settings of the layer. Something looking like this is then possible:
The Publishing tool supports the following HTTP GET parameters:
- layer - the layer (its alias) to publish
- attr - the attribute (its alias) in layer to search on
- key - the value to match in attr
- zoom (optional) - the initial zoom level to use
- hide_popup (optional) - hides the popup with feature information that’s usually shown. Defaults to false
- bare_map (optional) - hides the Mappin toolbar and all other buttons when Mappin is embedded in an
<iframe/>element. Also disables zooming and panning of the map. Defaults to false
- disable_link (optional) hides the option to open the embedded map in a full tab which is only seen when Mappin is embedded in an
<iframe/>element. Defaults to false
- show_referenced_layer (optional) whether to show the referenced layer if it’s not enabled by default. Defaults to true
The endpoint for the Publishing tool is
/PROJECT#publish (where PROJECT is the name of your Mappin project).
Please note that if any of the above GET parameter values contain spaces or other special characters, these will need to be escaped (e.g. replacing a space with %20). More information on escaping characters in URLs can be found here.