[Xastir] ESRI shapefiles and dbfawk

Tom Russo russo at bogodyn.org
Wed Dec 15 10:37:24 EST 2004


On Wed, Dec 15, 2004 at 01:53:04AM -0700, we recorded a bogon-computron collision of the <jewen at shaw.ca> flavor, containing:
> > If there are spaces, parens, or other cruft in the value of 
> > NATRDCLASS you can just wildcard things to ignore it, e.g.
> >   /^NATRDCLASS=.*FREEWAY/
> 
> It's starting to become a little clearer... Each value is very different
> than the next. I was thinking of only matching to the first few characters.

That might be good enough.

> >it can help to use the program 'testawk' that's built 
> >(but not installed) when you build xastir.
> 
> Huh? What do you mean by built but not installed?

I mean that when you do a "make" it gets created in the "src" directory,
but when you do "make install" it isn't copied into /usr/local/bin.  It's
meant for debugging purposes and so isn't installed.

> >There is some help in README.MAPS about how to use
> >testawk.  What this program will do is run your 
> >dbfawk file over a shapefile and dump out the 
> >various variable settings it'll use for each shape
> >found.
> 
> I'll have to play with that tomorrow. It's getting a little too late to play
> tonight.
> 
> I do see that I have a parsing problem with the dbfinfo line. I can't see
> what's wrong there. It's simply a line with all the labels in it, separated
> by colons...

One thing you can do to get a proper dbfinfo is to use testawk.  The first
thing it does is print out what dbfinfo is appropriate for your file.
(I mention this in the tutorial on 
http://www.swcp.com/~russo/shape_web/tutorial.html, but I imagine that that 
could be easy to overlook).

Do you see an error message on the console saying something to the effect of
"No matching DBFAWK signature for ...." when your shapefile is loaded?

> >Where do you obtain your shapefiles?  I might be 
> >able to help a little more if I had access to 
> >the data itself.
> 
> The Canadian Government has come out of the dark ages. They have finally
> released this data to the public. It can be found at www.geobase.ca. I've
> got the shapefile data for the Road Network in Alberta. It's about 40MB for
> the province. I'd suggest grabbing the data for Nunavut. It's a much smaller
> file, since there's only about 150 miles of road network in the whole
> territory.

Right after I emailed you asking this I did a google search and found that
site.  I downloaded the 47MB Alberta shapefile overnight, and might have time
to look at it tonight.  

It's unfortunate that there are so many steps to this.  There has been talk
of creating some sort of tool that helps, but nobody has been able to do it.
There are simply too many different types of shapefiles that various GIS
groups produce, and without good documentation it's just hard work to generate
an appropriate dbfawk file.

The good news is that once you've got it done your dbfawk file will work with
all shapefiles that have the same set of fields (i.e. any file that matches
the "dbfinfo" field.  You'll only need to do it once.  And once you do it,
we can add it to the xastir distribution and you'll have helped anyone else
in Canada who wants to use the Geobase shapefiles.

-- 
Tom Russo    KM5VY     SAR502  DM64ux         http://www.swcp.com/~russo/
Tijeras, NM  QRPL#1592 K2#398  SOC#236 AHTB#1 http://www.qsl.net/~km5vy/
 "That which does not kill me is better than that which does."
    --Irving Nietzche, lesser known of the famous Nietzche twins



More information about the Xastir mailing list