Skip to content
This repository was archived by the owner on Dec 8, 2017. It is now read-only.
This repository was archived by the owner on Dec 8, 2017. It is now read-only.

Heat maps #27

Closed
Closed

Description

@1ec5

This GL JS example and this Android SDK demo app activity claim to demonstrate “heat maps”, but in reality they’re hot spot maps. The “heat” only represents frequency, but not, say, a magnitude property in the GL JS example. The overlaid shapes can be blurred circles but not amorphous shapes, and the heat comes apart as you zoom in rather than spreading out.

Some of the requests we’ve gotten for heat maps (such as mapbox/mapbox-gl-native#3420, mapbox/mapbox-gl-native#6304) have turned out to be for actual heat maps. In the Google Maps JavaScript API, HeatmapLayer can work with WeightedLocations for this effect. The Google Maps SDK for Android supports heat maps as well using HeatmapTileProvider and WeightedLatLng. On iOS/macOS, there are a number of libraries based on MapKit (example) that implement heat maps using a custom-rendered MKOverlayView or the more modern MKOverlayRenderer.

The Android and iOS SDKs support something along the lines of these MapKit-based libraries, via an unsupported, undocumented OpenGL style layer API. But we should have a straightforward, officially supported solution for heat maps. As far as I can tell, we may need a new layer type that clusters nearby points of similar intensity into amorphous shapes (rather than collapsing them down into a single point). Please chime in if you think it’s doable with the existing layer types, though.

/cc @mourner @lucaswoj @danswick @noemiwalzebuck @johndpope

Activity

  1. lucaswoj commented on Sep 21, 2016

    @lucaswoj

    Prior art of which I'm aware:

  2. johndpope commented on Dec 10, 2016

    @johndpope
  3. johndpope commented on Dec 17, 2016

    @johndpope

    I did it using the raster tile overlay.
    (ideally it would be done using opengl but this is ok out of the gate)
    img_8306
    (this involved hacking the http_file_source.mm and would also involve protocol swizzling in order to override the control flow outside of sdk)

     NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration];
            sessionConfig.protocolClasses = @[NetSandbox.class];
    

    inside the http_file_source.mm to overide the

    NetSandbox.h
    https://gist.github.com/johndpope/ebcb7c870cb09fd0cbf9b822f3f677a6

    https://gist.github.com/johndpope/fc9749391faad76ee6b94d2ea7a237b6

    IMPORTANT
    At the heart of this - I need the mapbox SDK to surface a way to provide a raster datasource for local data (not by disk location) / but by a delegate / callback like MKTileOverlay methods.
    (or document the way to do this - as it's not entirely obvious)

    eg.
    GridTileOverlay
    -(void)loadTileAtPath:(MKTileOverlayPath)path result:(void (^)(NSData *, NSError *))result {
    UIImage *image = [GridTileOverlay imageForTileX:x y:y z:z];
    NSData *tileData = UIImagePNGRepresentation(img);
    result(tileData,nil);
    }

  4. 1ec5 commented on Dec 17, 2016

    @1ec5
    ContributorAuthor

    At the heart of this - I need the mapbox SDK to surface a way to provide a raster datasource for local data (not by disk location) / but by a delegate / callback like MKTileOverlay methods.
    (or document the way to do this - as it's not entirely obvious)

    There isn’t currently a way to do this for raster content, other than to stand up a local server and point an MGLRasterSource at it. mapbox/mapbox-gl-native#7471 would introduce an API very similar to -[MKTileOverlay loadTileAtPath:result:].

  5. lucaswoj commented on Jan 17, 2017

    @lucaswoj
  6. 1ec5 commented on May 25, 2017

    @1ec5
    ContributorAuthor

    The discussion moved to mapbox/mapbox-gl-js#4756, since we realized TINs wouldn’t help us implement heat maps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions