...
Code Block | ||
---|---|---|
| ||
layers: [ { mapKey: 'afghanistanafrica-provincess4da', layer: 1, filterField: 'ADM0_NAME' }, { mapKey: 'afghanistanafrica-s4da-districtsdrilldown', filterField: 'NAME_1', layer: 2, parentMapFilterField: 'ADM0_NAME' } ], |
Here, we add an Array of layers to the config. Each layer has a “mapKey” which is the code of the topoMap uploaded and a layer number called “layer“ that defines the position in the layer hierarchy. The lower layer (the one drilled down to) has an additional property “parentLayerIdentifier“.
...
Example:
If we have a map of all provinces s4da countries of Afghanistan Africa and we click on the province Hirat country Ethiopia to load a map of all districts provinces of HiratEthiopia. Now this identifier tells us to only fetch the districts provinces that have the value “Hirat“ “Ethiopia“ in the field given to “parentLayerIdentifier“. If you are unsure what field to put into “parentLayerIdentifier“ then look what is defined as “filterField“ under “filter” in your chart config. The values in those two fields should match. So if you have selected a field for the filter that matches a name then you should configure an equivalent field as “parentLayerIdentifier“. Often the fields are named exactly the same in both maps but if you have the maps from different sources their names might differ.
Code Block | ||
---|---|---|
| ||
{
legend: true,
mapCode: 'africa-s4da',
geometriesKey: 'S4DA_topo_chart',
areaIdentifierPropertyKey: 'ISO3',
areaDisplayNameKey: 'ADM0_NAME',
dataToAreaDataKey: 'value',
featureCollectionPath: 'geo',
borderColor: '#888',
borderWidth: 1,
showMapLayer: true,
featureNamePath: 'ADM0_NAME',
featureIdentifierPath: 'ISO3',
logScalingColors: false,
tooltipTemplate: 'return (dataItem ? dataItem.result : 0) + \' measures\'',
filter: {
filterCode: 'country',
filterField: 'ADM0_NAME'
},
fillColors: [
{
color: 'none',
start: 0
},
{
color: '#E7F4B9',
start: 3
},
{
color: '#B5E48C',
start: 10
},
{
color: '#52B69A',
start: 20
},
{
color: '#168AAD',
start: 30
}
],
layers: [
{
mapKey: 'africa-s4da',
layer: 1,
filterField: 'ADM0_NAME'
},
{
mapKey: 'africa-s4da-drilldown',
filterField: 'NAME_1',
layer: 2,
parentMapFilterField: 'ADM0_NAME'
}
]
} |
Aggregation config
Example aggregation (as found on S4DA CapDev measures) config for data collection named “consultants“. We want all consultants in a Province or district on a topo map:
...