ActiveReports 8
Add a Custom Tile Provider
Show AllShow All
Hide AllHide All

You can add and configure a Custom Tile Provider in the Map control using the IMapTileProvider and IMapTile interfaces.

The IMapTileProvider interface contains detailed settings that are required to communicate with the tile server, whereas the IMapTile interface represents a single tile of a Map's tile layer that fetches the tile image based on the configurations in the IMapTileProvider interface.   

Adding a custom tile provider also requires making some modifications in the Grapecity.ActiveReports.config file. Follow these steps to learn how to set a custom tile provider:

  1. Create a Class Library Project, for example MyClassLib, in Visual Studio. 
  2. Add a new Class to the project and name the class, for example, MyTileProvider. You may add functions and features to this class for getting the Tile images based on your tile server settings and details. This class serves as the interface between your Map control and your custom tile server. Replace the existing code with the following in the MyTileProvider class to implement the IMapTileProvider interface.

    To write the code in Visual Basic.NET

    To write the code in C#

  3. Add a new Class to the project and name the class, for example, MyMapTile. Replace the existing code with the following in the MyMapTile class to implement the IMapTile interface.

    To write the code in Visual Basic.NET

    To write the code in C#

  4. Add another Class to the project and name the class, for example, WebRequestHelper. Replace the existing code with the following in the WebRequestHelper class to implement the loading of raw website data into the System.IO.MemoryStream class.

    To write the code in Visual Basic.NET

    To write the code in C#

  5. Save and build your class library project and locate the new .dll file in its Bin>Debug folder. This file has the same name as your class library project, with a .dll extension.
  6. Create a Basic End User Designer in a new solution following the steps in Creating a Basic End User Designer.
  7. Run your Basic End User Designer project to create a EndUserDesigner.exe in your projects Bin>Debug folder.
  8. Copy the Grapecity.ActiveReports.config file from the C:\Program Files\Common Files\ComponentOne\ActiveReports 8\ location and paste it into your End User Designer project's Bin>Debug folder.
    Caution: Grapecity.ActiveReports.config file should always be placed inside the same folder as the EndUserDesigner.exe file for displaying a tile layer on a Map.
  9. Right-click on the Grapecity.ActiveReports.config file and select Include in this Project to make changes in the config file.
  10. Double-click to open the Grapecity.ActiveReports.config file and paste the following code between the <Configuration> and </Configuration> tags:
    Paste between the <Configuration></Configuration> tags.
    Copy Code
    <!-- Register and configure custom tile provider. -->
    <MapTileProvider Name="Custom" DisplayName="Custom Provider" type="YourTileProvider, AssemblyName, Version = x.x.x.x">
        <Settings>
          <add key="ApiKey" value="API Key" />
        </Settings>
    </MapTileProvider>
    
    Note: Replace YourTileProvider with fully qualified class name and AssemblyName with the name of the assembly created after implementing IMapTileProvider and IMapTile interfaces.
  11. Add the Class Library project created in step 5 to your Basic End User Designer project.
  12. Copy the YourProjectName.dll created in step 5 and paste it to the current project's Bin>Debug folder together with the EndUserDesigner.exe.
  13. Save and Run the project.
  14. Create a Page Report containing a Map control in the Basic End User Designer. See Reports with Map for more information.
  15. Add a Tile layer to the Map control. Right click the Tile layer and select Edit to view the custom tile provider added in the Provider drop-down. See Use a Tile Layer for more information.
Support Forum