[Xastir] dbfawk help with contour lines shapefile

Tom Russo russo at bogodyn.org
Thu Oct 14 10:39:07 EDT 2010


On Thu, Oct 14, 2010 at 03:46:59AM -0400, we recorded a bogon-computron collision of the <kevin at kevinratcliff.com> flavor, containing:
> Greetings,
> 
> I am trying to create a dbfawk file for this shapefile which contains
> contour lines:
> 
> http://inmap.indiana.edu/downloads/Contours_24K_USGS_BLOOMINGTON.zip
> (caution: 70MB file)
> 
> http://inmap.indiana.edu/metadata/Contours_24K_USGS_BLOOMINGTON.html (metadata)
> 
> I was able to use ogr2ogr to convert the .shp to a format Xastir can
> read, and it displays on the map. I made a simple dbfawk file that
> changes the line color, and that works as well.
> 
> Now what I'd like to do is make the index contour lines display
> thicker than the regular contour lines (an index contour is every 5th
> contour line). In this area the contour interval is 10 feet.
> 
> Any suggestions for how to best accomplish this?

Without having looked at the files myself (no time) I can't give you the
precise dbfawk magic incarnation, but here's what has to happen:  you need
to come up with a perl-compatible regular expression that matches the fields
that an index contour has.  For your case, with 10 foot contour intervals,
you could do it by matching when the contour level has a 5 or 0 in the second
digit, e.g., if the field name with the contour level was called "Elev" then
you'd match with a dbfawk line that said:

  /^Elev=.*[05]0$/ {lanes=2; next;}

That'd do it for your specific case of 10 foot contours, making those 00 and 50
contours be twice as thick as all the others (make sure you have "lanes=1" in
your BEGIN_RECORD to get the others set to 1).

Unfortunately, there's no way in a dbfawk file to match "every fifth line",
you have to do it based solely on the contents of the dbf record itself.
If there is no other indication in the DBF record that designates a contour
as an index contour, you're either stuck with making certain level values
indices, modifying the DBF file, or not having index contours visually distinct.

With a GIS, dbf editor, or hand-rolled program of some kind, you could modify 
the file and insert an extra field called "INDEXCONTOUR" and have a value of 1 
or 0 in it, then search for that in the dbfawk if your files don't all have
the same contour interval.  But that's another story.

-- 
Tom Russo    KM5VY   SAR502   DM64ux          http://www.swcp.com/~russo/
Tijeras, NM  QRPL#1592 K2#398  SOC#236        http://kevan.org/brain.cgi?DDTNM
 "The truth will set you free, but first it will piss you off."





More information about the Xastir mailing list