How to configure custom map shapes

To configure custom map shapes in the Bold Reports® ASP.NET Core Report Designer, place your shape data file in the wwwroot folder, list it in a mapshapes.txt file, and load the map settings in the Startup method.

Create Report Designer ASP.NET Core application

To create a Report Designer ASP.NET Core application, follow Add Report Designer to an ASP.NET Core application.

How do I add a custom map shape file to the ASP.NET Core Report Designer?

To add a custom map shape to the Bold Reports® ASP.NET Core Report Designer, create a folder in the wwwroot folder, copy your shape data file into it, and list the file in a mapshapes.txt file.

In the wwwroot folder of your Report Designer application, create a new folder. For example, ShapeData. Create new folder

Copy your shape data file and paste it in the ShapeData folder. For example, storelocations.js. Place shape data

Create a text file inside ShapeData folder. For example, mapshapes.txt. Create text file

Open the mapshapes.txt file, add your file name and display name, and save the file. Shape data installed location

[{ Name: 'Store Locations', FileName: 'storelocations' }]

Load map shape data in application startup

  1. Open the code-behind file Startup.cs and add the following using statement.

        using BoldReports.Web;
        using Newtonsoft.Json;
        using System.Reflection;
  2. Add the following code to load shape data in the Startup method.

       public Startup(IConfiguration configuration, IWebHostEnvironment _hostingEnvironment)
        {
            //Use the below code to load map shape data into report designer
            ReportConfig.DefaultSettings = new ReportSettings()
            {
                MapSetting = this.GetMapSettings(_hostingEnvironment)
            };
    
            Configuration = configuration;
            env = _hostingEnvironment;
        }
    
        private BoldReports.Web.MapSetting GetMapSettings(IWebHostEnvironment _hostingEnvironment)
        {
            try
            {
                string basePath = _hostingEnvironment.WebRootPath;
                return new MapSetting()
                {
                    ShapePath = basePath + "\\ShapeData\\",
                    MapShapes = JsonConvert.DeserializeObject<List<MapShape>>(System.IO.File.ReadAllText(basePath + "\\ShapeData\\mapshapes.txt"))
                };
            }
            catch (Exception ex) { }
            return null;
        }

Visualize shape data on map

  1. Launch the Report Designer application. New report
  2. Drag a map into design area from item panel. New report
  3. The newly added shape data entry will be listed in the Shapes property drop-down under Basic Settings category. Shapes property

To visualize shape data and analytical data using the map report item, see Design an RDL report using map.