I am using MAP-BOX to draw map on the screen. I want to create some effect on mouse-hover.
I created line using geojson
source and react-map-gl
as a wrapper.
I want to set some opacity to the line on mouse hover.
export const layer = {
'id': 'route',
'type': 'line',
'source': 'route',
'layout': {
'line-join': 'round',
'line-cap': 'round'
},
'paint': {
'line-color': '#E95617',
'line-width': 2,
'line-dasharray':[1,2,3]
}
}
export const route1={
type: "Feature",
properties: {
id="route1"
},
geometry: {
type: "LineString",
coordinates: [
[76.994168,31.780632],
[76.993894,31.781929],
[76.997771,31.783204 ],
//------ more data
]
}
}
import ReactMapGL,{Source, Layer} from "react-map-gl";
const Routes=()=>{
return <ReactMapGL {...props}>
<Source type="geojson" data={tempdata.route1}>
<Layer {...tempdata.layer}/>
</Source>
<Source type="geojson" data={tempdata.route2}>
<Layer {...tempdata.layer1}/>
</Source>
</ReactMapGL>
}
When i opened browser console and looked for id route and route
then it reports me null. I did not saw any example or documentation to add class-name into geojson source.
How can i create hover effect?