maplibre / martin

Blazing fast and lightweight PostGIS, MBtiles and PMtiles tile server, tile generation, and mbtiles tooling.
https://martin.maplibre.org
Apache License 2.0
2.31k stars 216 forks source link

Add web-based UI for Martin #1120

Open nyurik opened 10 months ago

nyurik commented 10 months ago

This issue outlines grand vision for Martin UI. This is subject to change, and any feedback welcome.

tomeronen commented 10 months ago

@nyurik, i think the primary focus of the ui should be on showcasing the server's catalog (your first point in Developer use cases). Integrating a Maputnik editor could be a nice functionality, but i think it might introduce unnecessary complexity to the UI. For DevOps needs i think a lot of people will have diffrent needs here, and martin might be part of a bigger existing architecture where these things are already taken care of. Maybe it could be cool to show live data of tiles for the current user session. For tile sources metrics i would add tile-size and total response time.

jjcfrancisco commented 10 months ago

Sounds like a great idea. The main martin page looks a bit bear at the moment. I would also include Maputnik.

tomeronen commented 10 months ago

@jjcfrancisco are you talking about the martin website or the page that will be received when you access the base path in a martin server?

jjcfrancisco commented 10 months ago

Apologies for the wording @tomeronen - I meant the base path in the server.

tomeronen commented 10 months ago

Its still in progress but what do you think about this direction?

Landing page

image

View TileJson (press on left layer action button)

image

Add layer to map (press on right action button)

image

with tile grid and popup position

image

Current rendered features by layer (taken from kepler.gl)

image

Things i started implementing but need to finish:

  1. Style layer: fill style, line style opacity, line width, layer type.
  2. Tiles metrics: How big are the tiles being sent, how long did they take to arrive.
nyurik commented 10 months ago

@tomeronen I absolutely love the work you are doing, thank you!

I have a few suggestions that might be helpful. Or not :)

tomeronen commented 10 months ago

@nyurik few questions:

  1. "where a user can zoom-in/out of the current view without actually "zooming" - i.e. make the current zoom bigger/smaller." do you mean bring data for a diffrent zoom then what is actually used in the map? for example the map is set on zoom 8 and fill it with data using zoom 12? if yes this should be really easy.
  2. ill add close by click outside 👍
  3. Good idea about the top tabs :) ill add it as well. maybe there could be four tabs: catalog viewer, data viewer, statistics and style editor.

Regarding the server statics in the current use case i am using we have k8s cluster with 2 instances of martin running behind a k8s service. And we gather the statics through a proxy server. So adding server metrics to the ui will show partial metrics of a single service. How uncommon do you think this use is?

nyurik commented 10 months ago
  1. if i am on zoom 10, it may show certain data. That data may be too small on the screen, yet i cannot "zoom in" because it will be replaced by the data from zoom 11. Instead, I want to keep looking at zoom 10, but make everything just bigger to make it easier to examine. update Maybe we can add a slider to represent "visual zoom" as oppose to "data zoom" which can continue be represented with a big :heavy_plus_sign: and :heavy_minus_sign: icons? Or we could make two sliders side by side?

  2. i was about to say that I just on-boarded Maputnik style editor - so it makes perfect sense to include that as well :) - see https://github.com/maplibre/martin/issues/852

  3. server statistics is a tricky one - you are right that most, even small, places would use some load balanced redundancy like k8s. That said, k8s only provides overall service-level statistics like the number of requests and pod memory usage. Any kind of debugging or in-depth info would not be as easily available - e.g. seeing the number of requests PER source or PER zoom would require considerable additional work with datadog or elasticsearch or .... Moreover, k8s stats would not have any other breakdowns, like cache use. On top of it, one thing that none of the logging platforms offer (AFAIK) is to see the map hotspots - visualize which tiles get requested the most. For that, we may need to implement additional per source per tile tracking feature (not trivial, but doable)

tomeronen commented 10 months ago

Hey @nyurik i am a bit stuck, and will be happy for some help. Based on https://github.com/maplibre/martin/issues/852, Im trying to use actix_web_static_files to build and serve the client code. I think once there is the base to build and serve static files, we can start building the ui in small PR's each time. Im new to rust and trying to learn as i go. Could you help me with setting the base to building the client code and serving it?

Youssef-Harby commented 10 months ago

Hello @tomeronen , interesting work! I can offer assistance with this project as I am currently learning Rust and have some experience with Actix as well as developing build pipelines.

I am a bit confused about what you are trying to achieve with issue #852 , Are you aiming to serve a pre-built embedded Maputnik in Martin, or are you looking to build a new React UI and then create a URL endpoint, for example, /explore, for serving the new UI you are developing in React?

tomeronen commented 10 months ago

@Youssef-Harby what i had in mind is creating a new project, taking the Maputnik code and try to integrate it as part of the total ui. As talked above, we can have three tabs. One for style edit (Maputnik), one for showcasing the data, and one for service metrics.

nyurik commented 10 months ago

@tomeronen and @Youssef-Harby thanks so much for working on this! I pushed some changed to the @tomeronen 's repo, and also merged in the main branch to keep the code up to date. Also, I addapted a few changed by @Youssef-Harby such as removing the tsc compiler call - i think it might be a bug -- i saw some errors in the console.

In any case - it seems to be working now -- you can use just run (assuming you have just installed), and it will compile and run Martin, and also include the compiled js code (it will execute npm run build during Martin build).

So current issues:

nyurik commented 8 months ago

FYI, Maputnik has been moved to maplibre, and so is the maplibre-gl-inspect, with lots of work being done on them.