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

adds search; adds resize; adds dynamic layer color; #660

Merged
merged 3 commits into from
May 18, 2023

Conversation

Binabh
Copy link
Contributor

@Binabh Binabh commented May 10, 2023

@nyurik
Copy link
Member

nyurik commented May 10, 2023

This is awesome!!! Thank you! I especially like the search capability.

So some feedback:

  • the biggest (and most unknown) aspect is that we need to use the inspection approach. No comments on this just yet
  • would be nice (but totally minor, do only if easy) to be able to resize the left panel along any location along the right edge, not just the small bottom right resize handle.
  • would be nice to show a colored box next to each layer to indicate the color it is drawn with. Don't show that box if the layer is not active. Bonus points if that box can be clicked to specify a different color (this may be useful in cases when auto-generated color is too pale/invisible on the screen). An alternative to specifying a color is to randomly generate a new color on each layer-enable. This way if i don't like the color, i simply turn it off and on again.
  • A much more "long term" planning (just to think - definitly not part of this PR) -- would be awesome to integrate the entire Maputnik as the UI of Martin, and possibly allow the style to be stored in the local store, etc, etc, etc...

In short, thank you for working on this!!!

@Binabh
Copy link
Contributor Author

Binabh commented May 12, 2023

@nyurik I am still stuck on this part. This is what I have researched upto now:
To display all types of geometries(points/line/polygon) we need to give proper type here Now to detect proper geometry type.
As per your suggestion I looked into mapbox-gl-inspect the way they detect type I think here. However this works when we want to detect geometry type of rendered features unlike in our case where we need to know geometry type for rendering.
We also have querySourceFeatures but this is also returning empty array for un-rendered features and even here also I cannot seem to find geometry type in data.

Now I want to ask

  1. Am I even looking at right places?
  2. Is it even possible to detect geometry types on client side from vector tiles?
  3. Can you point me to any such examples/references?

If there is no way to detect geometry type of vector tiles in client side then I have thought or few workarounds

  1. include geometry type in /catalog or /<source-id> api. For this for postgis we could use spatial function GeometryType.
  2. define geometry type for each source like
{
"MixPoints": "POINTS",
"points1": "POINTS"
}

This approach obviously defies purpose of getting all layers and plotting them automatically. This is the most easy approach.

This is all I have found till now. Your guidance here will be very much helpful.
Thank You!

@nyurik
Copy link
Member

nyurik commented May 12, 2023

@Binabh thanks for all the hard work on this! Try this:

  • open https://maputnik.github.io/editor/#4.2/41.91/-91.38
  • in the top menu, change view to Inspect
  • in the top menu, click Open, and select Empty Style (last)
  • in the top menu, click Data Sources, and click OpenMapTiles v3 in the Choose Public Source - and close that popup

You are now seeing the Maputnik inspector mode -- all geometries. If you look at the tilejson, you will see that it does have the "geometry" field that lists all available geometry types - but I do NOT know if this is a requirement or not for the inspector mode.

The issue with the server-side geometry generation is that I am not certain if we can compute the type without a full table scan -- something I would obviously want to avoid, esp on startup.

@Binabh
Copy link
Contributor Author

Binabh commented May 18, 2023

@nyurik I think I cannot do this in client side with data we are currently getting. About Inspect mode I think it displays layer type like the one given here. In our case its always circle by this function as the value of geometry type is always undefined.
So,
By my current understanding,I am unable to show all types of layers by accurately determining their types.
Now, I can do any of following options:
1.Look into options to determine and send layer geometry type from server side
2.Merge this PR in its current state(since things like choosing colors, search box and resizing are implemented) and move task of showing different geometry types to new issue
3.Close this PR and let someone else handle this issue as a whole

I am also open to any other suggestions.
Please let me know which way can we head? If 2 or 3 then I will change status of PR to ready for merge or closed accordingly. If 1 I will start looking at code base and ways to do it.

Thank you!

@nyurik nyurik marked this pull request as ready for review May 18, 2023 03:13
Copy link
Member

@nyurik nyurik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks awesome! Let's merge as is for now. Once we figure out how to visualize everything, we may even make something like this a starting page

@nyurik nyurik merged commit fd88852 into maplibre:main May 18, 2023
@nyurik
Copy link
Member

nyurik commented May 18, 2023

P.s. I'll have to look into auto detection a bit more myself. Problem is, we may not always have a way to detect what type of geometry each layer has, eg if it comes from mbtiles or pmtiles source

@Binabh
Copy link
Contributor Author

Binabh commented May 18, 2023

Thank you @nyurik . I will also continue my research on this. Trying to solve this issue I learned a lot about vectortiles, maplibre and martin. I will try to be involved as much as possible.
Thanks to you and team for this awesome project.

@tomeronen
Copy link
Contributor

Hello @nyurik and @Binabh i am thinking about trying to create a wrapper around maputnik to server the martin catalog. Do you know if there is already wip for this, or is somebody working on it now?

@nyurik
Copy link
Member

nyurik commented Dec 26, 2023

@tomeronen the closest is the https://github.com/maplibre/martin/blob/main/tests/debug.html - which I would love to abandon and have a proper Martin UI instead. Feel free to create a new issue and/or just hack on a new PR. Noone's working on it AFAIK.

@tomeronen
Copy link
Contributor

@nyurik i did some work on this and created a basic version that is more like maputnik and a basic version that is more like kepler.gl. Kepler is data focused compared, to maputnik which is more focused on creating a mapbox style. Currently thinking on going the kepler.gl route. I can start with a fork with a basic version and add more functionality along the way

@tomeronen
Copy link
Contributor

tomeronen commented Jan 7, 2024

Created a basic poc (still wip) for a possible UI.
#1119
Will continue to work on it, adding functionality and cleanups.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve MapLibre demo to show all available lines/points/polygons from all sources
3 participants