-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
queryRenderedFeatures returns nothing for point-in-polygon queries, if polygon type is set to 'Line' #2400
Comments
The actual behavior kind of makes sense, because |
@mourner thanks for the reply. I can definitely see your point, and perhaps I will be looking closer at If we get stuck, I'll likely switch the Interested in alternative approaches, for sure. |
The recommended way to render both a stroke with configurable width and a fill is to have two layers: one mapbox/mapbox-gl-style-spec#223 tracks adding a combined layer type that can support both in a single layer. |
You can work around this by creating a second parcels style layer that has |
Beautiful, thanks folks. Will add the workaround, and track the issue. Cheers. |
@ansis it will still spend time triangulating the layer and filling triangle buffers even if the opacity is 0, right? |
@mourner yes, it will, but it shouldn't be a huge cost compared to the total cost of loading all layers |
mapbox-gl-js version: 0.16.0
Steps to Trigger Behavior
Line
in Mapbox StudioqueryRenderedFeatures
withmap.on('mousemove')
to query for the polygon underneath the cursorExpected Behavior
The function returns the polygon that intersects the cursor point - this is the behaviour that v0.15.0
featuresAt
exhibited.Actual Behavior
Background
Our app is being forced to
mapbox-gl-js
0.16.0 (see #2300 (comment)), and we're working through the breaking changes since 0.15.0.We have a large polygon vector tileset, for land parcels. For styling purposes, we set the layer to
type: Line
in MB Studio. We need this to control line thickness, whichtype: Fill
doesn't allow (it's locked to 1px).A small feature of our app is to change the mouse cursor to
pointer
when it hovers over a land parcel, to demonstrate that the feature is clickable. In 0.15.0, we did this with the following code:This worked as expected, as demonstrated in this Codepen: http://codepen.io/timiyay/pen/qZVMMo.
To upgrade to 0.16.0, we started by changing the code to:
This doesn't work, as explained in Actual Behaviour, and demonstrated in this Codepen: http://codepen.io/timiyay/pen/WwXgPQ.
However, if I use Mapbox Studio to change the layer to
type: Fill
, the code works as expected, as shown in this Codepen: http://codepen.io/timiyay/pen/wGPEEw.The text was updated successfully, but these errors were encountered: