-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add stop layer to new Debug UI #5602
Add stop layer to new Debug UI #5602
Conversation
74e3120
to
934b809
Compare
@testower I'm a TypeScript noob. Can you give me a hand at getting around the compiler errors? |
I don't understand the need to define the map style in Java, when MapLibre has the style defnition fully typed. Did you look at the "MapStyle" interface? |
First of all I didn't know that
Secondly, I was a lot more comfortable writing Java and I suspect other devs will be too. Thirdly, I wanted the code that generates the data and the code that generates the styling close to each other sharing some identifiers (like layer names). This means that refactoring is a little easier. I'm happy to debate these points and find a way forward that suits everyone. |
Yes you'll find it in the 'react-map-gl' package:
I'm sure there's some tradeoff here. In my view, the styling definition is client/implementation-specific and should live close to the client. I don't think we should offload code to the Java server just because it's more convenient. Also, exposing the MapLibre / Mapbox styles in the api suggests that they are then officially part of the api? If that should be the case, then I think it makes more sense, but not for convenience. |
Well, we are not building a style against a generic vector tile schema like https://openmaptiles.org/schema/ but styling some very domain-specific geometries. Whether you consider that part of "the API" is up for debate. Next week I'm back at the dev meeting. We can talk about that there or on Gitter. |
Sorry @testower I made a tiny one-character change at the same time you approved. |
75fc366
to
756a289
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
if (e.features) { | ||
// if you click on a cluster of map features it's possible that there are multiple | ||
// to select from. we are using the first one instead of presenting a selection UI. | ||
// you can always zoom in closer if you want to make a more specific click. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's neat. A potential improvement could be to instead zoom in one level if you encounter a cluster? Not critical for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if that would be a good or bad UX but I'm willing to try it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's something I've seen in other map implementations at least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We agreed that we will implement in an upcoming PR.
a2d58be
to
d17d9b7
Compare
d17d9b7
to
24d5929
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Built locally and tested. UI started with:
cd client-next
npm install
npm run dev
Stop layer is visible and functioning as expected on the map. One comment: click-away from the stop popup closes the popup (in line with many other UIs), but if that click is right on another stop, it only closes the first one and doesn't open the second. The ability to click several stops one after the other to inspect them could be useful (open/close/open/close).
I will take a look at this next time I touch the UI code. |
Summary
This adds a vector tile layer for displaying stops in the new debug client. It looks like this:
It does this by adding some model classes that make it easy to write the layer style code in Java. This is a little less error prone than writing the JSON "by hand". Still, the domain (vector tile rendering and styling) is complex so you have to familiarise yourself with how Mapbox/Maplibre renders the map in order to write your own.
Issue
#5330
Unit tests
✔️
Documentation
Javadoc.