Jump to content
  • Offline Maps in Spotfire


    This article contains guide, where you will learn how to host map tiles locally for use in Spotfire.

    Introduction

    Map tiles (or tiles web map, slippy map, or raster tiles) are a map displayed on your Map Chart by seamlessly joining dozens of individually requested image files over the internet. They are convenient because they are loaded on-demand over the internet but there are some cases where it is desired to work with maps offline. That's the reason why Spotfire allows the use of a local override of the default map service.

    In this guide, you will learn how to host map tiles locally for use in Spotfire.

    Note: When using maps offline in Spotfire, you will need to manually specify the projection for any imported shapefiles since the list of supported projections is fetched from the cloud.

    Download the Map Tiles

    This guide comes with a pre-downloaded map tiles package (maplayer.zip) containing worldwide raster tiles and vector tiles (used for PDF export) down to zoom level 6 (level 0 is the lowest level of details). It is precise enough to visualize data at country, state (Admin-1), and county (Admin-2) levels offline.

    You can download the package (maplayer.zip) at the bottom of this page.

    You can also download map tiles for a specific geographic area or for additional zoom levels for use offline. To do that you will need to follow the latest section of this article "Creating a custom Map Tiles Package".

    Setup a Localhost Server to host the Map Tiles

    1. Go to Control Panel > Programs > Turn Windows features on or off.
    2. Check "Internet Information Services".

      screen_shot_2019-05-22_at_14_23.44_0.png.78554ba072451a9386b103d4fa8b0120.png

    3. Click OK.

    Enable Cross-origin Resource Sharing (CORS)

    CORS must be activated on Internet Information Services to enable fetching vector tiles used for PDF Exports of map charts in Spotfire.

    1. Go to Control Panel > Administrative Tools
    2. Open Internet Information Services (IIS) Manager
    3. Open HTTP Response Headers

      iis_manager.thumb.png.28e2ededf7916af6a67d04236008a10c.png

    4. Click Add and enter the following setting:

      Name: Access-Control-Allow-Origin

      Value: *

      enable_cors.thumb.png.f94847d91157a00daa2432e43fbdc2ea.png

    5. Click OK.

    Install the Map Tiles

    1. If not done already, extract the (Download the maplayer.zip file from the Resources section at the bottom of this article) archive you previously downloaded
    2. Move the "maplayer" folder in your localhost directory (Local Disk > inetpub > wwwroot).

      screen_shot_2019-05-22_at_14_31.25_0.png.9d96eeac07dcbf2aa68cae9f9cee6449.png

       

    3. Eventually, if the offline map will be called from a different domain than localhost, modify the URL in the JSON Files (services-list & offline map).

      screen_shot_2019-05-22_at_14_28.37_0.png.96ce6e110c4a000dc1403e789677048e.png

       

    Configure Spotfire

    The offline map tiles are ready to be used in Spotfire. You simply need to change the default Map service URL to your locally hosted tiles.

    1. Start Spotfire.
    2. Go to Tools > Options > Map Chart.
    3. Check "Custom URL" and replace the default URL with the URL of your locally hosted tiles service list (Should be http://localhost/maplayer/services-list.json).

      screen_shot_2019-05-22_at_14_34.20_1.png.d3f34a2b70270140713b68157032d97c.png

    4. Click OK and restart Spotfire (A change of map service will only take effect after the program has been restarted).

    Configure Spotfire Web Player

    If you need the Spotfire Web Player to use offline tiles, you simply need to change the default Map Service URL to your locally hosted tiles in the Administration Manager.

    1. Start Spotfire.
    2. Go to Tools > Administration Manager > Preferences > Everyone > MapChart > MapChartPreferences
    3. Enter URL of your locally hosted tiles service list (Example: http://localhost/maplayer/services-list.json) in "DefaultWebMapServiceListUrl" and "DefaultHttpsWebMapServiceListUrl"
    4. Close.

    Creating a Custom Map Tiles Package

    This part of the guide provides guidance on how to download map tiles from Spotfire GeoAnalytics map service using QGIS.

    Note that this method is way to download raster tiles to be used offline in your Spotfire analysis. This method does not support downloading vector tiles necessary to support offline PDF Exports of map charts in Spotfire.

    QGIS is a free, open-source professional GIS software available for Windows, macOS and Linux used to create and edit geospatial information. The instructions below are based on QGIS 3.6.

    Install and configure QGIS

    1. Download, install and start QGIS
    2. Go to Plugins > Manage and Install Plugins...
    3. Install the "Tiles XYZ" plugin and close the Plugins windows

      screen_shot_2019-05-22_at_17_09_51.png.5f753f6abddbf1d11ad0d9a573c34997.png

    Add the Spotfire GeoAnalytics map tiles

    From the Browser panel, right-click XYZ Tiles and create a New Connection with the following information:

    • Name: Spotfire GeoAnalytics
    • URL: It depends on the style of the map you would like to download:
      • Light map: https://geoanalytics.spotfire.com/tile/standard_map/{z}/{x}/{y}.png
      • Dark map: https://geoanalytics.spotfire.com/tile/rich_ref_map_dark/{z}/{x}/{y}.png
    • Min. Zoom Level: 1
    • Max. Zoom Level: 18
    • Referrer: © OpenStreetMap Contributors
    • Tile Resolution: Standard (256x256 / 96 DPI)

    screen_shot_2021-07-19_at_10_35_24.png.0f7e3abf5bf27adbccdfa0a0bd19f661.png

    Click OK and double-click the Spotfire GeoAnalytics XYZ Tiles service you just created. The Spotfire GeoAnalytics map is now added to QGIS and visible from the Map View.

    screen_shot_2019-05-22_at_16_41.51_0.png.936be4168121612d78464594c0fc3d3f.png

     

    Downloading the Map Tiles

    The guide comes with a map tiles package template containing the files necessary for Spotfire to make your map work offline.

    1. Download the template package (maplayer-template.zip) at the bottom of this page.
    2. Extract the archive and rename the folder to "maplayer"
    3. Go back to QGIS
    4. Open the Processing Toolbox (Ctrl + Alt + T), double-click "Generate XYZ Tiles (Directory)" and enter the following information:

      - Extent: Select "Use Canvas Extent"

      - Minimum Zoom: Choose the minimum zoom level (level 0 the lowest, level 18 the most precise)

      - Maximum Zoom: Choose the maximum zoom level (level 0 the lowest, level 18 the most precise)

      The higher the number of zoom levels you select the longer it will take to download the tiles and the more storage space will be required from your local drive.

      We don't recommend downloading tiles from zoom level 10 and upper.

      screen_shot_2019-05-22_at_16_52.40_0.png.bca562848493e1ad4d3cc6e5d92b37bb.png

    5. Click "Run". Map Tiles are now downloading. This process can take a while depending on the number of zoom levels and their precisions.

    Configure the Template Package

    1. Go to the maplayer folder you previously downloaded and extracted
    2. Open offlinemap.json with a text editor
    3. Change the value for the following lines:

      - minScale = The minimum zoom value you set in QGIS

      - maxScale = The maximum zoom value you set in QGIS

      screen_shot_2019-05-22_at_17_04_34.png.3028b6799d7dad710452d28354328ae8.png

    4. Save and close the file

    Your custom Map Tiles package is now ready to use with Spotfire. You can follow the steps described at the top of the page.

    Resources

     

     

    maplayer-template.zip maplayer.zip


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...