bryceco / GoMap

OpenStreetMap editor for iPhone/iPad
ISC License
318 stars 41 forks source link

Copy iD's theme #730

Closed verhovsky closed 5 months ago

verhovsky commented 6 months ago

I like iD editor's theme and it would be nice if the OSM editors I use had a consistent theme so I didn't have to learn more than one.

bryceco commented 6 months ago

If you're referring to the color palette used for roads, etc. then these are defined in RenderInfo.json. Feel free to update and submit a PR. Some of the other styling, like tunnels/bridges is done in code, but I'm not against changing it. Note that we don't use dashed lines anywhere because of performance impact.

bryceco commented 5 months ago

I'm not totally happy with the result of this. I was out mapping a couple days ago and certain lines are very difficult to see:

Part of the problem is that these objects don't have casings. In iD the parking lot has the gray gradient next to it that makes it more obvious. Also the power-line line is thicker than what we show.

verhovsky commented 5 months ago

By grey gradient you mean that it's not a complete filled in grey, that the fill stops after 60px?

I couldn't figure out how to achieve that effect.

bryceco commented 5 months ago

Yes. I don't think it's possible without doing a bunch of math on the geometry.

bryceco commented 5 months ago

59876c7f0a013ec3255ef13e59a8375973c131bf

verhovsky commented 5 months ago

you could also try adding a faint shadow instead.

bryceco commented 5 months ago

I considered that, but I figured the performance impact for a shadow would be higher, and not much better appearance. But maybe I'm wrong.

tordans commented 5 months ago

I am also testing the new theme and have a couple of places that are not yet ideal in Berlin. I will try to document them more properly, but a quick list is…

And I agree, the casings style from iD is one of the biggest missing factors. But maybe we can also introduce a gesture that toggels the wireframe vs. fill style so it becomes easer to see the data, then see the source data and back. Are there any gestures that are not part of the iOS gesture level that could be used, like swiping in from the top right corner into the screen?

bryceco commented 5 months ago

@tordans The line styles and casings are translated from the iD source via a script, so in general they should be identical. If you can name specific way IDs that are rendered wrong it would be super helpful so we can see where things are going wrong. It's true that we're ignoring the whole concept of area at the level where colors are chosen, so that could be part of it.

I personally think the gigantic casings in iD are pretty ugly so I'm happy to leave them behind, though I see the advantage of not filling areas.

tordans commented 5 months ago

If you can name specific way IDs that are rendered wrong it would be super helpful so we can see where things are going wrong.

Barriers

https://www.openstreetmap.org/way/549291669 Bildschirmfoto 2024-04-30 um 06 35 23 image

Barrier Curb

https://www.openstreetmap.org/way/1267121761

image image

Areas

Footway + Footway Building Passage

image image

building:part

Example https://www.openstreetmap.org/way/560517989

image image

All kind of playground line/way

https://www.openstreetmap.org/way/311072326 https://www.openstreetmap.org/way/60443941

image image

building with black outline

https://www.openstreetmap.org/way/908199103 image image

Missing icon in area

Not sure if this is important, but it is helpfull… https://www.openstreetmap.org/way/930016301

image image

Embarkment

https://www.openstreetmap.org/way/1156140193 image image

Parking

https://www.openstreetmap.org/way/888505080 Lines are softer(?)

image image

Look of path like ways

The dashed lines in iD for Footway, Sidewalk, all the Crossing styles look noticable different in iD. They are thicker and the dash is different. I think it is harder now than before to distinguish a bike path from a sidewalk

This area has a few different stiles in one place https://www.openstreetmap.org/way/1000299492

image image


Added 2024-05-06

retaining wall

Example

image image image
bryceco commented 5 months ago

Wow, very nice! This is your department Boris @verhovsky ! 😅

verhovsky commented 5 months ago

Amazing comment, thank you. I'll look into this on Saturday probably, I don't have my laptop with me right now.

bryceco commented 5 months ago

FYI over in Rapid there is a work in progress revamping how styles are done. It may or may not be easier to use that as a basis for the translation:

https://github.com/facebook/Rapid/pull/1384

tordans commented 5 months ago

FYI: The way the styles are set up in Rapid is a complete refactor of the iD setup (same styles, different software). That happened a whole back when the new Pixi based map was build. The current PRs (like the color blind PR you linked) build on top of this new foundation.

bryceco commented 5 months ago

Good to know! I didn't look into it deeply, I just saw that it was moving more toward a JSON representation.

verhovsky commented 5 months ago

https://github.com/bryceco/GoMap/blob/cd7664ee2bc7008d6c8e3c421c658cf73f03645a/src/Shared/EditorLayer/iD/Theme.swift#L34

is wrong. barrier is not a primary tag, things can be styled in the CSS without being a primary or having a primary. If you want to apply a custom style to things with certain tags, filtering those tags out should happen before .match() and .match() should always return a value.

bryceco commented 5 months ago

The specific situation I'm trying to handle is when a node doesn't match any feature, but still contains an address tag like "addr:housenumber"="155". This is frequent when importing address information from government sources. In that situation we return nil and detect that it's an address separately, and can style it appropriately.

If it matches a feature we want to style it like the feature, but if it matches nothing but looks like an address then style it like an address.

I guess another way to handle this is to expose the default style as a property, and if the RenderInfo returned == the default style then do the address check.

Feel free to delete that line and I'll clean up the address check later.

bryceco commented 5 months ago

f6fe5e961fb2b3a096e62a3936cf20a552cee965 removes that offending line and cleans up some related RenderInfo stuff that isn't needed now that every object gets its own non-shared copy of a RenderInfo.

verhovsky commented 1 month ago

barrier curbs (line formed out of grey circles) are still un-styled.

Also there are ways that should have arrows pointing out of the line, for example for cliffs "the direction of the way should be so that the top of the cliff is on the left side of the way direction and the bottom on the right side" and when you draw one in iD it draws arrows showing the direction of the cliff using this convention instead of drawing arrows in the direction of the way. Example:

Screenshot 2024-08-27 at 16 56 22