Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getIntersect() {
- var drawnLine = draw.getAll();
- var layerFeatures = turf.featureCollection(SELECTED_LAYER_JSON.features);
- var intersectingFeatures = turf.lineIntersect(drawnLine, layerFeatures);
- interArray = [];
- for (var i = 0; i < intersectingFeatures.features.length; i++) {
- interArray.push(intersectingFeatures.features[i].geometry.coordinates)
- }
- mapB.on('render', interHeights);
- mapB.resize();
- }
- function interHeights() {
- mapB.off('render', interHeights)
- var selectFeatures = [];
- interArray.forEach(coords => {
- pixelCoords = mapB.project(coords);
- var bbox = [[pixelCoords.x - 10, pixelCoords.y - 10], [pixelCoords.x + 10, pixelCoords.y + 10]];
- selectFeatures.push(mapB.queryRenderedFeatures(pixelCoords, {layers: [SELECTED_LAYER_ID]}));
- });
- }
Add Comment
Please, Sign In to add comment