react-map-gl
react-map-gl copied to clipboard
Control several types of markers
I think your documentations is not good for beginners with mapbox. Can you provide example for this simple case.
I have several array of different markers which I get from rest api call.
schools = [{lat:0, long: 1, name: '1234},{lat:0, long: 1, name: '1234},{lat:0, long: 1, name: '1234}]
parks = [{lat:0, long: 1, name: '1234},{lat:0, long: 1, name: '1234},{lat:0, long: 1, name: '1234}]
burgers = [{lat:0, long: 1, name: '1234},{lat:0, long: 1, name: '1234},{lat:0, long: 1, name: '1234}]
And I want to display this markers on the map with different icons, and ability to turn on/off them by their type.
I figured out that I need to convert my data to Geojson
data format and load it into Source
and then use this source
in layer. So Source is like 'collection' and Layer is like 'Item'.