how to load faster or load a static image while loading map

Created on 31 July 2024, 8 months ago

Problem/Motivation

my map has a few thousand points, it takes a long time to load. what do you recommend to load it faster , and/or is there anyway to make a static image show up first while the map is loading?

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

💬 Support request
Status

Active

Version

10.2

Component

Code

Created by

🇺🇸United States dianacastillo Miami

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @dianacastillo
  • 🇩🇰Denmark ressa Copenhagen

    I also had a dataset with a lot of data points, which were better served as an image. So I created a PNG in QGIS and overlaid it on my map, as you can see here: https://arst.dk/luft

    I inserted it with this JavaScript (there are two files here, also the legend in the upper right corner):

    if (window.location.pathname == '/luft') {
      map.setView([56.2, 11.65], 8);
      var pm25Url = '/themes/custom/arst_2024/assets/pm25.png', imageBounds = [[54.443459480, 8.018099313], [57.761847116, 15.575382821]];
      var pm25RangeUrl = '/themes/custom/arst_2024/assets/pm25-range.png', imageBoundsRange = [[56.2, 12.6], [57.2, 13.5]];
      var imageOverlays = L.layerGroup();
      L.imageOverlay(pm25Url, imageBounds).setOpacity(0.6).addTo(imageOverlays);
      L.imageOverlay(pm25RangeUrl, imageBoundsRange).setOpacity(1.0).addTo(imageOverlays);
      imageOverlays.addTo(map);
    }
    
  • 🇺🇸United States dianacastillo Miami

    hi can you tell me which file you put that code above in ? and also how can i load the image only while the actual map is loading? then take away the image?

  • 🇩🇰Denmark ressa Copenhagen

    I put it into a JavaScript file in my theme. I don't know how to remove it, since I don't do that.

  • Status changed to Fixed 16 days ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024