react-map-gl icon indicating copy to clipboard operation
react-map-gl copied to clipboard

Control several types of markers

Open rendomnet opened this issue 4 years ago • 1 comments

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.

rendomnet avatar Nov 27 '19 06:11 rendomnet

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'.

rendomnet avatar Nov 27 '19 10:11 rendomnet