[Xastir] Town/Subdivision Names in shapefiles (static Tigermaps)
Dale Seaburg
kg5lt at verizon.net
Wed Apr 15 00:39:02 EDT 2009
On Apr 14, 2009, at 1:55 PM, Jason KG4WSV wrote (offlist):
> On Tue, Apr 14, 2009 at 1:12 PM, Dale Seaburg <kg5lt at verizon.net>
> wrote:
>> I've been over the HowTo:DBFAWK, README.MAPS and 2008 TIGER/Line
>> Shapefiles
>> docs - perhaps not thoroughly, though. Has anyone else had
>> success with
>> getting Town/City names to appear?
>
> Nope, we're all sitting around waiting for you to get all the work
> done so we can start using the new shapefiles. (:
>
I was going to whimper a reply to Jason, about needing to be spoon-
fed, but decided to spend my time digging in and find an answer
myself. ;-) ;-)
And indeed I have. I now have town/city names on the map. A few boo-
hisses, but I'll reserve that to last.
I did look carefully at the map_shp.c file. It took a while, but I
think I understood enough of the detail with regards to labels to see
that the answer was in the dbfawk files: cousub.dbfawk and
cousub00.dbfawk. It could also be that the map_shp.c file has
nothing to do with the city/town labels. I'm not sure at this
juncture. At any rate, the fix is in the two above mentioned dbfawk
files.
I'll give some snippets of what I did and let the user play with
values to suite thamselves. Ignore any line wrap, especially with
the "BEGIN RECORD" line.
cousub.dbfawk file:
# BEGIN_RECORD {key=""; lanes=1; color=6; fill_color=11; name="";
filled=0; pattern=0; display_level=8192; label_level=32;
label_color=8; font_size=0; symbol=""; fill_style=0 }
BEGIN_RECORD {key=""; lanes=1; color=6; fill_color=11; name="";
filled=0; pattern=0; display_level=8192; label_level=8192;
label_color=2; font_size=4; symbol=""; fill_style=0 }
/^NAME=(.*)$/ {name="$1";next}
# item locations
/^MTFCC=G/ {display_level=4096; next}
# /^MTFCC=G/ {display_level=512;color=8; next}
I commented-out the original BEGIN RECORD line. I also commented-out
the rule: /^MTFCC=G/ {display_level=512;color=8; next} as it appears
to have no impact on the results of a city label, regardless of
values chosen or fields added or left out. The BEGIN RECORD is the
secret.
Look at the three fields named "label_level", "label_color" and
"font_size". I stumbled on this in desperation, because the
"obvious" changes were accomplishing nothing. I chose level 8192,
Dark Green (2) for the color and a font-size of 4. There are little
to no other attributes that appear to use Dark green, so the label
stands out. if you want the labels to appear at a lower zoom level
(you are zoomed in), but not at a high level (multiple counties
visible), then make the label_level a smaller value, like 2048, or
512. Play with the values to see what suites your taste and needs.
Similarly, I changed the cousub00.dbfawk. Both dbfawk files appear
to need to be changed.
Now for the refinements that I feel are needed.
1. The label font size needs to scale with the zoom level. It's way
too big when you see multiple counties (Texas-sized counties which
are relatively small).
2. I was surprised to find that the rule line: /^MTFCC=G/ . . . was
basically ignored. The display level did nothing. I dropped the
color without detriment. I added font_size and several other fields
to no effect.
3. The position of the label is a mystery. I think it has to do
with "quad" location, but not sure. In some cases the label isn't
*even* close to the town. This may have to do with the census data's
location values, too.
With regards to #3, I saw in map_shp.c that the city label was near
the quad label code, and seemed to be a bit related. Sorry if I don't
know the in's and out's of that code. Hard to follow when you don't
know the bigger picture how it fits together with other code along
with "where did that come from...". It made enough sense to me to
realize that changes to the code were probably not the answer to
making the labels visible in the first place. ;-)
Also, Craig, N6YXK said that he was having trouble with the secondary
road appearance not doing as he expected when zooming in/out. I did
play a bit with the edge.dbfawk and the rule: "/^MTFCC=S12/ . . ."
Changing the "display_level" value did make my secondary roads change
size/color at different zoom levels. That may help, Craig.
Enjoy!
73 - Dale. KG5LT
More information about the Xastir
mailing list