How to configure custom map shapes

To configure custom map shapes in the Bold Reports® JavaScript Report Designer, place your shape data file in a folder in the application root, list it in a mapshapes.txt file, and load the map settings in Application_Start.

Create Report Designer JavaScript application

To create a Report Designer JavaScript application, follow Getting Started.

Place custom shape data file in application root location

In the root 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' }]

How do I load custom map shape data at startup in the JavaScript Report Designer?

To load custom map shape data in the Bold Reports® JavaScript Report Designer, add the map settings to the Application_Start method in the Global.asax.cs file.

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

        using BoldReports.Web;
        using Newtonsoft.Json;
  2. Add the following code to load shape data.

        protected void Application_Start(object sender, EventArgs e)
        {
            System.Web.Http.GlobalConfiguration.Configuration.Routes.MapHttpRoute(
            name: "DefaultApi",
            routeTemplate: "api/{controller}/{action}/{id}",
            defaults: new { id = RouteParameter.Optional });
    
            AppDomain.CurrentDomain.SetData("SQLServerCompactEditionUnderWebHosting", true);
            //Use the below code to load map shape data into report designer
            ReportConfig.DefaultSettings = new ReportSettings()
            {
                MapSetting = this.GetMapSettings()
            }
        }
    
        private BoldReports.Web.MapSetting GetMapSettings()
        {
            var shapePath = "\\ShapeData\\";
            try
            {
                return new MapSetting()
                {
                    ShapePath = AppDomain.CurrentDomain.BaseDirectory + shapePath,
                    MapShapes = JsonConvert.DeserializeObject<List<MapShape>>(System.IO.File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + shapePath + "\\mapshapes.txt"))
                };
            }
            catch (Exception ex)
            {
               // Implement to catch exception
            }
            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 a rdl report using map.