Locale view
The MAPP library creates the mapview from the locale.[1]
viewis the start view:lat,lngand zoomz. URL hooks override it. Withoutzthe map starts atminZoom. The object is passed to the Openlayers View, soview.minZoomandview.maxZoomtake precedence over the locale keys, and other View options such asenableRotationapply;center,zoom,projectionandextentare set by the mapview.extentlimits panning tonorth,south,eastandwestin degrees. An invalid extent falls back to the world with a warning.maskgreys out everything outside the extent.minZoomandmaxZoomlimit zooming.sridis the EPSG code of the mapview projection,3857by default. Openlayers knows only 3857 and 4326; other projections must be added withmapp.utils.proj4.addProjectionbefore the mapview is created.ScaleLineadds a scale bar inmetricorimperialunits; any other value shows metric.mapviewControlsadds Openlayers controls by class name, eg.["Zoom"], created without options from theol.controlof the page (Openlayers 10 in the default view). Names not inol.controlare ignored.svgTemplatesmaps names to SVG URLs which are loaded before layers render, for icons withtype: template.svg_templatesis the deprecated name, still read whensvgTemplatesis not set.listview_recordssets the symbols and colours of the location list, eg.[{ "symbol": "1", "colour": "#000" }]; the default is A to J.[2]
Pitfalls
bounds,maskBounds,showScaleBarandscalebarare legacy keys, renamed or converted with a warning.- Latitudes and longitudes are degrees; an extent with
northbelowsouthoreastbelowwestfalls back to the world. Zooms have no upper limit here; withoutmaxZoomOpenlayers stops at zoom 28. - The extent does not change the minimum zoom; set
minZoomto stop users zooming out past the extent.
Examples
A UK locale with a masked extent, metric scale bar and zoom range.
json
{
"dbs": "DEVDB",
"locale": {
"view": { "lat": 51.5, "lng": -0.1, "z": 10 },
"extent": { "north": 61, "south": 49.8, "east": 2, "west": -8.7, "mask": true },
"minZoom": 5,
"maxZoom": 18,
"ScaleLine": "metric",
"mapviewControls": ["Rotate"],
"layers": {
"retail_points": {
"display": true,
"format": "wkt",
"table": "geodata.uk_glx_open_retail_points",
"geom": "geom_p_4326",
"srid": "4326",
"qID": "id"
}
}
}
}