mapbox / mapbox-gl-native

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
4.36k stars 1.33k forks source link

Add support for annotations when snapshotting #11113

Closed friedbunny closed 4 years ago

friedbunny commented 6 years ago

It’s currently impossible/difficult to add annotations or shape overlays to snapshots — we should support this use-case, as it’s somewhat rare for developers to simply want a plain map image.

The current workaround for this use-case is to use our web static maps API, wrapped by something like MapboxStatic.swift, which does include direct methods for annotations/overlays.

Related: https://github.com/mapbox/mapbox-gl-native/issues/9914, which talks about adding runtime styling support to the snapshot APIs.

/cc @ivovandongen @tobrun @1ec5 @frederoni

frederoni commented 6 years ago

We're on par with MKMapSnapshot as of #10163. Are you saying that we should provide a way to draw images on images or is the conversion between coordinate systems sufficient?

friedbunny commented 6 years ago

@frederoni I think we should do a couple things:

https://github.com/mapbox/mapbox-gl-native/blob/90f29a91729b536da9f090d389549db1ec4b8e9f/platform/darwin/src/MGLMapSnapshotter.h#L132-L133

1ec5 commented 6 years ago

Look at enabling the composition of point and shape annotations, using existing classes, onto a map before it’s rendered into a raster image.

Both point and shape annotations are rendered by style layers, and snapshots don’t need on-the-fly addition/removal or interactivity. So once snapshots support runtime styling (#9914), MGLMapSnapshotter could translate annotations to style layers as they are added to the snapshot.

View-backed annotations could work similarly, except that we’d snapshot the view before adding it to the snapshot. (Yay overloaded terminology!)

tobrun commented 6 years ago

Removing android label as https://github.com/mapbox/mapbox-gl-native/issues/9914 would be the same since we don't have the concept of a view annotation anymore on android.

stale[bot] commented 5 years ago

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

julianrex commented 5 years ago

Still valid.

591700757 commented 5 years ago

Since this is stil open, I really want to make sure if Mapbox can create map snapshot with annotations already added on it. please take a look at my post: https://github.com/mapbox/mapbox-gl-native/issues/15618

stale[bot] commented 4 years ago

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.