-
-
Notifications
You must be signed in to change notification settings - Fork 779
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
Empty array queryRenderedFeatures on globe projection #5476
Comments
Can you please provide a jsbin with minimal reproduction? |
import { area } from '@turf/turf'; const Maplibre = ({ gobjects, questions, isAdminBoundaries, isRussiaBoundaries, reliefId }: TestProps) => { const Map = useMemo(() => { ;
}, [gobjects]); const handleHover = (feature: maplibregl.MapGeoJSONFeature) => {
}; const fetchObjects = async (map: Map) => {
}; useEffect(() => {
}, [gobjects]); return ( {Map} </> ); }; export default Maplibre; |
This is not helpful in the current state, please provide a jsbin instead of trying to copy the code here... |
maplibre-gl-js version: 5.0.1
browser: Google Chrome
Steps to Trigger Behavior
map.addSource('grid', {
type: 'vector',
tiles: [url],
promoteId: 'gobject_id',
maxzoom: 5,
});
map
.addLayer({
id: 'grid-layer',
type: 'fill',
source: 'grid',
'source-layer': 'martin.test_function_mvt',
paint: {
'fill-color': [
'case',
['boolean', ['feature-state', 'hover'], false],
MapColors.objectHover,
MapColors.object,
],
'fill-opacity': 0.5,
'fill-outline-color': '#000000',
},
})
map.on('mousemove', 'grid-layer', (e) => {
if (e.features && e.features.length > 0) {
const feature = e.features.sort((a, b) => area(a) - area(b))[0];
}
});
function
const handleHover = (feature: maplibregl.MapGeoJSONFeature) => {
const features = map.current
?.queryRenderedFeatures({
layers: ['grid-layer'],
})
?.filter((item) => item.state.hover === true);
// i removed the rest of logic of this function
}
Expected Behavior Array features has items in globe projection as it has in standart projection.
Actual Behavior Array features always empty for globe projection, but contains items when projection is not 'globe'. Event if I remove filter by state.hover, it is always empty on globe.
The text was updated successfully, but these errors were encountered: