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

Derive attribution from sources in current style #2723

Closed

Description

@kkaefer

We should implement callbacks that notify the embedding applications of changes in attributions. Attributions are included in Sources, and they may change when enabling/disabling tiles from a source depending on the stylesheet, or when setting a new stylesheet that includes different sources.

Activity

  1. tmpsantos commented on Nov 13, 2015

    @tmpsantos
    Contributor

    👍

  2. added this to the ios-future milestone on Aug 12, 2016
  3. 1ec5 commented on Aug 12, 2016

    @1ec5
    Contributor

    This is unblocked now that the runtime source API has landed (#5368). The SDKs already manage attribution for the application, so the callback would be provided by the SDK rather than the application.

    Each SDK will need to intelligently display the attribution string stored in mbgl::Tileset::attribution. Unfortunately, the attribution string embedded in TileJSON is either literal text or HTML source code (usually the latter) rather than structured data:

    <a href="https://www.mapbox.com/about/maps/" target="_blank">&copy; Mapbox</a> <a href="http://www.openstreetmap.org/about/" target="_blank">&copy; OpenStreetMap</a> <a class="mapbox-improve-map" href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a>

    We definitely don’t want to display this HTML source code verbatim in the UI, so we’ll need to do some parsing at the SDK level.

    On iOS, we currently display attribution in an action sheet, with two hard-coded buttons, labeled “© Mapbox” and “© OpenStreetMap” , that open the appropriate URLs. There is also an “Improve This Map” button.

    ios

    On macOS, we display attribution much as GL JS does, but implemented as a row of NSButtons that open the appropriate URLs. On each button, the text is underlined except for the copyright symbol, for aesthetic reasons. “Improve This Map” isn’t currently built into the SDK (#5775), but it would go in the Help menu rather than beside the attribution.

    macOS

    On both iOS and macOS, we can convert the HTML string into an NSAttributedString using a built-in API (that uses WebKit under the hood). Then we can enumerate the links inside the attributed string, spitting out an action button or NSButton. We’d need special cases for copyright symbols and the redundant “Improve This Map” button.

    /cc @pveugen @friedbunny

  4. kkaefer commented on Aug 12, 2016

    @kkaefer
    MemberAuthor

    Maybe it's time to update the TileJSON specification and augment the attribution field with a more structured approach to different attribution sources. Also, instead of specifying this globally in the TileJSON file, we should also consider moving this to the individual vector tiles so that we can show the correct attribution for the currently visible tiles given that many tilesets contain a mix of different data sources in different locations.

  5. friedbunny commented on Aug 12, 2016

    @friedbunny
    Contributor

    @1ec5 As you said, convention on platforms with larger viewport sizes (e.g., desktop and web) is to show these copyright notices directly on the map. I’m not sure if you’re suggesting we do that on mobile, but if so, I don’t think that’s feasible.

    On iOS, I’d love to replace the current actionsheet with something better: a custom view, which would allow us more control over appearance and content. We’ve not gone the custom view route because of worries about polluting the host application’s view hierarchy (or making incorrect assumptions about it), but perhaps we should investigate this again.

  6. 1ec5 commented on Aug 12, 2016

    @1ec5
    Contributor

    On iOS, the problem with a modal view remains: that it’ll either be boxed in by the map view (which can be relatively small), making it not really a modal, or it’ll hitch onto the host view controller, which opens the SDK up to all sorts of fragility because not everyone displays a full-screen map view alone in a view controller.

    In any case, changing the presentation of attribution is out of scope for this ticket. #2723 (comment) is simply about detailing the requirements for the current presentation on each platform, and how we’d achieve “data-driven” attribution instead of the hard-coded attribution we have now.

  7. friedbunny commented on Aug 12, 2016

    @friedbunny
    Contributor

    the requirements for the current presentation on each platform

    Agreed that we can have a specific design discussion later. @kkaefer’s suggestions sound sufficiently modular and we should be able to make better decisions if/once that is available.

  8. 1ec5 commented on Aug 13, 2016

    @1ec5
    Contributor

    The structured attribution proposed for TileJSON in #2723 (comment) would be a welcome change. In the meantime, in #5999, I’ve implemented dynamic attribution that parses the HTML source code provided by existing TileJSON documents.

  9. 1ec5 commented on Aug 13, 2016

    @1ec5
    Contributor

    Tracking structured attribution in TileJSON in mapbox/tilejson-spec#20.

  10. 3 remaining items

  11. added 2 commits that reference this issue on Sep 22, 2016
    147cd9d
    6433cc7
  12. 1ec5 commented on Nov 29, 2016

    @1ec5
    Contributor

    Reopening to track SDK-level support for this feature:

    /cc @tobrun

  13. reopened this on Nov 29, 2016
  14. removed this from the ios-future milestone on Nov 29, 2016
  15. added
    Android
    on Nov 29, 2016
  16. changed the title [-]Source attribution callbacks[/-] [+]Derive attribution from sources in current style[/+] on Dec 4, 2016
  17. 1ec5 commented on Dec 9, 2016

    @1ec5
    Contributor

    Fixed for iOS and macOS in #5999.

  18. added this to the milestone on Jan 19, 2017
  19. modified the milestones: android-v5.1.0, on Apr 4, 2017
  20. self-assigned this
    on Apr 4, 2017
  21. tobrun commented on Apr 4, 2017

    @tobrun
    Member

    PR enabling this for android in #8630

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

Metadata

Metadata

Assignees

Labels

Androidfeature

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions