1

This is my geojson:

enter code here
  "features": [
    {
      "geometry": {
        "coordinates": [
          [
            [
              74.276821428571402,
              20.089249999999982
            ],
            [
              74.267821428571402,
              20.089249999999982
            ],
            [
              74.267821428571402,
              20.098249999999982
            ],
            [
              74.276821428571402,
              20.098249999999982
            ],
            [
              74.276821428571402,
              20.089249999999982
            ]
          ]
        ],
        "type": "Polygon"
      },
      "type": "Feature",
      "properties": {
        "description": "This is crop value",
        "color":"rgba(0,0,255,0.3)",
        "pixel": {
          "latitude": 20.093749999999982,
          "vci": 2,
          "ndvi":4,
          "longitude": 74.272321428571402
        }
      }
    },

I can change the color on server side m using geojson-vt.

I'm trying to do this but color is fixed:

    tileIndex = geojsonvt(data, tileOptions);

here data is geojson data

     if(valueSelector=='vci')
               {

            ctx.fillStyle = feature.tags.color ? feature.tags.color : 'rgba(255,255,0,0.05)';
                      ctx.beginPath();
               }
  • 2
    This is confusing. Are you using Leaflet? Are you using Mapbox GL-js? How are you adding the GeoJSON to the map and defining the initial style? – IvanSanchez Nov 28 '16 at 9:22