I'm trying to my geojson feature 'type_id' to add my json data to different layers.
OnEachPlant = (latlngTemp) ->
switch ''.feature.properties.type_id
when '2'
myIcon = L.divIcon(
className: 'sIcon'
html: 'S' )
shrubMarkers.addLayer L.marker(latlngTemp, {icon: myIcon})
when '3'
myIcon = L.divIcon(
className: 'tIcon'
html: 'T' )
treeMarkers.addLayer L.marker(latlngTemp, {icon: myIcon})
$.ajax dataType: 'text' url: 'map.json' success: (data) -> L.geoJSON(JSON.parse(data), pointToLayer: (feature, latlng) -> OnEachPlant(latlng))