Skip to content
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

Improve MapLibre demo to show all available lines/points/polygons from all sources #536

Closed
nyurik opened this issue Dec 22, 2022 · 10 comments · Fixed by #660 or #820
Closed

Improve MapLibre demo to show all available lines/points/polygons from all sources #536

nyurik opened this issue Dec 22, 2022 · 10 comments · Fixed by #660 or #820

Comments

@nyurik
Copy link
Member

nyurik commented Dec 22, 2022

Current martin demo page shows a list of all available sources (by first calling the /catalog API), and allows the users to turn on/off each source individually. There are some limitations that need to be addressed:

  • it relies on the tilejson to tell it which type of information is in the data. Instead, it should allow all types (points / lines / ...), and visualize them all
  • it shows everything in the same color - each layer should get its own color, e.g. randomly when the layer is enabled, and possibly with a color picker for extra bonus.
  • it requires to know the name of each layer in the MVT. Instead, it should use the "inspection" mode, where all layers are shown regardless of their name
    • it could use multiple colors if the MVT has more than one layer
  • make the left sidebar resizable
  • make the list of the sources substring-filterable with an input box at the top
  • ...?

Requirements

  • keep it to a single javascript file
  • keep it as simple as possible

Instructions for those who may want to help with this

  • install rust
  • install docker and docker-compose
  • run rust install just
  • run just run
  • open tests/debug.html file in your browser by copy/pasting the full path to it
@Binabh
Copy link
Contributor

Binabh commented May 10, 2023

@nyurik I would like to work on this. I am confused in two things.

  1. How can we determine the geometry type in order to provide appropriate type in layer?
  2. What is inspection mode?

@nyurik
Copy link
Member Author

nyurik commented May 10, 2023

The "inspector" mode is the answer to the first question too - something similar to mapbox-gl-inspect but for MapLibre (the same thing should exist in Maputnik I would think, or at least it should be ported if not). This way you don't really care what type of geometry each layer has - you just draw them all.

@Binabh
Copy link
Contributor

Binabh commented May 10, 2023

Thank you @nyurik I shall look into mapbox-gl-inspect. Also I have opened a draft PR for other features. Please provide your feedback if any.

nyurik pushed a commit that referenced this issue May 18, 2023
- [ ] show lines and polygons
- [ ] show all layers regardless of their name
- [x] different color for each layer
- [x] make left sidebar resizable
- [x] add search box

- closes #536
@tordans
Copy link

tordans commented May 18, 2023

Thanks for working on this! Is there a Martin instance that we can use to link from the Readme to preview the feature?

@nyurik
Copy link
Member Author

nyurik commented Jul 8, 2023

Seems this was closed by accident - debug.html still doesn't show polygons, and we need to figure out the "x-ray" mode so that it shows all content without knowing what that content is beforehand

@nyurik nyurik reopened this Jul 8, 2023
@lodi-g
Copy link

lodi-g commented Jul 15, 2023

Hi,

I'm researching a bit this issue. From my understanding what is missing is the following the source introspection to select the right layer (right now the source and the source-layer have to have the same name).

Some suggestions though:

  • It would be useful to have a popup with attributes upon clicking on a point
  • It would be useful to be able to open this page with the "base" martin (without cargo/just), e.g. martin debug-page ...
  • It would be useful to group sources that does not come from the user itself, see screenshot where my source is "Macedonia" and the rest is something I have no idea about
image

What do you think?

@tordans
Copy link

tordans commented Aug 4, 2023

FYI this might be something that can be reused or be used as an inspiration https://twitter.com/j_igarashi/status/1663405008359129088

@sharkAndshark
Copy link
Collaborator

sharkAndshark commented Aug 14, 2023

For display all layers in Martin withou knowing the geometry type before, Could this benefit from Future-proof source catalog .Like add the geometry type in metadata?
What's the correct way to implement this?

@nyurik
Copy link
Member Author

nyurik commented Aug 14, 2023

My understanding is that maplibre inspection mode should allow showing all data without having any Metadata. Same as what Maputnik does

@sharkAndshark
Copy link
Collaborator

sharkAndshark commented Aug 14, 2023

Hi @nyurik Have a lovely day. :D
Some thoughts on this. The idea is displaing each layer in source as circle, linestring and polygon with filter like ['==', '$type', 'LineString'] at same time

foreach(var source in sources){
// add circle layer 
        map.addLayer({
          id: source.id + "_circle",
          ...
          filter: ['==', '$type', 'Point'],
          paint: {
            "circle-color": stringToColour(source.id),
            "circle-radius": 2
          }
        });

// add linestring layer
        map.addLayer({
          id: source.id + "_line",
          type: "line",
          ....
          filter: ['==', '$type', 'LineString'],
          paint: {
            'line-color': stringToColour(source.id),
          }
        });
// add polygon layer
...
}

image

nyurik added a commit that referenced this issue Sep 3, 2023
Try to resolve #536, but still it can't show the function source without
comment...
- [x] Show all layers with correct geometry type
- [x] Inspect feature property
- [x] Allow to scroll popup content with max-height and a vertical
scroll bar
- [x] Allow to stop the popup showing after click outside
- [x] It's possible to select text when the popup it's fixed

Maybe we should have an inspect toggle?

---------

Co-authored-by: Yuri Astrakhan <YuriAstrakhan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants