Cgeo: Add attribution for online tiles

Created on 20 Nov 2016  路  52Comments  路  Source: cgeo/cgeo

Online tiles currently miss attribution. I guess we will fix that primarily for the mapsforge beta.

New Map OSM Prio - High

Most helpful comment

New screenshots:
image

Upon click with example OSM.de in light mode:
image

Upon click with example "Combined offline maps" in dark mode:
image

All 52 comments

@rsudev If you have some spare time, can you explain a little what it meant with "attribution"?

The Mapnik tile usage policy (http://wiki.openstreetmap.org/wiki/Tile_usage_policy) requires to attribute the license as described on http://www.openstreetmap.org/copyright
Something similar is required for OpenCycleMap (http://www.thunderforest.com/terms/)
As this is true even for the old map (and no one complained the last years) it might not be the most pressing matter, but nevertheless something to be done.
We would also need to add attribution for the offline maps, if we would provide a download service, which we currently not do...
Perhaps it might be sufficient to add the attribution to about c:geo, but I am not sue if this also OK.

As this is true even for the old map (and no one complained the last years) it might not be the most pressing matter, but nevertheless something to be done.

There were some complaints, but nothing serious. ;)

We would also need to add attribution for the offline maps

Yes, that is also necessary. I'm not sure but the attribution might be stored in the map file.

I'd like to increase the severity of this issue. This feature is so common that it's probably just a switch in Mapsforge we forgot to enable (hopefully).

Just coincidentally looking at WhereYouGo. Here the osm map has an attribution. We can probably learn from there how to do that.

Do we need to have attribution within the mapview?
We do have attribution for OSM for both Mapsforge library and for the map tile servers in our c:geo - about - contributors pages.

Do we need to have attribution within the mapview?

Yes, that would be the common implementation and also used on Google maps and for OSM in WhereYouGo.

Yes, the attribution has to be in the map view.

For online maps I think we have to provide it ourselves, e.g. for openstreetmap.org "漏 OpenStreetMap contributors" with link to the legal page.

For Mapsforge offline maps the information must be included somewhere in the map file. It might be data from various sources and might include a copyright of the creator.

Working on it

OpenStreetMap, osmde, cyclemap with new Mapsforge:
image

OfflineMap (single file) with new Mapsforge:
image

Offline Map (Combined) with new Mapsforge:
image

OpenStreetMap, osmde, cyclemap with old V3 Mapsforge:
image

Old v3 mapsforge was a nightmare. Couldn't get the zoom-view and the scale-view to move up to make room for map attribution. This is why I added the separate TextView in gray below the map.

PR #9242

Old v3 mapsforge was a nightmare. Couldn't get the zoom-view and the scale-view to move up to make room for map attribution. This is why I added the separate TextView in gray below the map.

Is a very nice solution. Fine.

For the combined map - do we need the attribution for both, or is this ok so?

For the combined map - do we need the attribution for both, or is this ok so?

I was asking myself the same question. But imagine that there are a lot of maps, maybe 8 or so. Attribution would get very long then.

I tried shortly to build a dynamic attribution which changes depending on which underlying map is currently showing. I restrained for now, I think this gets complicated (getting map area out of each map, comparing those on every map move with the shown area, then deciding what to show).

For the combined map - do we need the attribution for both, or is this ok so?

Isn't there any possibility to check, which map is actually shown?

Maybe a scrollable single line (might be hard to use) or a popup?

@Lineflyer seems not trivial as @eddiemuc wrote in his answer to my question.

How about make an link wich opens a message window with a list for all maps?
And if they are from the same source then this could directly shown.

@Lineflyer seems not trivial as @eddiemuc wrote in his answer to my question.

How about make an link wich opens a message window with a list for all maps?
And if they are from the same source then this could directly shown.

I like that idea!

One thing though: for offline maps, to actually get the attribution information out of them, I have to open them (means: create a MapFile for them). So to get the attribution information I would have to create a MapFile for all of them, get info and close it again. Since map files are usually large this might be a costly operation. But I can try it.

They might be large, but they're not loaded completely into RAM. I think it stops after reading the header.

As Mapsforge needs to open each file anyway to detect their boundaries, can't we retrieve the attribution info at that point and store it somewhere attached to the handle, so that we do not have to reopen the files just for attribution?

Regarding the combined map source: I would stay with a popup only - do not put too much effort into trying to investigate which map is currently shown, or if it's just one map "combined" etc. Just show a link "attribution" on combined map, and if someone hits that link, open a popup and show the details. (Could be even done for single offline/online map as well.)

As Mapsforge needs to open each file anyway to detect their boundaries, can't we retrieve the attribution info at that point and store it somewhere attached to the handle, so that we do not have to reopen the files just for attribution?

This is the way I implemented it for usage of single map files.nfor combined maps it is not so easy since afaik mapsforge handles creation of mapfiles internally, so today we never have a MapFile in our hands at any point. I can check whether this can be accessed somehow from the outside though.

Regarding the combined map source: I would stay with a popup only - do not put too much effort into trying to investigate which map is currently shown, or if it's just one map "combined" etc. Just show a link "attribution" on combined map, and if someone hits that link, open a popup and show the details. (Could be even done for single offline/online map as well.)

Yep

New "Combined map" attribution view when all maps have the SAME attribution (in this example I have a total of two maps installed):
image

New "Combined map" attribution when maps have DIFFERENT attribution (note: I had to fake this with setting values during debug, I only have these two maps, so don't wonder why it shows "attributions: 1" and in the popo it shows two times the same attribution):
image

On click:
image

And here new CyclOSM:
image

Looks nice, lets try in real life (nightlies)?

Just tested this. For offline maps the map name in the attribution line takes a lot of space, is inconsistent with online maps and redundant with the map selection. I suggest to remove the map name, what do you think?

@SammysHP that would be easy to change. Do you have a similar suggestion for the "combined" display?

One note to this: in case someone wonders where I actually get the map attribution from the map file: this is simply the "comment" field of the map files metadata section. I took this simply because I saw in m examples that they contain map-attribution-like information. There's also the "created by" field, which is filled with a strange string. If you want attribution filled differently out of the map file, I could do this in one step/commit. Available fields are the ones in following class:

https://github.com/mapsforge/mapsforge/blob/master/mapsforge-map-reader/src/main/java/org/mapsforge/map/reader/header/MapFileInfo.java

IMHO the number of maps / the map name is not needed. But please leave the note in, that the map is stored offline. This is a very helpful feature! I would suggest something like offline 路 5 attributions / offline 路 the attribution text

Ok, I will wait a bit before implementation so others have the chance to contribute their opinion. Also I reopened issue due to this discussion

I'd suggest "5 attributions" and "attribution text". Why "offline" but not "online"? This should not show the selected map but its attribution.

"offline" shows at first glance whether loading the map is using up mobile data or not. This is particularly useful for people with very limited data volume... But we can also show "online" to be consistent

As a follow-up to @fm-sys's proposal I would propose: offline/online and either the attribution text (if it's only one map) or a link "click for attributions" to the popup (in case of multiple files), without a number (so that the different map files do not be opened for attribution text in that case until you open the popup).

From the suggestions posted so far I extract the following consens:

  • For Offline maps: remove map name from attribution
  • For COmbined offline map: remove number of maps
  • For offline maps: keep using field "comment" as source of "map attribution

I got different opinions with regards to:

  • For combined maps: remove number of attributions (1 vote)
  • Leave/add "Online" (for online maps) and "Offline" (for offline maps) as attributaion prefix (2 votes)

@moving-bits parsing the map attribution data in case of multiple maps is necessary anyway to find out whether they all have the same attribution. It is done asynchronously anyway and (as proven in other issues) not the cause of any GUI delays.

So I suggest the following solution which I find is the best compromise between different opinions:

  • For Online Maps (example: OSM): Online: (c) OpenStreetMap contributors (with link(s) as before)
  • For Offline maps, single file: Offline: (content of MapFileInfo.comment)
  • For Combined maps, single attribution: Offline: (content of MapFileInfo.comment)
  • For Combined maps, mult. attribution: Offline (x attributions): click for details

I will wait a while to give chance for feedback in case of opposing opinions. Then I will implement it this way.

Sounds good, but IMHO the offline/online info is not needed. Not related to the attribution itself and the user probably knows, whether he uses offline or online.

Sounds good, but IMHO the offline/online info is not needed. Not related to the attribution itself and the user probably knows, whether he uses offline or online.

:+1:

Let's keep it simple. This is about attribution, not about extra status like online/offline map or other info (what about "hide found caches"?). IMHO:

  • Online maps: Just the attribution
  • Single offline map: Just the attribution if available
  • Combined offline maps: n combined maps, tap for attribution

BTW: This is how Locus shows attribution for e.g. an offline map from openandromaps.
IMHO the link could be nice to include?
image

Regarding the online/offline text I have now two votes in favor (@fm-sys , @moving-bits ) and two against (@SammysHP , @Lineflyer ). Do you want me to flip a coin, is anyone stepping back or shall we wait for a fifth opinion?

@SammysHP : I see you introduce again the idea of displaying number of maps where I thought there is consens to remove it. Also I got from an earlier comment that you want to stay with displaying number of attributions. Did I interpret you wrong?

BTW: This is how Locus shows attribution for e.g. an offline map from openandromaps.
IMHO the link could be nice to include?
image

That is a combination of MapFileINfo.comment and MapFileInfo.createdBy. We can display it (also highlighting the URL is not a problem), but as you can see that would make the map attribution probably longer than one line. Keep in mind that this also changes the way attribution is displayed for the maps we download ourselfes

BTW: This is how Locus shows attribution for e.g. an offline map from openandromaps.
IMHO the link could be nice to include?
image

That is a combination of MapFileINfo.comment and MapFileInfo.createdBy. We can display it (also highlighting the URL is not a problem), but as you can see that would make the map attribution probably longer than one line. Keep in mind that this also changes the way attribution is displayed for the maps we download ourselfes

Sorry, I have to correct myself. That is exactly what we would display too (it is from the MapFileInfo.comment field), I just have to add the highlighting:

image

...but would currently not fit the one-line-view if selecting the single map file
image

Even "offline" would be a nice add-on I agree, that this line should only be used for the attribution and not be overloaded also with other things.

But If we want to keep it simple, we should reduce the content to the absolute minimum. Why do we need the concrete number of maps or even the map name? None of this brings any benefit to our users, so why should we display it?

IMHO this is the way to go:

//one attribution 
Full attribution text 

//multible attributions 
5 attributions, click for details... 

Online/offline would be a nice-to-have, but it would be ok without it as well.

I would like to keep the attribution shown on the map a one-liner in all cases, as map space is very precious, and also I would like to use as little computation effort as needed. Why do we need to show how many different attributions we have? That's hardly an information I need to see every time I'm using the maps. Why not just show a "click here for attribution" (or something similar) while in multi-map mode? Map files then would have to be opened for attribution only on opening the popup.

IMHO this is the way to go:
//one聽attribution聽
Full聽attribution聽text聽

//multible聽attributions聽
5聽attributions,聽click聽for聽details...聽

That might be best I guess and also inline with my comment earlier to ommit offline/online.

PR #9323 is under way to fix most things, but my feeling is it will not be the last...

  • I was not able to keep android from expanding the map attribution line to two lines when text is too long. I have the feeling this is because linkable text is involved (see screenshot). In addition, this shows that even single map attributions can exceed one line...
  • I had to change the meaning of some already existing and translated string.xml values. Especially I had to remove a placeholder from some of them (which is why I had to change some translations too to keep lint satisfied. Hope this works out)
  • Then there's the space issue. Following one of @Lineflyer s comments I installed Locus. They solve the problem a very different way: they only ever show one single small "copyright" icon button, only when clicking on it you can see any attribution. Didn't know this was allowed, should we consider a solution like that?
  • @moving-bits s comments with regards to restrain from parsing mapfiles upfront for comined map are correct, however I didn't want to make the already complex logic for displaying multimap attribution information even more complex by implementing this before the former point is decided (small icon button, no upfront display)

So, what now?

"Scrollable" map attribution text (when too long for one line):
image

New popup for combined maps:
image

Following one of @Lineflyer s comments I installed Locus. They solve the problem a very different way: they only ever show one single small "copyright" icon button, only when clicking on it you can see any attribution. Didn't know this was allowed, should we consider a solution like that?

This sounds like a viable solution, would solve both space & performance "issues".

Ok this would be a "breaking change" with regards to the implementations I have done so far (GUI-wise). I call it "make attribution like Locus".

I would place a copyright icon button to the left of the scale bar, similar to locus (see red circle in following screenshot)
image

Icon to use (from https://material.io/resources/icons):
image

No other attribution information would be visible on map. ONLY when clicking on this icon, attribution info would appear as an overlaying box (black text, white background, like locus) of varying size (not so big for single mapfiles or online maps, bigger for combined maps). It would disappear again when clicking somewhere next to it (like in locus). E.g. like this:
image

Do I have approval of community to proceed this way?

Sounds good! A normal popup like currently for the combined attribution should be fine too.

attribution info would appear as an overlaying box (black text, white background, like locus)

I would stay with c:geo's Theming, black background and white text. At least, if lightmode is not enabled

@SammysHP and @fm-sys : ok and ok :-)

New screenshots:
image

Upon click with example OSM.de in light mode:
image

Upon click with example "Combined offline maps" in dark mode:
image

Just installed this PR locally - really like the solution! Thanks @eddiemuc

Fixed with final solution with #9323

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Lineflyer picture Lineflyer  路  45Comments

Lineflyer picture Lineflyer  路  52Comments

Lineflyer picture Lineflyer  路  50Comments

Lineflyer picture Lineflyer  路  112Comments

andrixnet picture andrixnet  路  52Comments