meta data for this page
  •  

Custom maplines in N4V

Source : install/Custom_maplines_in_N4V.pdf

Custom map integration (Web)Mapline/Drillmap component V2.0 – 02/12/2024

Find here the process to integrate your new maps into the Mapline component

(Web)Maplines Workflow steps These are the main steps to follow to integrate a new map in the Maplines component. 1.First preparation of the geojson file 2.Enhancement of the geojson file 3.Extraction of valid codes and integration in Need4Viz settings file 4.Update of the available list of maps in Need4Viz settings file In this documentation, you’ll see references to Custom indexes (dkx). This is an example and the code are specifics to each customer. For each new map you need to add, you have to assign one new index. In our example, Custom indexes for maplines start from dk3 to dk72

Maplines - Map preparation 1.Get the geojson file of your map. To enhance the loading of the final mapline component in Webi (and in the web browser), reduce the size of the geojson file. To reduce this size, you can reduce the precision of coordinates or simplify the polygons. We recommand to not exceed 1.5Mo par file. 2.Each zone of the geojson file has to get at least the two following attributes : -«code» : the code (ID) of the zone. This code will be used in Webi for the mapping between your data and the zones of the map -«name» : the name of the zone. This name will be displayed on the map in Webi 3.Simplify the geojson file to get only one entry per ID of zones (merge all polygons with the same code/ID) These steps will produce a geojson file ready to be enhanced…

Maplines - File enhancement 1.Generate all centroïds from the geojson file. The result should be a list of latitude/longitude coordinates for the center of each zone (code/ID). 2.Enhance the geojson file by adding the two following attributes for each zone : -«latitude» : the latitude of the center of the zone -«longitude» : the longitude of the center of the zone 3.In the main properties of the geojson (head of the file), the following propertie have to be added : -«hc-transform» : the map projection in proj4 string format. You can find this information for example in QGIS through the properties of your project : -An example of this tag is : "hc-transform": {"default": {"crs": "+proj=longlat +datum=WGS84 +no_defs"}} 4.Transform the geojson file into a js file, using a free KMD index « dkx », by : -Adding the object name Highcharts.maps["dkx"] = at the begining of the file -Renaming the file as dkx.js (with a .js extension) -Place the dkx.js in the webapp folder N4VCustomElements\res\js\highcharts\maps_customof each Tomcat server These steps will produce a geojson file enhanced, ready to be integrated in N4V… The available dkx indexes Custom start from dk3 to dk72

Maplines - Valid codes 1.Extract all the «code» available in the js map file. 2.Create an array of this codes (frame values with quotes and separate all values by «,») 3.Open the file list_maps_codes.js in the folder ~Need4Viz\nodejs\node_modules\custom_element\ce_libs\resources 4.Create a new entry exports.dkx = [your_array]; where dkx is the KMD index chosen for the new map. 5.For example, in the initial setup, the following entry is related to the map dk3 : exports.dk3 = ['Hendriksholm','Islev','Nyager','Valhoej','Roedovre','Tinderhoej']; These steps will allow you to integrate the valid codes for the verification of the mapping data when using your new map in Webi… These codes will be used in Webito assign your values on the map. If a code in your Webidata is not in this array, the following error message is displayed

Maplines - Update list of maps 1.Open the file _list_genmaps.json in the folder ~Need4Viz\nodejs\node_modules\custom_element\ce_settings\lang_EN 2.Create a new entry with following parameters : 1.“id”: “dk3”, where dkx is the index chosen for the new map. 2.“name”: example “Danemark : Rødovre skoledistrikter”, you define here the name that will be displayed for your map in the list of values 3.“description”: ““this parameter is not used and can be let blank (but it’s mandatory to put it !) 3.Be really careful of the syntax when modifying this file, if you don’t respect the correct one, the result will be a non showing Extended parameters in the Webi properties : 4.Correct entry : These steps will allow you to update the list of maps displayed in the settings of the Maplinecomponent… A related article in our knowledge base is available Here Unless you have set Need4Viz language as «French», you don’t need to set the _list_genmaps.jsonof the folder ~Need4Viz\nodejs\node_modules\custom_element\ce_settings\lang_FR

Maplines - Use your new map 1.A last step before using your new map is to restart the Need4Viz service 2.Once it is done, insert a dataset related to your map («code», «values»…) in a Webi report 3.Insert a new Mapline component, map correctly the parameters (code…) 4.In the Extended parameter, choose your new map 5.Enjoy Once previous steps have been realized, you should be able to use your new map in the Maplinecomponent…

