Data Points

 View Only

Use Administrative Boundaries Data in PowerBI to make Custom Basemap!

  • 1.  Use Administrative Boundaries Data in PowerBI to make Custom Basemap!

    Employee
    Posted 04-27-2020 17:57
    Custom maps are required at various places to meet the business needs. For example, an organization may want to represent their territories/regions which may or may not align with the geographical state, postcode or other standard boundaries. The same requirement is true for organization which want to use their own boundary dataset for basemap as well.

    In this article, I will walk through the procedure to create a custom map in Power BI using Shape Map visuals and LI Boundaries data (a flagship product of Syncsort).

    Shape Map visuals are based on TopoJSON map format which is an extension of GeoJSON that encodes Topology. TopoJSON is the preferred format for geometry rendering as it eliminates redundancy, allowing related geometries to be stored efficiently in the same file. The TopoJSON format is more efficient to render as shared control points need only be projected once to display map.


    Lets' get started with Shape Map Visuals!

    Step 1: Enable Shape Map visual under Visualization Pane

    Launch Power BI Desktop which opens up with a new page. To enable Shape Map, select File > Options and Settings > Options > Preview Features, then select the Shape Map Visual checkbox. Click "OK".

    Restart Power BI Desktop to enable the Shape Map Visual icon under the Visualizations Pane.



    Step 2:  Create a Shape Map on the canvas

    Once Shape Map is enabled, select the Shape Map icon from the Visualizations pane. Power BI Desktop creates an empty Shape Map visual design canvas.


    Select geographic data field* of interest on which Shape Map will be created.  Drag geographic data field to the Location field under Visualizations Pane [In this example, County_fips (US County FIPSCode) is used as geographic field]. The United States shape map is created by default. Color saturation field holds information on which Thematic will be created [In this case Fill Rate % information for each county].


    Note:
     *Geographic Data Field – In PowerBI, several data categories exists to classify the data type. Geographic data field is the one which when mapped with PowerBI internal geocoder, it assigns a coordinate reference to the admin/place/address information. A globe icon is created next to these fields when mapped with PowerBI Geographic Data categories.

    In "Format" tab of the Visualization pane, click "Shape" option. Under Map, a dropdown list of various preconfigured Shape map is displayed and "USA : states" map lies on the top and set as default for Shape Map. This is the reason; we see a default shape map created for the United States for any data field loaded for the first time.

    In the dropdown list, Counties map of USA is not available which is required for to create county level fill rate map for analysis.

    So, a custom map needs to be created which we can add to the existing list. To add a custom Map, "+ Add Map" option is available which needs a TopoJSON file as input. The TopoJSON file should contain the boundary definition of a map region. The shape map visual make use of the TopoJSON file to generate the custom map.

    Step 3: Create TopoJSON file

    US County data is available with Syncsort and can be easily downloaded from Software and Data Marketplace. Software and Data Marketplace is one stop shop to discover, visualize, try and download all your data needs.

    Download US Census boundaries in shape/tab format whichever is convenient to use and extract county file from the bundled product.

    Zip the US county shapefile/tab file (including all associated files*). 

    *Shapefile Zip

    *Tab File Zip

    *.shp

    *.tab

    *.dbf

    *.dat

    *.prj

    *.id

    *.shx

    *.map

    Go to Map Shaper Weblink (https://mapshaper.org/) and drop the zip file under "Drop files here of select from a folder" canvas. Select import option to import the file. 

    If geometries are very detailed (as seen in below map), you can simplify the geometry using simplify option in mapshaper URL. Simplification of geometry helps in faster rendering as it reduces the number of nodes. The geometry might get a little distorted with simplification process, but it depends on user's discretion what detailed level of geometry they plan to display as background/basemap.


    Click Export option to export the file in TopoJSON format.


    TopoJSON file is now ready to be imported in PowerBI (a snippet of how TopoJSON file look like).


    Step 4: Add a Custom shape map
    Under Visualizations pane, click "+ Add Map" and import the newly created TopoJSON file. Viola! Your custom map is ready to be used as basemap.


    Important: To map data to your shapes in Power BI, keep the same field record name as they are in your data.  For example, if in your data you have a [County FIPS] field and it has a value of "01001", you want to name the Polygon shape as "01001" if that's the field you plan to bind to your map's location property.  This is important for better mapping of map keys.

    Step 5: Create Custom Thematic map based on Custom Shape Map

    Now go to Fields pane, drag Fill Rate value Field into "Color saturation" option to create custom thematic map. You will see county level fill rate thematic created for roof cover [sample data field used to illustrate Thematic here]. Additionally, you can add Legend field to further define the value under color saturation option.


    So, what are you waiting for? Explore and Learn new functionality with LI Boundaries data and feel free to reach out if you need any help!

    Summary

    The shape map is visually wonderful to play around with but currently it's not very user-friendly, not quite responsive to changes done at runtime. The page has difficulty in zoom in/zoom out and it loads slowly. The shape map does not show the map keys of the currently selected map. In addition, you must also have the Color saturation bucket set in order for the Legend classification to work properly. The Shape Map currently can plot up to a maximum of 1,500 data points only

    [Article is based on PowerBI Version: 2.79.5768.1082 64-bit (March 2020) and US county data 2019.05]

    Acknowledgements



    ------------------------------
    Dr Neena Priyanka
    Syncsort, India
    ------------------------------