Adding state/region based maps for reporting

Brad Warman
Giga Sage

Hi all. I thought I'd share my recent experience in attempting to create state/region based maps for use in the reporting module as there seemed to be a gap in knowledge articles with explicit examples on how to accomplish this.

 

The business case I was presented with was to display a map of South Australia which could be used in a report to plot locations for incidents defined in a filter. Out of the box, ServiceNow provides a map of Australia (which does display the states), but does not provide individual state level maps.

 

After reading through the docs, it was clear that I needed to utilise a custom geoJSON definition to create a map that could be used in the map hierarchy. ServiceNow recommends using pre-defined maps from Highcharts, but I found that these didn't include the individual states of Australia.

 

While I was able to display the map of South Australia using geoJSON definitions from alternative map sources, plotting the location points just did not work. I suspect this was due to not being able to find the values required for the hc-transform object of the geoJSON which meant the coordinates did not match what ServiceNow was expecting.

 

    "hc-transform": {
        "default": {
            "crs": "+proj=lcc +lat_1=-18 +lat_2=-36 +lat_0=0 +lon_0=134 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs",
            "scale": 0.000158093982027,
            "jsonres": 15.5,
            "jsonmarginX": -999,
            "jsonmarginY": 9851.0,
            "xoffset": -2082021.85219,
            "yoffset": -1210304.51735
        }

 

I eventually discovered a much easier way - modify the existing out of the box Australia map geoJSON data.

 

When you open an existing Report Map, in my case Australia, you are presented with the geoJSON definition as well as the map level and any child maps that are associated with the record. To get my South Australia map to function correctly, I copied the geoJSON definition data, created a new Report Map under the Report Maps related list and pasted the geoJSON definition into the new map. The definition was then modified to remove the data of all the other states with only the data for South Australia remaining (as well as the header data including the title, crs and hc-transform). The South Australian map level was set to 3 and the key was set to au-sa.

 

Next, a new region and state mapping record was created on the sys_report_map_source_mapping table with the key au-sa (to link to the map) and the value of South Australia. This record allows drill down functionality when showing a map of the world or Australia, allowing the user to click on the country, then the state to view the data.

 

From here it was just a matter of configuring the necessary map sources to take advantage of the new South Australian map. For example a map source that plots incidents by location was updated to include a third level (South Australia) as the map source only drilled down to the country level.

 

Level 2

BradWarman_0-1738043050337.png

 

Level 3

BradWarman_1-1738043086062.png

 

 

I hope this helps others out there who are trying to use state or region based maps in the reporting module.

0 REPLIES 0