GeoJSON Styles - PIN-Cambodia/DMIS GitHub Wiki

Style Definition

Every style can have one or more rules. Each rule has a style attached with an optional filter.

Filter options

Comparison types supported are 'BETWEEN', 'EQUALS' and 'GREATER_THAN'.

Style options

Styles can have a geomType of 'POLYGON', 'POINT' and 'LINE'. The actual styles are defined with a fill (colour), stroke (colour and width) and text (which includes fill, stroke and font).

DMIS Styles

DAILY_PEOPLE_AFFECTED

UPDATE dmis_layers
SET layer_style = '{
  "rules": [
    {
      "filter": {
        "propertyName": "AFFPEO",
        "comparisonType": "BETWEEN",
        "min": 0,
		"max": 500
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(254,240,217,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "< 500"
      }
    },
	{
      "filter": {
        "propertyName": "AFFPEO",
        "comparisonType": "BETWEEN",
        "min": 500,
		"max": 1000
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(253,204,138,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "500 - 1000"
      }
    },
	{
      "filter": {
        "propertyName": "AFFPEO",
        "comparisonType": "BETWEEN",
        "min": 1000,
		"max": 1500
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(252,141,89,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "1000 - 1500"
      }
    },
	{
      "filter": {
        "propertyName": "AFFPEO",
        "comparisonType": "BETWEEN",
        "min": 1500,
		"max": 2001
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(227,74,51,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "1500 - 2000"
      }
    },
	{
      "filter": {
        "propertyName": "AFFPEO",
        "comparisonType": "GREATER_THAN",
        "min": 2000
      },
	  "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(179,0,0,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "> 2000"
      }
    }
  ]
}
'
WHERE layer_name = 'wfp_daily_people_affected'`

DAILY_DISPLACED

UPDATE dmis_layers
SET layer_style = '{
  "rules": [
    {
      "filter": {
        "propertyName": "EVAPEO",
        "comparisonType": "BETWEEN",
        "min": 0,
		"max": 100
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(254,240,217,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "< 100"
      }
    },
	{
      "filter": {
        "propertyName": "AFFPEO",
        "comparisonType": "BETWEEN",
        "min": 100,
		"max": 200
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(253,204,138,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "100 - 200"
      }
    },
	{
      "filter": {
        "propertyName": "AFFPEO",
        "comparisonType": "BETWEEN",
        "min": 200,
		"max": 300
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(252,141,89,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "200 - 300"
      }
    },
	{
      "filter": {
        "propertyName": "AFFPEO",
        "comparisonType": "BETWEEN",
        "min": 300,
		"max": 401
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(227,74,51,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "300 - 400"
      }
    },
	{
      "filter": {
        "propertyName": "AFFPEO",
        "comparisonType": "GREATER_THAN",
        "min": 400
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(179,0,0,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "> 400"
      }
    }
  ]
}'
WHERE layer_name = 'wfp_daily_displaced'

DAILY_DEATHS

UPDATE dmis_layers
SET layer_style = '{
  "rules": [
    {
      "filter": {
        "propertyName": "DEATH_AL",
        "comparisonType": "EQUALS",
        "value": 0
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(128,128,128,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "None affected/damaged"
      }
    },
	{
      "filter": {
        "propertyName": "DEATH_AL",
        "comparisonType": "EQUALS",
        "value": 2
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(227,74,51,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "Death reported"
      }
    }
  ]
}'
WHERE layer_name = 'wfp_daily_deaths'

DAILY_PUMPWELLS

UPDATE dmis_layers
SET layer_style = '{
  "rules": [
    {
      "filter": {
        "propertyName": "AFFPWEL_AL",
        "comparisonType": "EQUALS",
        "value": 0
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(128,128,128,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "None affected/damaged"
      }
    },
	{
      "filter": {
        "propertyName": "AFFPWEL_AL",
        "comparisonType": "EQUALS",
        "value": 2
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(227,74,51,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "Pump wells affected"
      }
    }
  ]
}'
WHERE layer_name = 'wfp_daily_pumpwells'

DAILY_HEALTH_CENTER

UPDATE dmis_layers
SET layer_style = '{
  "rules": [
    {
      "filter": {
        "propertyName": "AFFHC_AL",
        "comparisonType": "EQUALS",
        "value": 0
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(128,128,128,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "None affected/damaged"
      }
    },
	{
      "filter": {
        "propertyName": "AFFHC_AL",
        "comparisonType": "EQUALS",
        "value": 2
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(227,74,51,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "Health center affected"
      }
    }
  ]
}'
WHERE layer_name = 'wfp_daily_healthcenter'

DAILY_SCHOOL

UPDATE dmis_layers
SET layer_style = '{
  "rules": [
    {
      "filter": {
        "propertyName": "AFFSCH_AL",
        "comparisonType": "EQUALS",
        "value": 0
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(128,128,128,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "None affected/damaged"
      }
    },
	{
      "filter": {
        "propertyName": "AFFSCH_AL",
        "comparisonType": "EQUALS",
        "value": 2
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(227,74,51,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "Schools affected"
      }
    }
  ]
}'
WHERE layer_name = 'wfp_daily_school'

DAILY_ROAD

UPDATE dmis_layers
SET layer_style = '{
  "rules": [
    {
      "filter": {
        "propertyName": "AFFLR_AL",
        "comparisonType": "EQUALS",
        "value": 0
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(128,128,128,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "None affected/damaged"
      }
    },
	{
      "filter": {
        "propertyName": "AFFLR_AL",
        "comparisonType": "EQUALS",
        "value": 1
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(254,204,92,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "< 1000 meters"
      }
    },
	{
      "filter": {
        "propertyName": "AFFLR_AL",
        "comparisonType": "EQUALS",
        "value": 2
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(227,74,51,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "> 1000 meters"
      }
    }
  ]
}'
WHERE layer_name = 'wfp_daily_road'

DAILY_BRIDGE

UPDATE dmis_layers
SET layer_style = '{
  "rules": [
    {
      "filter": {
        "propertyName": "BRIDGE_AL",
        "comparisonType": "EQUALS",
        "value": 0
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(128,128,128,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "None affected/damaged"
      }
    },
	{
      "filter": {
        "propertyName": "BRIDGE_AL",
        "comparisonType": "EQUALS",
        "value": 2
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(227,74,51,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "Bridge affected"
      }
    }
  ]
}'
WHERE layer_name = 'wfp_daily_bridge'

DAILY_RICE

UPDATE dmis_layers
SET layer_style = '{
  "rules": [
    {
      "filter": {
        "propertyName": "WETAFF_AL",
        "comparisonType": "EQUALS",
        "value": 0
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(128,128,128,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "None affected/damaged"
      }
    },
	{
      "filter": {
        "propertyName": "WETAFF_AL",
        "comparisonType": "EQUALS",
        "value": 1
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(254,204,92,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "< 500 Ha"
      }
    },
	{
      "filter": {
        "propertyName": "WETAFF_AL",
        "comparisonType": "EQUALS",
        "value": 2
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(227,74,51,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "> 500 Ha"
      }
    }
  ]
}'
WHERE layer_name = 'wfp_daily_rice'

LIGHTNING

UPDATE dmis_layers
SET layer_style = '{
  "rules": [
	{
      "style": {
		"geomType": "POINT",
        "text": {
          "text": "\uf0e7",
          "font": "normal 15px FontAwesome",
          "fill": {
            "colour": "rgba(0,0,0,0.7)"
          },
          "stroke": {
            "colour": "rgba(0,0,0,1)",
            "width": 2
          }
        },
		"label": "Lightning strike"
      }
    }
  ]
}'
WHERE layer_name = 'earthnetworks_lightning_points'

AT_RISK_VILLAGE

UPDATE dmis_layers
SET layer_style = '{
  "rules": [
    {
      "filter": {
        "propertyName": "Flood",
        "comparisonType": "EQUALS",
        "value": "yes"
      },
      "style": {
		"geomType": "POINT",
        "fill": {
          "colour": "rgba(255,0,0,0.7)"
        },
        "stroke": {
          "colour": "rgba(255,0,0,1)",
          "width": 1
        },
		"image": {
			"radius": 4,
			"stroke": {
				"colour": "rgba(255,0,0,1)",
				"width": 2
			},
			"fill": {
				"colour": "rgba(255,0,0,0.7)"
			}
		},
		"label": "Projected villages"
      }
    }
  ]
}'
WHERE layer_name = 'ktm_pcdm_at_risk_village'

AT_RISK_COMMUNES

UPDATE dmis_layers
SET layer_style = '{
  "rules": [
    {
      "filter": {
        "propertyName": "SS_P_AL",
        "comparisonType": "EQUALS",
        "value": 0
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(254,204,92,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 0.3
        },
		"label": "< 80%"
      }
    },
	{
      "filter": {
        "propertyName": "SS_P_AL",
        "comparisonType": "EQUALS",
        "value": 1
      },
      "style": {
		"geomType": "POLYGON",
        "fill": {
          "colour": "rgba(227,74,51,0.7)"
        },
        "stroke": {
          "colour": "rgba(0,0,0,1)",
          "width": 1
        },
		"label": "> 80%"
      }
    }
  ]
}'
WHERE layer_name = 'ktm_pcdm_at_risk_commune'

Affected Wells

UPDATE dmis_layers
SET layer_style = '{
  "rules": [
	{
      "style": {
		"geomType": "POINT",
        "text": {
          "text": "\uf043",
          "font": "normal 15px FontAwesome",
          "fill": {
            "colour": "rgba(255,255,255,0.7)"
          },
          "stroke": {
            "colour": "rgba(8,11,150,1)",
            "width": 2
          }
        },
		"label": "Affected well"
      }
    }
  ]
}'
WHERE layer_name = 'ktm_pcdm_affected_wells'

Affected Health Centres

UPDATE dmis_layers
SET layer_style = '{
  "rules": [
	{
      "style": {
		"geomType": "POINT",
        "text": {
          "text": "\uf067",
          "font": "normal 15px FontAwesome",
          "fill": {
            "colour": "rgba(240,20,12,0.7)"
          },
          "stroke": {
            "colour": "rgba(240,20,12,1)",
            "width": 2
          }
        },
		"label": "Affected health centre"
      }
    }
  ]
}'
WHERE layer_name = 'ktm_pcdm_affected_healthcenter'

Affected Schools

UPDATE dmis_layers
SET layer_style = '{
  "rules": [
	{
      "style": {
		"geomType": "POINT",
        "text": {
          "text": "\uf19d",
          "font": "normal 15px FontAwesome",
          "fill": {
            "colour": "rgba(255,255,255,0.7)"
          },
          "stroke": {
            "colour": "rgba(0,0,0,1)",
            "width": 2
          }
        },
		"label": "Affected school"
      }
    }
  ]
}'
WHERE layer_name = 'ktm_pcdm_affected_school'

Affected Roads

UPDATE dmis_layers
SET layer_style = '{
  "rules": [
	{
      "style": {
		"geomType": "LINE",
        "fill": {
          "colour": "rgba(240,20,12,0.7)"
        },
        "stroke": {
          "colour": "rgba(240,20,12,1)",
          "width": 2
        },
		"label": "Affected road"
      }
    }
  ]
}'
WHERE layer_name = 'ktm_pcdm_affected_road'