IsraelHikingMap / Site

Israel Hiking Map has maps, route planning, and travel information for Israel. This repository holds the files needed for running the Israel Hiking Map site and apps.
https://israelhiking.osm.org.il/
Other
81 stars 33 forks source link

Improve legend control #234

Closed HarelM closed 8 years ago

HarelM commented 8 years ago

This legend is probably the closes solution to what we want: https://github.com/yohanboniface/Leaflet.TileLegend It relays on creating small maps inside the legend control to show the relevant data so that when changing the map the legend get updated automatically. Problem with the above plug-in is that it doesn't support angular and we can't tell it where to be. Also when scrolling it doesn't scroll the legend bug it zooms the map... Issues were opened there, I'll probably be able to implement it before they fix them...

HarelM commented 8 years ago

Totally possible (and not even that complicated, not planning on using the above plugin but rather re-write it for angular)! The legend items however will not be per-tile-type but rather general for all. When changing the layer the legend will change according to currently selected tiles. Styling will be better, don't worry about it, this is just a POC. @zstadler @valleyofdawn please approve the new approach to the legend - this means no ad-hoc legend generation, no pop-up. do we still need to consider adding the legend over the sea of Galilee for non site users? image

@zstadler please provide a list of sections and legend items with position and zoom, please make it in Hebrew and English.

zstadler commented 8 years ago

@HarelM

IsraelHikingLegend.zip includes an initial and partial definition.

  1. Can we use the translation tool instead of hard-coding the translations?
  2. Could you create a mock-up site for testing the definition?
HarelM commented 8 years ago
  1. Yes, I'll update zanata with the English words so you'll be able to traslate.
  2. Yes. It'll take some time although most of the work is done.
HarelM commented 8 years ago

Not sure the marked trails is an important section, removed the jerusalem trail from it anyway otherwise we'll need to add Golan trail, Haifa etc... Words have been uploaded to Zanata, feel free to translate them to hebrew: https://translate.zanata.org/iteration/view/IsraelHiking/Main New Legend can be viewed at the test site, better design is needed, if you have any ideas how to make it look better I'm open to suggestions: http://israelhiking.osm.org.il/Test/ @valleyofdawn, @zstadler: Please see which of the items in each legend are common and which are type specific and I'll see how I can add relevant sections or items by the type of map or something. @zstadler: I'm going to check-in the code now so you'll be able to add more legend items, please see the following file: https://github.com/IsraelHikingMap/Site/blob/master/IsrealHiking.Web/controllers/InfoController.ts

valleyofdawn commented 8 years ago

Are you planning this for IHM only or for IL-MTB as well?

HarelM commented 8 years ago

Both, see my comment about common things. I kept the current image for reference, imagine that it wouldn't be there.

zstadler commented 8 years ago

Initial thoughts:

See how clean it looks on map.hotosm.org

2016-09-16 16_14_49-hot style legend
HarelM commented 8 years ago

As I said, I didn't do any design, the purpose was to show you how it works, and if there are missing stuff. I'll see if I can mimic the design of the original plug-in. This legend will be used for both maps one way or another so keep in mind that it is not IHM specific or if it needs to be then I think there should be map specific section. @valleyofdawn I still want your input on this, I know you spent sometime on the legend and it's important to have you with us. I don't think the goto functionality is needed, I think it's a gimmick, I thought about implementing it but didn't see any value it brings... I want to add this soon so please see what is missing in each legend and add it. I've fixed #235, so I'll add it to the test site.

HarelM commented 8 years ago

How about linking legend items to relevant OSM wiki value instead (Israeli wiki for those that are not part of the OSM wiki)?

valleyofdawn commented 8 years ago

To be frank, I don't like the idea. I hope it's not just because of the work I've put into the current legend. To watch all the icons this way would take a lot of scrolling, the background is irrelevant and obscuring and the not perfectly straight lines are an eye-sore. It looks like some kind of makeshift improvisation. Sorry

HarelM commented 8 years ago

