N4 Street Maps With Values


  • Maptalks Open API maps
  • Add Map Markers & Links
  • Show Points with Icons
  • Light or Dark Theme
  • Change marker colours
  • Markers cluster together at different zoom levels
  • Marker Colours update in Real-time
  • Values Update in Real-Time
  • Stays Up-To-Date
  • Mobile touch friendly
  • Location search box
  • Requires Internet Connection*
  • Works in Workbench and Modern Browser
Add to Cart

Overview


The Open Street Maps widget uses the Maptalks API and displays a street map of the world and you can add markers via a simple JSON config. Choose between different base maps tyles. At different zoom levels, when markers are too close together, they automatically cluster together and show the number of markers in that area. Unlike our other open maps widget, this widget allows you to set up to 5 ord values. The values are shown on a tooltip via single click, which is great for mobile users as well. Markers can have different colours OR bind each marker to a boolean/enum. 3 colours of your choice make up the change in value. Tooltip icons can also be changed to a image of your choice, or removed entirely. Values and markers also update in real-time. A search box will also help find markers and automatically pan to them when clicked.

*You need an internet connection to view the maps, however if you are on a restricted network, its recommended you set up an outbound firewall rule to the mapping server: http://d.basemaps.cartocdn.com

The widget has a number of configurable properties that can be used to modify look, feel, and functionality.

Are you looking for a cost effective way to manage and visualize data for all your customers? Why not have a look at View Builder?

Usage


Before you start. Download the modules from our portal (see your order confirmation, which also explains licensing). Copy the modules file to your modules directory. Restart BOTH station and Workbench.

1. Copy the openStreetMapsWithValues-ux.jar file to your modules directory.
2. Open the module from your palette file.
3. Drag and drop the widget from the palette onto your px view.
Note: in 4.10 you will need to modify the Web Service settings in the station to allow maps to show up See Here
frame-src
*

img-src
'self' workbench data: https://a.basemaps.cartocdn.com/ https://b.basemaps.cartocdn.com/ https://c.basemaps.cartocdn.com/ https://d.basemaps.cartocdn.com/ https://www.wse-ltd.com https://cdn.jsdelivr.net

style-src
'self' workbench 'unsafe-inline' https://fonts.googleapis.com https://cdn.jsdelivr.net https://api.mapbox.com https://cdnjs.cloudflare.com

script-src
'self' workbench 'unsafe-inline' 'unsafe-eval' https://s.ytimg.com/ https://unpkg.com/ https://fonts.googleapis.com https://cdn.jsdelivr.net https://api.mapbox.com blob://* https://cdnjs.cloudflare.com

Tridium mapping library


Properties


bms map properties

The widget has a number of configurable properties that can be used to modify look, feel, and functionality. Change the properties as required:

File Config

A JSON config for map markers. See below for setup.
You can point the menu to a file that exists on the station.
Valid values are ords e.g.: file:^openMapsFolder/config.txt
If you do not specify a file reference, an message will show up.
Verify all point exist in your config.

Heres a sample config to help you get started. Download

Latitude/Longitude

The map will display at this location when initialised.

Pitch

The viewing angle of the map.

Overview Control, Scale Control, Zoom Control

Shows/hides the controls on the map. Set to true or false.

Zoom

The default zoom level. Default is 15.5.

Height/Width

Set these values to manually set the height/width of the map frame.

Base Maps Url - Style

There are a few different styles you can display.
Default: https://{s}.basemaps.cartocdn.com/rastertiles/voyager_labels_under/{z}/{x}/{y}.png
Niagara 4 maps
No Labels: https://{s}.basemaps.cartocdn.com/rastertiles/voyager_nolabels/{z}/{x}/{y}.png
Niagara 4 maps
Positron w/ Labels: https://{s}.basemaps.cartocdn.com/rastertiles/light_all/{z}/{x}/{y}.png
Niagara 4 maps
Positron without labels: https://{s}.basemaps.cartocdn.com/rastertiles/light_nolabels/{z}/{x}/{y}.png
Niagara 4 maps
Dark with Labels: https://{s}.basemaps.cartocdn.com/rastertiles/dark_all/{z}/{x}/{y}.png
Niagara 4 maps
Dark without labels: https://{s}.basemaps.cartocdn.com/rastertiles/dark_nolabels/{z}/{x}/{y}.png
Niagara 4 maps

API Version

