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

[FEATURE] Understanding default fullGeometryStyle #77

Open
mradamcox opened this issue Dec 16, 2024 · 2 comments
Open

[FEATURE] Understanding default fullGeometryStyle #77

mradamcox opened this issue Dec 16, 2024 · 2 comments
Assignees

Comments

@mradamcox
Copy link

Is your feature request related to a problem? Please describe.

It's not exactly a problem, but I am trying to modify the style that is applied to a selected item in the geocoder (I'm using MapLibreGL), and in the documentation there is no default listed for the fullGeometryStyle option: https://docs.maptiler.com/sdk-js/modules/geocoding/api/api-reference/#geocoding-options.

By default, the style has a nice "inverted" or "mask" polygon, dimming everything around the selected item, like this:

Screenshot from 2024-12-16 14-39-22

I really like this approach, but I would like a little more control over the colors, and would like to apply it elsewhere within my application as well.

I was thinking there may be something like an "inverted-fill" paint property that was applied, but I've been looking through all of the style specs and don't see that as an option, which led me to wonder, what is the default style for this layer?

Additional context

I see there are a number of other issues on MaboxGL-JS around this topic, with people looking for an inverted fill behavior, but, again, it doesn't seem like this has ever actually been implemented in the spec, so I thought I would ask here to see how you are doing it.

@zdila
Copy link
Collaborator

zdila commented Dec 17, 2024

Hi Adam,

You are right, the documentation is missing the default style and also the links point to the wrong URL. We will fix it.

You can find the default style in the source code. You can provide style for the polygon border (line) and its infill (fill) according to the style specs. For filter the control adds an additional property isMask which is true for the inverted mask polygon.

If you have more questions don't hesitate to ask.

@mradamcox
Copy link
Author

@zdila, thanks for your quick response and your links to the source code, the behavior of the control makes much more sense now! An update to the docs will be helpful.

I initially came across this when I found that US postal_code responses are actually Point or MultiPoint geometries, so the default style doesn't apply to them. I figured I would need to override the default behavior, calculate a polygon from the multipoint, and then manually style it in a way that matches the other types of geometries. Based on the mask example you linked, I'll start using turf for this.

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

No branches or pull requests

3 participants