Perfectly good points. However, consider the following adventages

  1. Translations are "free" (Might be possible in current legend by creating another image for each map, but it's not very elegant...)
  2. Added maps have a legend of their own (this is a nice advantage that we get from using this method).
  3. We can add a search in the legend so that you won't have to scroll much - very easy to implement with angular (our javascript framework).
  4. I think we should still create some sort of Legend on the Kinneret for apps that uses our map without our site, if we do so we can use this place to "harvest" the icons so that they are straight and without background. Does this address most of your concerns?
zstadler commented 8 years ago

I've asked Harel to look into this style of legend as I could not get myself to create the old style legend for almost 100 graphic features currently used in the hiking map.

This is in spite of the fact that almost half of them are missing in the current legend. Editing an OSM file with JOSM and making everything aligned and equal-spaced is just too much. Let alone the cost of adding just a single new entry like the drinking water icon added last week.

Removing the legend on the Kinneret is IMHO a small price compared to an outdated legend.

Regarding the other concerns, which I share:

I think we cannot have "one legend fit all" as some features are specific to a given map - the marked trails in the hiking map and the MTB scale in the biking map are just two example. Other examples exist in the POI icons. On the other hand, any potential sharing is desired.

HarelM commented 8 years ago

I have updated the styling now, so it should look a lot better. Placing a few POIs on the same line will probably create the same issue with the old Legend only in the site, so I'd be happy to avoid it. I think that search the legend should cover the scrolling issue, we should also remember that most people won't look at it more than 10 seconds so I'm not sure scrolling should be considered an issue. I think that most feature are common and that there are some who are map specific. We can add a parameter to an item or a section to tell the legend if to show it or not according to the current map, shouldn't be hard...

zstadler commented 8 years ago

I suggest that an item can have a list of maps that will NOT show it. This way when a new map is added, by default all items will be shown in the legend.

HarelM commented 8 years ago

Sounds OK to me, although I prefer not to maintain a list but a single value if possible so if it is related to more than one map it's probably related to all the maps, but we should look on a more specific feature and discuss it otherwise it's kinda virtual...

valleyofdawn commented 8 years ago

In the case of IL-MTB, people are unlikely to look for the legend for points, as they are mostly self-explanatory. What is essential is the legend for the paths. Their color, style and halo are the essence of the map and cannot be guessed. These features are currently not shown in the legend, while irrelevant ones, such as trail-marking, are.

HarelM commented 8 years ago

I know you we do not see eye to eye on this feature, but I think you should tone it down a bit (Unless I'm misreading, your comment is a bit angry). My initial question was what should be in the legend assuming it can be map specific - I still don't have a full answer from you, unless your answer is look at the currently existing legend and use that (which is a perfectly valid answer). I agree with you that scale is important and I know it's currently not in the legend, but I did ask your input and I know you'd want it there, there question is what else, if at all?

zstadler commented 8 years ago

I'm preparing a "Bicycle Trails" section that will be not be shown in the hiking map. Similarly, the "Marked Trails" and "Regional Trails" sections should not be shown in the MTB

valleyofdawn commented 8 years ago

Not angry at all. Just curt. Whatever is in the current legend, particularly the top right part, must be in.

zstadler commented 8 years ago
2016-09-18 17_00_51-israel hiking map 2016-09-18 17_01_47-israel hiking map
HarelM commented 8 years ago

@zstadler can you check-in the code? or send the relevant part?

HarelM commented 8 years ago

@zstadler @valleyofdawn new legend with Hebrew and English support, and filter by map type is now published to test site, please make sure I translated all the words correctly and that all elements are there. Do we want to link to the relevant OSM wiki page? I think it could be a nice addition...?

zstadler commented 8 years ago

Something to consider:

  1. Which legend, if at all, should we show when the base layer is Google Earth or user-defined?
  2. If the "Hiking Trails" overlay is visible, should we add the "Marked Trails" and "Regional Trails" to the legend, regardless of the base layer used?
zstadler commented 8 years ago

I've made some changes in the Hebrew translation. There is some ambiguity related to the term "שביל" which can mean a trail, a route, and a path. I suggest we use the word "שביל" for trails (walking and bicycle relations) and use the word "דרך" elsewhere, if possible. However, I could not find an alternative translation for "path" other than "שביל"...

HarelM commented 8 years ago

I think it's a bit too much for a legend, Google layer legend is not working unfortunately and I'm not sure I want to invest time in fixing it... I think this is sufficient for now, if we'll want to improve it more we can do in the future, I want to close this issue...

zstadler commented 8 years ago

I think it's a bit too much for a legend, Google layer legend is not working unfortunately and I'm not sure I want to invest time in fixing it...

I don't think we should "invent" a legend for Google Earth or User's layers. It would be nice to have the "Marked Trails" and "Regional Trails" show in the legend if the marked trails overlay is visible.

I think this is sufficient for now, if we'll want to improve it more we can do in the future, I want to close this issue...

The legend's contents is not finished yet.

@HarelM, Please let me know how you would like to annotate turning-off specific POI entries in one map or another. For example, under Amenities, bike shops and first aid show only on the MTB map. On the other hand, under barriers, walls show only on the hiking map.

HarelM commented 8 years ago

Google layer is different from regular tile layers because there's no address like other layers has which makes the process of creating a small legend map more complex, so I was thinking not to create the legend in this case which will make things easier for me...

There's no reference to overlays in the info controller now, adding it might get things complicated and I wanted to avoid that too (I sound really lazy, I know... :-/).

I was sure the legend content was complete, sorry.

Currently I left the logic of creating the legend and manipulating the legend to two different part in the code as you might have seen. The first part of the code creates the complete legend that has everything in it and later the second part of the method removes irrelevant things according to rules that are hard coded. I'm not sure this is the cleanest way but I chose to implement it like that so the legend declaration will not have any logic in it. So I think we can continue using this logic to remove irrelevant points, you can either note it by comments so that I'll know when I come to implement it or you can write the logic yourself at the bottom of this huge function.

HarelM commented 8 years ago

@zstadler any estimation when you think the legend will be complete? I want to add all the little fixes I made to production.

zstadler commented 8 years ago

@HarelM I'm back on it. Hopefully I'll be done in the weekend.

zstadler commented 8 years ago

@HarelM Will it be possible to automatically scroll a section to the top of the pane when it is expanded?

For example, Some of the POI's are hidden when you expand their section:

2016-09-21 14_57_53-

It would be great if the expansion would also scroll the section title as high as possible, without hiding it:

2016-09-21 15_00_03-

Similarly, if the "Bicycle Trails" "section is expanded when the Singles" section is already expended, it is hardly seen:

2016-09-21 14_55_09-

Scrolling the section title as high as possible would result in this view

2016-09-21 15_02_18-
HarelM commented 8 years ago

It is possible, but I think you are overthinking it. I prefer to invest my time in real issues like routing or new features like missing formats. In any case I would feel better to add this as another issue so I'll have it in the backkog.

HarelM commented 8 years ago

@zstadler I'm not aware of anything that is missing in this implementation, please close this issue once you finish your tests.