none
Map Tiles and clustering RRS feed

  • General discussion

  • Not really a question just thought this was cool.

    Recently figured out a way to implement "auto-clustering" with Map Tiles. We had a requirement to be able to handle multi-millions of locations on a map. The cool thing was the simplicity of the solution. The 256x256 pixel tile bitmaps imply a limit of 65536 discrete anchor locations (bitmap pixel coordinates) per tile bitmap. The answer was simply to track existing tile pixel anchor points that had already been rendered and simply don't render any additional icons at these same anchor points.

    The Bing Maps requests back to our server at zoomed out levels were finding millions of points per request per tile bounds. These reduced to a couple or few 10s of thousands of resulting rendered icons due to the translation of lat/lon to the tile pixel coordinates.

    The individual points naturally break apart throughout the zoom range as the map viewport is zoomed in.

    Example for specific zoom level:

    Points found based on tile bounds = 3736461
    Icons rendered on tile bitmap based on unique anchor points = 15285

    Points found based on tile bounds = 7835204
    Icons rendered on tile bitmap based on unique anchor points = 29632

    Pretty awesome. Our largest layer currently is over 16 million locations and generates the tiles pretty fast for this very large dataset. Once generated they are reused.

    Obviously lesser size datasets are rendered even faster.

    Thanks to Ricky and Pedro. Their previous blogs/articles were built upon to come up with this solution.

    Sunday, December 31, 2017 1:45 PM

All replies

  • Hi Conus and Ricky,

    Please could you develop a little more about your technique ?

    Thanks in advance and best wishes for the New Year !

    Monday, January 1, 2018 9:48 PM
  • Hope this helps some. I can't really show the actual code but this should give an idea. Completely eliminates need for clustering or maybe I should say it is a natural clustering.

    YOUR RENDERING METHOD FOR TILE BITMAP IMAGE POINT ICONS(...)
    {
     HashSet<Point> ptSet = new HashSet<Point>();

     try
     {
      ...

      if (!ptSet.Contains(p))
      {
       g.DrawImage(icon, p);
       ptSet.Add(p);
      }
     }
     catch(...)
     {
      ...
     }
     finally
     {
      ...
     }
    }

    Wednesday, February 28, 2018 12:54 AM