Mapbox - Custom marker icons from GeoJson properti

2020-04-15 06:03发布

问题:

I'm rendering markers from a an array of GeoJson objects. I'd like to use custom icons for the markers but am not able to determine the correct syntax. Below is a portion of the code I'm using to render the geojson:

asGeoJson: ->
  type: "Feature"
  properties:
    title: @get("list_no")
    price: @get("price")
    address: @get("address")
    url: @url()
    id: @get("id")
    icon:
      iconUrl: "/images/map_icon.png"
      iconSize: [50, 50]
      iconAnchor: [25,25]
      popupAnchor: [0, -25]
      className: "marker"

The GeoJson is rendered via something like L.mapbox.featureLayer(geoJson()). I'm not able to find a concise answer in the mapbox docs for how to specify a custom marker inside GeoJson. Is it even possible to customize the icon via setting icon properties inside GeoJson?