Skip to content
Snippets Groups Projects
valueProcess.js 957 B
Newer Older
import("system.result");
import("system.vars");
import("MapViewTemplate_lib");

var config = MapViewConfigUtils.getBaseConfiguration();
config.startingCenterPosition.lat = parseFloat(vars.get("$param.MapViewCenterLat_param"));
config.startingCenterPosition.lon = parseFloat(vars.get("$param.MapViewCenterLon_param"));
config.startingCenterPosition.zoomLevel = 5;

var tileConfig = MapViewConfigUtils.getMainTileConfig();
config.tiles = tileConfig;

//when opening the AroundLocation view we do want to have the source organisation as center, so let's not overwrite the starting center position by 
//looking for the users current location
if ( vars.exists("$param.MapViewAdditionalFeatures_param") && vars.get("$param.MapViewAdditionalFeatures_param") )
{
   config.startingCenterPosition.zoomLevel = 10;//max amount of km is 100, so let's zoom in
   config.startingCenterPosition.autoLocate = false;
}

var res = JSON.stringify(config);
result.string(res);