• Hello,

    I tried to change the markers colors on the map.
    In my case, the marker informations are on the geojson file.
    With this line on my wordpress page.

    [leaflet-geojson
    src=https://mywebsite/data/map/myfile.?geojson]{markertitle}[/leaflet-geojson]

    The display works, but all the marker are “by default”, same shape, same color.

    In this example, I have different colors on my geojson file.

    
    {
      "type": "FeatureCollection",
      "features": [
        {
          "type": "Feature",
          "properties": {
            "marker-color": "#0056d6",
            "marker-size": "medium",
            "marker-symbol": "",
            "IdentifiantDepot": 55,
            "TypeDepot": "Chute_Egout"
          },
          "geometry": {
            "type": "Point",
            "coordinates": [
              -73.598836,
              45.467577
            ]
          }
        },
        {
          "type": "Feature",
          "properties": {
            "marker-color": "#0056d6",
            "marker-size": "medium",
            "marker-symbol": "",
            "IdentifiantDepot": 35,
            "TypeDepot": "Chute_Egout"
          },
          "geometry": {
            "type": "Point",
            "coordinates": [
              -73.531399,
              45.549463
            ]
          }
        },
        {
          "type": "Feature",
          "properties": {
            "IdentifiantDepot": 49,
            "TypeDepot": "Entassement"
          },
          "geometry": {
            "type": "Point",
            "coordinates": [
              -73.721363,
              45.49518
            ]
          }
        },
        {
          "type": "Feature",
          "properties": {
            "marker-color": "#669d34",
            "marker-size": "medium",
            "marker-symbol": "",
            "IdentifiantDepot": 45,
            "TypeDepot": "Entassement"
          },
          "geometry": {
            "type": "Point",
            "coordinates": [
              -73.52711,
              45.660361
            ]
          }
        },
        {
          "type": "Feature",
          "properties": {
            "marker-color": "#d58400",
            "marker-size": "medium",
            "marker-symbol": "",
            "IdentifiantDepot": 31,
            "TypeDepot": "Carierre"
          },
          "geometry": {
            "type": "Point",
            "coordinates": [
              -73.612205,
              45.573425
            ]
          }
        },
        {
          "type": "Feature",
          "properties": {
            "marker-color": "#669d34",
            "marker-size": "medium",
            "marker-symbol": "",
            "IdentifiantDepot": 46,
            "TypeDepot": "Entassement"
          },
          "geometry": {
            "type": "Point",
            "coordinates": [
              -73.57899,
              45.622152
            ]
          }
        },
        {
          "type": "Feature",
          "properties": {
            "IdentifiantDepot": 54,
            "TypeDepot": "Entassement"
          },
          "geometry": {
            "type": "Point",
            "coordinates": [
              -73.710405,
              45.449769
            ]
          }
        }
      ]
    }
    

    How I can use the colors from the file ?

    Have a nice day

  • The topic ‘Marker Color on geojson file’ is closed to new replies.