This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
howtos:toolcoding:using_maps [2011/06/16 18:40] chris.strashok |
howtos:toolcoding:using_maps [2011/06/17 16:03] (current) chris.strashok |
||
---|---|---|---|
Line 243: | Line 243: | ||
The mapcat tool can also be used for aggregating elements into classes or groups. The example below uses the data found in the following table to use the categorization as a map to transform the population data for each province to a region class while aggregating over each province to get the total population in each region. | The mapcat tool can also be used for aggregating elements into classes or groups. The example below uses the data found in the following table to use the categorization as a map to transform the population data for each province to a region class while aggregating over each province to get the total population in each region. | ||
- | {{:howtos:toolcoding:mapdata5.gif|}} | + | {{:howtos:toolcoding:mapdata5_rev1.gif|}} |
The supporting tool script code for building the informants and importing data above can be found [[howtos:toolcoding:mapEx5|here]]. | The supporting tool script code for building the informants and importing data above can be found [[howtos:toolcoding:mapEx5|here]]. | ||
Line 251: | Line 251: | ||
<code> | <code> | ||
- | localinformant provLoc[p->l] = create (; object=category, groups=province, members=location, \ | + | localinformant locProv[l->p] = create (; object=category, groups=location, members=province, \ |
- | "Alberta"="west", \ | + | "west"="Alberta", \ |
- | "British Columbia"="west",\ | + | "west"="British Columbia",\ |
- | "Newfoundland"="east",\ | + | "east"="Newfoundland",\ |
- | "Nova Scotia"="east",\ | + | "east"="Nova Scotia",\ |
- | "Ontario"="central",\ | + | "central"="Ontario",\ |
- | "PEI"="east") | + | "east"="PEI") |
</code> | </code> | ||
Line 265: | Line 265: | ||
<code> | <code> | ||
- | local provLoc_Cat[p->l] = mapcat (provinceData[p]; category=provLoc) | + | local provLoc_Cat[l->p] = mapcat (provinceData[p]; category=locProv) |
- | table (provLoc_Cat[p->l]) | + | table (provLoc_Cat[l->p]) |
</code> | </code> | ||
Line 279: | Line 279: | ||
<code> | <code> | ||
- | local regions[p,l] = mapcat (provLoc_Cat[p->l]) | + | local regions[l,p] = mapcat (provLoc_Cat[l->p]) |
- | table (regions[p,l]) | + | table (regions[l,p]) |
</code> | </code> | ||
Line 293: | Line 293: | ||
<code> | <code> | ||
- | local regions_sum[l] = sum (regions[p,l]; \ | + | local regions_sum[l] = sum (regions[l,p]; \ |
dim=province) | dim=province) | ||