The map.js file contains the layer properties for the map and legend component in a report. You can open and edit the file in a text editor. Although a number of map component properties can be changed in the Designer there are a number of settings that can only be changed by directly editing the map.js file.
In order to edit the map.js file first open the file in a text editor. The various map layers are segregated using {}. The first property of each map layer is the ‘type’ for example: “type”:”contextual-layer”. The second property is the “id” which identifies which map file the settings belong to. These can be used to correctly identify the layer you wish to edit.
If you wish to change a map property, first find the relevant layer by looking at the “id” and “name” fields to identify the correct map layer. To change the relevant setting find the field and change the value. For example if you wish to change the border thickness the following setting can be edited:
"borderThickness":2,
Here the thickness of the border has been set to 2 pixels.
The table below details some of the main map properties and the options for changing the settings.
Red rows are default settings that you should not edit, green rows are settings that can be edited.
Map Property | Function | Setting |
“type” | Denotes type of layer i.e. base-layer or contextual layer | Defined in the Publisher – Do Not Change |
“id” | The name of the shapefile or MapInfo layer | Specific to the file – Do Not Change |
“name” | The name of the layer in shown in the legend | Can be edited as required |
“geometry” | Type of shapefile and MapInfo layer i.e. point or polygon | Specific to the file – Do Not Change |
“url” | The path of the file used in the report | Built in function set during the publishing process – Do Not Change |
“visible” | Determines whether the layer is turned on in the legend when the report is first opened | Options: true or false |
“symbolSize” | Determines the size of symbols – point geographies only. | Any positive numerical value |
“fillColor” | Determines colour of contextual layer polygons or oint symbols only. | Any Hex colour e.g. #ffffff |
“fillOpacity” | Determines the opacity of the map layer filling. | Any value between 0 and 1 |
“borderColor” | Determines the colour of the border of the map layer. | Any Hex colour e.g. #ffffff |
“borderThickness” | Determines the thickness of the borders of the map layer. | Any positive numerical value (value corresponds to pixels, smaller numbers are most appropriate) |
“showLabels” | Determines whether labels are shown for a map layer. For contextual layers, the labels are taken from the name field set during the publishing process. | Options: true or false |
“minLabelExtent” | Determines at what zoom level the labels of the map layer become invisible. | Any positive numerical value. Default value = 0 |
“maxLabelExtent” | Determines at what zoom level the labels of the map layer become visible. If there are many small areas the map may look cluttered at full extent, max zoom layer determines at which point they become visible at smaller extents. | Any positive numerical value. Default value = 1000000, suitable value depends on scale of map used. |
“iconPath” | Determines the icon type of contextual point layers. For example a cross symbol could be used to denote a hospital. | The path of an image file. If the image is saved in the same folder as the report the value is simply the name of the file e.g. cross.png |
“showDataTips” | Determines whether the name of the features in the map file show tooltips with the name of the feature. | Options: true or false |
“showInLayerList” | Determines whether a map layer is shown in the legend. The map layer will still be shown in the map component of the report (if “visible” is set to true) however users will not be able to turn the map layer on/off via the legend. | Options: true or false |