In wrestling with the issue of how to do tags in the glyph_factory, I asked myself, "What does the program know while it's processing a given row?" I figured what it doesn't know it can't use.
a sketch of what glyph_factory knows at a given row
In general, it knows what it read in from the files:
The first three are the important ones. From them we can identify and name the fields available to go into a tag (where 1 in the examples can be any digit):
I've made some simplifying assumptions here:
Given the above constraints, you can use the tags_template.txt file to tell glyph_factory how to format the tag for each sub-glyph (geometry) created. Each row results in a glyph made of sub-glyphs with the provided tags, with real data "plugged in" for the placeholders such as __C1__, etc.
tags_template.txt this is glyph row 1 - Header 1 is: __H1__ this is glyph row 2 - Header 2 is: __H2__ this is glyph row 3 - Hi mom! this is glyph row 4 - Colname1 is __C1__ this is glyph row 5 - Colname2 is __C2__ this is glyph row 5 - Header 1 is: __H1__ and is still __H1__ this is glyph row 6 - Rowname 1 is: __R1__ this is glyph row 7 - Rowname 2 is: __R2__ this is glyph row 8 - Data3 is: __D3__ |
as well as this data file:
cities_data.csv Lat,Lon,Pop,Size,Year,Millionaires,R_groups,Name,Nickname 40.7127,-74.0059,8405837,468.5,1898,389000,2,New_York_City,Big_Apple 48.8567,2.3508,10413386,1098.4,-250,219000,2,Paris,City_of_Light 51.507222,-0.1275,8308369,606.95,43,281000,1,London,London_Town 48.133333,11.566667,1388308,119.86,1158,130000,1,Munich,Munchen -90,-180,1388308,119.86,1158,130000,1,SW,SouthWest 90,180,1388308,119.86,1158,130000,1,NE,NorthEast |
glyph_factory makes the tags in this picture:
Last update: Wed, Jun 11, 2014 3:18:50 PM