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

Design proposal: Layer type square (and maybe other shapes) #116

Open
BezBIS opened this issue Aug 2, 2022 · 5 comments
Open

Design proposal: Layer type square (and maybe other shapes) #116

BezBIS opened this issue Aug 2, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@BezBIS
Copy link

BezBIS commented Aug 2, 2022

Motivation

I'm new to maplibre so could well be missing something, but can't see this as an option in the documentation.

I'm trying to render a map where we have records with different levels of precision. The existing soluton shows high precision records as a circle and lower precision records as a larger sqaure. It would be really nice to be able to specify a square or rectangle as the layer type in the same way as you can currently use circle.

I have no idea what the technical implementation of this would look like, but hope it would not bee too complicatd as it's still a simple plolygon.

Design Alternatives

Do nothing.

Implementation

Something like this:

map.addLayer({
            id: 'points',
            type: 'rectangle',
            source: 'points',
            paint: {
                'rectangle-color': #e00,
                'rectangle-width': 12,
                'rectangle-height': 12,
                'rectangle-stroke-width': 1,
                'rectangle-stroke-color': '#000'
            }
        });
@HarelM
Copy link
Member

HarelM commented Aug 2, 2022

You can use sdf icons in theory, but if we add something like that I would recommend a rectangle with rounded corners to facilitate a lot more shapes...

@BezBIS
Copy link
Author

BezBIS commented Aug 2, 2022

You can use sdf icons in theory, but if we add something like that I would recommend a rectangle with rounded corners to facilitate a lot more shapes...

A rounded rectnagle would be really useful. I'm not sure how many other people would benefit from something like this though, it could well be rather niche.

@HarelM
Copy link
Member

HarelM commented Aug 2, 2022

You also might be able to pull this off by using a custom layer...?

@HarelM HarelM added the enhancement New feature or request label Aug 21, 2022
@wadclapp
Copy link

I'm also looking for this feature, also don't know how complicated it would be to implement.

Desirably I'd like to be able to use an n-sided polygon as the background of a marker instead of a circle (triangle/square/pentagon), and possibly more, such as a star-shape. I have a lot of bg-colour/icon combos, which are also dynamic, so it isn't practical to add them all in the image sprite.

I achieved this originally as HTML markers, but I have too many markers now where it's no longer a performant way to achieve it.

@HarelM HarelM transferred this issue from maplibre/maplibre-gl-js Apr 12, 2023
@HarelM HarelM changed the title Layer type square? Design proposal: Layer type square (and maybe other shapes) Apr 12, 2023
@HarelM
Copy link
Member

HarelM commented Apr 12, 2023

I've moved this to the style-spec repo for further discussion.

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

No branches or pull requests

3 participants