The current version when writing this document is 0.49.5. Do not use anything beyond this version. Although rc-1 has been released, it has some breaking changes which will not work with the widget. As we do not maintain the mapping images, change this value as new versions are released. The latest version value can be found here. https://github.com/maptalks/maptalks.js/releases

Marker Cluster API Url
Default is /module/openStreetMapWithValues/rc/maptalks.markercluster.min.js or you can use the url https://unpkg.com/maptalks.markercluster/dist/maptalks.markercluster.min.js (Required for firefox)

Markers & Links

The marker config is in JSON format. You can customise as needed. Special characters should be avoided. Advanced users can enter html content in the label and tooltipText properties. Heres a sample config to help you get started. Download

If no link is specified, the marker, label, and tooltip will be shown. For links to navigate correctly in Workbench, and if you're running 4.3 or above, there should be a "toggle preview" button at the end of the toolbar when looking at a Px graphic. This will show you your Px page rendered in a browser and the links will work correctly

 
{
"markers": [{
		"lat": "51.508682",
		"long": "-0.1323335",
		"link": "/ord/station:|slot:/Drivers/Graphics/AHUs",
                "linkTarget": "parent",
		"label": "North Building",
		"defaultMarkerColor": "#3fa9f5",
		"markerChangeValueOrd": "station:|slot:/Drivers/Sites/Overview/EnumWritable",
		"ord": "station:|slot:/Drivers/Sites/Overview/COMeasurement",
		"ordDisplayName": "",
		"ord1": "station:|slot:/Drivers/Sites/Overview/Humidity",
		"ord1DisplayName": "",
		"ord1Icon": "/module/openStreetMapWithValues/rc/humidity-sm.png",
		"ord2": "station:|slot:/Drivers/Sites/Overview/Temperature",
		"ord2DisplayName": "",
		"ord2Icon": "/module/openStreetMapWithValues/rc/themometer-sm.png",
		"ord3": "station:|slot:/Drivers/Sites/Overview/TotalAlarms",
		"ord3DisplayName": "",
		"ord3Icon": "",
		"ord4": "station:|slot:/Drivers/Sites/Overview/InAlarm",
		"ord4DisplayName": "In Alarm",
		"ord4Icon": ""
	},
	{
		"lat": "51.5063802",
		"long": "-0.1396422",
		"link": "/ord/station:|slot:/Drivers/Sites",
                "linkTarget": "parent",
		"label": "West Building",
		"defaultMarkerColor": "#3fa9f5",
		"markerChangeValueOrd": "station:|slot:/Drivers/Sites/Overview/InAlarm1",
		"ord": "station:|slot:/Drivers/Sites/Overview/COMeasurement1",
		"ordDisplayName": "Custom Name 1",
		"ord1": "station:|slot:/Drivers/Sites/Overview/Humidity1",
		"ord1DisplayName": "",
		"ord1Icon": "/module/openStreetMapWithValues/rc/humidity-sm.png",
		"ord2": "station:|slot:/Drivers/Sites/Overview/Temperature1",
		"ord2DisplayName": "",
		"ord2Icon": "/module/openStreetMapWithValues/rc/themometer-sm.png",
		"ord3": "station:|slot:/Drivers/Sites/Overview/TotalAlarms1",
		"ord3DisplayName": "",
		"ord3Icon": "",
		"ord4": "station:|slot:/Drivers/Sites/Overview/InAlarm1",
		"ord4DisplayName": "",
		"ord4Icon": ""
	},
	{
		"lat": "51.507351",
		"long": "-0.127758",
		"link": "",
                "linkTarget": "parent",
		"label": "East Building",
		"defaultMarkerColor": "#3fa9f5",
		"markerChangeValueOrd": "station:|slot:/Drivers/Sites/Overview/InAlarm2",
		"ord": "station:|slot:/Drivers/Sites/Overview/COMeasurement2",
		"ordDisplayName": "",
		"ord1": "station:|slot:/Drivers/Sites/Overview/Humidity2",
		"ord1DisplayName": "",
		"ord1Icon": "/module/openStreetMapWithValues/rc/humidity-sm.png",
		"ord2": "station:|slot:/Drivers/Sites/Overview/Temperature2",
		"ord2DisplayName": "",
		"ord2Icon": "/module/openStreetMapWithValues/rc/themometer-sm.png",
		"ord3": "station:|slot:/Drivers/Sites/Overview/TotalAlarms2",
		"ord3DisplayName": "",
		"ord3Icon": "",
		"ord4": "station:|slot:/Drivers/Sites/Overview/InAlarm2",
		"ord4DisplayName": "",
		"ord4Icon": ""
	},
	{
		"lat": "51.5063802",
		"long": "-0.1496422",
		"link": "/ord/station:|slot:/Drivers/Sites",
                "linkTarget": "parent",
		"label": "New Building",
		"defaultMarkerColor": "#3fa9f5",
		"markerChangeValueOrd": "station:|slot:/Drivers/Sites/Overview/InAlarm3",
		"ord": "station:|slot:/Drivers/Sites/Overview/COMeasurement1",
		"ordDisplayName": "Level",
		"ord1": "station:|slot:/Drivers/Sites/Overview/Humidity1",
		"ord1DisplayName": "",
		"ord1Icon": "/module/openStreetMapWithValues/rc/humidity-sm.png",
		"ord2": "station:|slot:/Drivers/Sites/Overview/Temperature1",
		"ord2DisplayName": "",
		"ord2Icon": "/module/openStreetMapWithValues/rc/themometer-sm.png",
		"ord3": "station:|slot:/Drivers/Sites/Overview/TotalAlarms1",
		"ord3DisplayName": "",
		"ord3Icon": "",
		"ord4": "station:|slot:/Drivers/Sites/Overview/InAlarm1",
		"ord4DisplayName": "",
		"ord4Icon": ""
	},
	{
		"lat": "51.5163802",
		"long": "-0.1396422",
		"link": "/ord/station:|slot:/Drivers/Sites",
                "linkTarget": "parent",
		"label": "North West Building",
		"defaultMarkerColor": "#3fa9f5",
		"markerChangeValueOrd": "station:|slot:/Drivers/Sites/Overview/InAlarm4",
		"ord": "station:|slot:/Drivers/Sites/Overview/COMeasurement1",
		"ordDisplayName": "Custom Name 1",
		"ord1": "station:|slot:/Drivers/Sites/Overview/Humidity1",
		"ord1DisplayName": "",
		"ord1Icon": "/module/openStreetMapWithValues/rc/humidity-sm.png",
		"ord2": "station:|slot:/Drivers/Sites/Overview/Temperature1",
		"ord2DisplayName": "",
		"ord2Icon": "/module/openStreetMapWithValues/rc/themometer-sm.png",
		"ord3": "station:|slot:/Drivers/Sites/Overview/TotalAlarms1",
		"ord3DisplayName": "",
		"ord3Icon": "",
		"ord4": "station:|slot:/Drivers/Sites/Overview/InAlarm1",
		"ord4DisplayName": "",
		"ord4Icon": ""
	}
]
}
                              