Drillmap – Map preparation Create a first map for the main level (level 1). This map is prepared in the same way as for a Mapline. The difference is in the jsonfile, each zone of the geojsonfile must contain at least the following three attributes: -«code» : the code (ID) of the zone. This code will be used in Webifor mapping between your data and the zones of the map. The code must be surrounded by quotation marks (even if numeric code) -«name» : the name of the area. This name will be displayed on the map in Webi -«hc-key» : the code (ex. dk2) of the lower levelmap (level 2) which will be called when clicking on this area (drill). -You can add other naming attributes to be able to choose in Webia different name to display on the map (egshort name to generate a smaller map, abbreviation, code…) A Drillmapis composed of a level 1 maplineand several level 2 maplines(drill)…

Drillmap – Valid codes 1.Extract all available “code” values ​​from the file dkx.js of your drillmap (level 1). 2.Create a table of these codes (enclose the values ​​with quotes and separate all values ​​with ”,”) 3.Open the file list_maps_codes.js in the following folder ~Need4Viz\nodejs\node_modules\custom_element\ce_libs\resources 4.Add a new entry exports.dkx = [table_of_codes]; where dkx is the chosen index for the new level 1 drillable map. 5.If necessary, create a second table indicating the different properties that can be used for naming zones (default: "name"). This entry should be named exports.dkx_name ex. : exports.dk3_name = [‘name’,’short_name’,’abreviation’]; 6.Extract all available “code” values ​​in allfiles dky.js of lower levelcards from your drillmap(level 2). 7.Create a table of all these codes (enclose the values ​​with quotes and separate all values ​​with “,”) 8.Add a new entry exports.dkx1 = [table_of_codes]; where dkx1 is the index chosen for the new level 1 drillable map concatenated with a 1 (ex dk241 for a drillmap with code dk24). As with a mapline, these steps will allow you to integrate the valid codes for verifying map data when using your new map in Webi…

Drillmap – Update list of maps These steps will allow you to update the list of maps displayed in the settings of the Drillmapcomponent… 1.Open the file _list_gendrillmaps.json in the folder ~Need4Viz\nodejs\node_modules\custom_element\ce_settings\lang_EN 2.Create a new entry with following parameters : 1.“id”: “dk3”, where dkx is the index chosen for the new map. 2.“name”: example “Danemark : Rødovre skoledistrikter”, you define here the name that will be displayed for your map in the list of values 3.“description”: ““this parameter is not used and can be let blank (but it’s mandatory to put it !) 3.Be really careful of the syntax when modifying this file, if you don’t respect the correct one, the result will be a non showing Extended parameters in the Webi properties

(Web)Maplines/Drillmaps - Upgrade of Need4Viz BEFORE THE NEED4VIZ UPGRADE 1.Make a backup of the files list_maps_codes.js, list_webmaps_codes.js, list_maps_conf.js, list_drillmaps_conf.js, list_webmaps_conf.js in the folder ~Need4Viz\nodejs\node_modules\custom_element\ce_libs\resources 2.Make a backup of the file _list_genmaps.json, _list_gendrillmaps.json, _list_webmaps.json in the folder ~Need4Viz\nodejs\node_modules\custom_element\ce_settings\lang_EN 3.Make a backup of the file _list_genmaps.json, _list_gendrillmaps.json, _list_webmaps.json in the folder ~Need4Viz\nodejs\node_modules\custom_element\ce_settings\lang_FR AFTER THE NEED4VIZ UPGRADE 1.Replace the files list_maps_codes.js, list_webmaps_codes.js, list_maps_conf.js, list_drillmaps_conf.js, list_webmaps_conf.js in the folder ~Need4Viz\nodejs\node_modules\custom_element\ce_libs\resourcesby the previous saved files. 2.Replace the files _list_genmaps.json, _list_gendrillmaps.json, _list_webmaps.json in the folders ~Need4Viz\nodejs\node_modules\custom_element\ce_settings\lang_ENand lang_FRby the previous saved files. An upgrade of Need4Viz solution will overwrite some specific files. Each time you plan an upgrade of Need4Viz, you have tosave previous updated files and replace new files to be sure your custom maps still work after upgrade.

Maplines Troubleshootings Once previous steps have been realized, if there is an issue with your new map in the Maplinecomponent… Issues Checks Extended parameters are not displayed in the settings of the component - Check the syntax of the _list_genmaps.json The new map is not displayed in the list of maps- Check the syntax of the _list_genmaps.json The map is not displayed - Check the dkx.js file is present in the Need4Viz webapp of each Tomcat server - Check the correct syntax of the dkx.js file The map is diplayed but only a part (or only some pies in a blank background) - Check the correct values of the proj entry in the dkx.js file -Check the correct latitude/longitude values in the dkx.js file An error message is displayed about unvalid code in Webi - Check the codes in the corresponding entry in the list_maps_codes.js file Other issues… - Check the charset of json and js files is UTF8 (use Notepad++ for instance, to update the file and check the charset is not updated from the orginal files)

37, ruedes Mathurins 75008Paris www.need4viz.com