This project is read-only.

Enlisting labels as "virtual attributes"

Jul 25, 2013 at 5:31 AM
I raised this idea a couple of years ago, but can't find a copy of the message. So here's the idea anew. (Please forgive my idiosyncratic use of terms. I'm not a database programmer and I'm unsteady with the lingo.)

Currently, MapWindow colorizes a shape according to an attribute in a database column. This means that if the same shape is used for different attributes, there must be a column in the database file for each of those attributes. This makes sense, and is standard practice.

However, MapWindow also offers the option of assigning labels which are not themselves in the database file. These labels can be text strings, or they can be values computed mathematically from various columns in the database.

It occurs to me that MapWindow can economize on database space and maintenance if a label could be employed as a "virtual attribute," such that a shape would receive its color based on the label instead of on an actual attribute.

Here's an example, based on my own application (MapElection.org). This application offers maps of Chicago, each of which shows one statistic from each of Chicago's 2500 voting precincts in the 2011 mayoral election.

Let's assume the following:

E = Votes received by Rahm Emanuel
C = Votes received by Gary Chico

This requires a database that has two data columns, one for Emanuel and the other for Chico.
This allows me to create just two basic maps.

Now suppose I want to create additional maps, each showing one of the following statistics for each precinct:

E+C = Total votes cast
E/(E+C) = Proportion of votes received by Emanuel
C/(E+C) = Proportion of votes received by Chico
E-C = Lead of Emanual over Chicago
C-E = Lead of Chicago over Emanuel

In the current version of MapWindow, I would have to create five more columns in the database.

However, if labels could be used as "virtual attributes," I wouldn't have to create any new columns. I could simply create a new layer and tell MapWindows to base the color of each shape not on a database column, but instead on the result of a label computation. The label computation, of course, would be one of the above formulas.

With such an option, I could do the following without adding columns to the database, or otherwise altering the database in any way:
  • If I discover a formula was incorrect, I could simply edit the formula in the layer definition.
  • I could almost effortlessly add an abundance of complex new layers to a project.
To minimize the programming impact of introducing an option like this into MapWindow, a "virtual attribute" could simply be created as an additional coloring option available for any normal layer.

Thanks for considering this idea!

Regards,

Roy