JSON Values Explained:

lat- geo coordinate.
long- geo coordinate.
link- link to when clicked on tooltip label.
linkTarget- link to target window. Default is parent. Possible values: blank, self, parent, or top.
label- label to show on map and tooltip.
defaultMarkerColor- default color for marker when spectrum binding is false.
markerChangeValueOrd- ord binding to marker change value when spectrum binding is used. Absolute ord e.g. station:|slot:/Drivers/Sites/Overview/COMeasurement. Its best to use a boolean or enum. Boolean will be 0 or 1. The enum index will determine the value e.g. 0, 1, 2.
ord- ord value for tooltip data. Absolute ord e.g. station:|slot:/Drivers/Sites/Overview/COMeasurement
ordDisplayName- ord value display name on tooltip.
ord1- ord value 1 for tooltip data.
ord1DisplayName- ord value 1 display name on tooltip.
ord1Icon- icon to show on tooltip. File can be in the stations shared directory e.g. /ord/file:%5EopenMaps/brt-medium.png or come from a module e.g. /module/openStreetMapWithValues/rc/humidity-sm.png
ord2- ord 2 value.
ord2DisplayName- ord 2 display name.
ord2Icon- ord 2 icon.
ord3- ord 3 value.
ord3DisplayName- Ord 3 display name.
ord3Icon- ord 3 icon.
ord4- ord 4
ord4DisplayName- ord 4 display name.
ord4Icon- ord 4 icons.

JSON Editing To help build your menu configuration use an online JSON editor like:
https://jsoneditoronline.org/



Using in your HTML Page


You can now use the widget in your custom html page as long as the html file is in a appropriate station directory. E.g.:
C:/../station/shared/demo1.html

1. Create an html page and place in your station files directory.
2. Create a div element and give it an id so you can inject the widget into this area. E.g.: widget1.
3. Add the following scripts before the closing head tag or the closing body tag. E.g.:

    
        <script type="text/javascript">

            var require = {
                paths: {
                    "nmodule": "/module",
                    "baja": "/module/bajaScript/rc/plugin/baja",
                    "bajaScript": "/module/bajaScript/rc",
                    "bajaux": "/module/bajaux/rc",
                    "lex": "/module/js/rc/lex/lexplugin",
                    "css": "/module/js/com/tridium/js/ext/require/css",

                    "jquery": "/module/js/rc/jquery/jquery-2.1.1",  // For N4.4 or higher use /module/js/rc/jquery/jquery-3.2.0.min
                    "Promise": "/module/js/rc/bluebird/bluebird",

                    // these are runtime dependencies
                    "hbs": "/module/js/rc/require-handlebars-plugin/hbs", // For N4.4 or higher use /module/js/rc/handlebars/handlebars.min-v4.0.6
                    "i18nprecompile": "/module/js/rc/require-handlebars-plugin/hbs/i18nprecompile",
                    "json2": "/module/js/rc/require-handlebars-plugin/hbs/json2",
                    "underscore": "/module/js/rc/underscore/underscore",

                },

                hbs: {
                    disableI18n: true
                }
            }
        </script>

        <script type="text/javascript" src="/module/js/com/tridium/js/ext/require/require.min.js"></script>
        <script>
            require(['/module/openStreetMap/rc/openStreetMapWidgetWithValues.run.js'], function (app) {

                app.initialiseOpenStreetMap({
                    apiVersion: '0.49.1', // maptalks api version. See https://github.com/maptalks/maptalks.js/releases
                    baseMapsUrl: 'https://{s}.basemaps.cartocdn.com/rastertiles/voyager_labels_under/{z}/{x}/{y}.png', // see help for different styles
                    divId: '#widget',
                    changeMarkerColorOnValue: true, // when true it will use the markerChangeValueOrd 0, 1, or 2 to change colors
                    markerColorValue0: '#3fa9f5', // a value of 0 for the markerChangeValueOrd will change it to this color
                    markerColorValue1: '#ff0000', // a value of 1 for the markerChangeValueOrd ord will change it to this color
                    markerColorValue2: '#FF9C1B', // a value of 2 for the markerChangeValueOrd ord will change it to this color
                    mapConfig: 'file:^openMaps/withValuesConfig.txt',  // the json config file saved in the stations shared directory
                    markerImageFile: 'file:^openMaps/brt-medium.png', // use a custom marker image file. File must exist in stations shared directory
                    gaugeColor: '#f77a52',
                    latitude: '51.508682',  // default map location at startup
                    longitude: '-0.1323335',
                    maxClusterZoom: 15, // zoom level to show markers when they are clustered together
                    noClusterWithOneMarker: false, // if only one marker in the cluster, just show the marker
                    showMarker: true,  // shows map marker
                    showImageMarker: false, // set this to true and showMarker to false to show an image marker instead
                    showSearchBox: true,
                    searchAndZoomPanLevel: 17, // After clicking search item, it will zoom to this level if zoomed out
                    searchBoxPositionTop: '10px',
                    searchBoxLPositionLeft: 'calc(50% - 125px)',
                    fontFamily: 'Roboto',
                    backgroundColor: '',
                    height: '', // Set these values to manually set the height/width of the map frame
                    width: '', // Set these values to manually set the height/ width of the map frame
                    pitch: '0', // 3d pitch angle of map. Use right mouse click to have a look at this feature
                    zoom: 15.5,
                    zoomControl: true,
                    scaleControl: true,
                    overviewControl: true,
                    labelFontColor: '#000000',
                    theme: 'light', // light or dark
                    tooltipColor: '#000000',
                    tooltipFontColor: '#ffffff',
                });
            });
        </script>
        </head>
        <!--html to go here-->
        <div id="widget1" style="width:300px;height:300px;"></div>
        <!--Rest of your html below...-->
                                    

You May Also Like





N4 - 3D Maps with Values

N4 View Builder™©

tridium bms system

Multiline Chart

tridium charting

back to more widgets...