Contents
Tiger/Line 2008 shapefiles
Recent versions of Xastir have the ability to display Tiger 2008 maps. The latest Git should provide all of the files needed except for the maps themselves.
Here is the message from Curt about the new feature:
On Fri, 17 Apr 2009, Curt, WE7U wrote:
Thanks to the below mentioned people we now have Tiger 2008 streetmap capability in Xastir... And it's really fast! If you're used to the Online Tigermap server, the speed of this will really blow you away. It's also great for taking Xastir on the road where you don't have internet access. Please note the special instructions below for setting up the layering so that roads aren't covered up. Perhaps we can automate that part soon
Here are instructions for downloading an entire US state of tiger maps at once, extracting the maps, and configuring them for use in Xastir. Note that you don't have to do an entire state at once, that's just what I wanted to do. You can do individual counties.
Download the Tiger 2008 files
Go to ftp://ftp2.census.gov/geo/tiger/TIGER2008/ with a browser. Use this to find the name of the directory for the state you are interested in.
Make a temporary directory to download your maps, and then use wget to start the download:
mkdir ~/tiger2008 cd ~/tiger2008 wget -r ftp://ftp2.census.gov/geo/tiger/TIGER2008/18_INDIANA\*
This will recursively grab all of the files for the state you selected. Indiana's files were about 700MB zipped. The download will take some time even on a fast connection!
Extract the files
All of the files you downloaded are located in individual zip archives. You can unzip all of them using this command:
cd ~/tiger2008 for i in `find . -name "*.zip"`; do unzip -d `dirname $i` $i;done;
Like the download step, the unzip step will take a while.
When that completes, you can remove the zip files, which are no longer needed:
find ~/tiger2008 -name *.zip -exec rm '{}' ';'
Move the extracted files to your maps directory
cd ~/tiger2008/ftp2.census.gov/geo/tiger/ sudo mv TIGER2008 /usr/local/share/xastir/maps/
You may want to adjust the directory hiearchy depending on your personal perferences.
Launch Xastir to index the new maps
xastir
Xastir should index all of the shapefiles when it loads. Then shut down Xastir before you select any of the maps in the map chooser.
Fix the layering
The map layering needs to be adjusted for best results. You have several options for this.
Before you use any of them, make a backup of your map_index.sys file just in case:
cp ~/.xastir/config/map_index.sys ~/.xastir/config/map_index.sys.bak
Use a perl script
Lee, K5DAT, posted the following perl script to the Xastir mailing list.
Copy and paste this into a new file called tiger2008fixlayers.pl:
#!/usr/bin/perl # backup the map index file `cp ~/.xastir/config/map_index.sys ~/.xastir/config/map_index.sav`; # Define variables my ($indexfile, $checkline, $layer1, $layer2, $layer3); $indexfile = "map_index.sys"; $layer1 = "00997"; $layer2 = "00996"; $layer3 = "00995"; # Enable PERL simple debug use strict; use warnings; #open the config file open(INDX, $indexfile) || die("Cannot Open File"); #open a temp output file open(TMP, ">temp.sys"); # read lines in, fine/replace text, and write to the temp file while(<INDX>) { $checkline = $_; if (rindex($checkline, "arealm") > 0) { substr($checkline,44,5,$layer1); } elsif (rindex($checkline, "pointlm") > 0) { substr($checkline,44,5,$layer2); } elsif (rindex($checkline, "tabblock") > 0) { substr ($checkline,44,5,$layer3); } print TMP $checkline; } close(INDX); close(TMP); # copy the temporary file to the map index - thus overwriting it with the updated version `cp ~/.xastir/config/temp.sys ~/.xastir/config/map_index.sys`; # Delete the temp file unlink "temp.sys";
Move your new perl file to the Xastir config directory:
mv tiger2008fixlayers.pl ~/.xastir/config/
Run the perl file:
cd ~/.xastir/config/ perl tiger2008fixlayers.pl
Use vi
Use the "vi" editor to change the map layers:
vi ~/.xastir/config/map_index.sys :g/tabblock/s/01000/00995/ :g/pointlm/s/01000/00996/ :g/arealm/s/01000/00997/ :g/cousub/s/01000/01001/ :wq
Use sed
Jeremy, N0YAX, provided instructions for using sed to do the same thing:
= Method 1 - gnu sed =
sed -i -e "/tabblock/s/01000/00995/g" \ -e "/pointlm/s/01000/00996/g" \ -e "/arealm/s/01000/00997/g" map_index.sys
= Method 2 - other sed binaries =
cp map_index.sys mapindex.sys.bak sed -e "/tabblock/s/01000/00995/g" \ -e "/pointlm/s/01000/00996/g" \ -e "/arealm/s/01000/00997/g" map_index.sys.bak > map_index.sys
= Launch Xastir and select your maps
xastir
Open the map chooser and you should see a TIGER2008 folder. Select the map(s) you want to view. Enjoy!
= A word of caution =
You probably want to select just a county (or maybe a few) at a time. Selecting an entire state is likely to make loading maps really really slow, even on a fast machine.
TIGER/Line 2006
Tiger/Line 2006 data converted to shapefile format is available from ftp://aprs.tamu.edu/. Look in the "pub/TIGER_2006_SE/" directory. These maps only work with dbfawk support.
Unpack the zipfiles in your maps directory. I recommend creating a "TIGER_2006_SE" subdirectory or something similar, and unpacking the zipfile there. When unpacked, each state zipfile will produce a directory with the state's postal abbreviation as its name, and two subdirectories, "Polylines" and "Polygons." These directories each contain shapefiles with different information in them --- Polylines are linear features such as roads and streams, Polygons are area features such as parks and airports. You need both, even though they have the same names (the name of the county they cover).
You can also create your own TIGER/Line shapefiles from the raw data at the Census web site, http://www.census.gov/geo/www/tiger/index.html. The process requires two conversions: converting the linear features, and assembling the polygon features. The TIGER/Line data is a topological format, and polygons are not stored in a simple manner; this second step is time consuming.
To convert the polylines: Download the county files you want. Then unzip each one into its own directory (call it "in_directory"). Then cd to in_directory and run the following command:
ogr2ogr -f "ESRI Shapefile" -t_srs EPSG:4326 foo .
This will create a subdirectory of in_directory called "foo" which will contain a number of shapefiles and auxiliary data. The files called "CompleteChain.*" are the ones you want; they are the polylines corresponding to roads and other linear features. Copy these to your xastir maps directory and rename them to the name of the county they represent. Then install tgr2shp.dbfawk in your share/xastir/config directory and reindex maps. Ta da. See above: tgr2shp.dbfawk is now part of the xastir distribution..."
Note that you'll need dbfawk support compiled into Xastir to make these Tiger/Line maps look nice. For the 2003 TIGER/Line data, Derrick Breshear created scripts to process all of the Tiger/Line raw data into Shapefiles, then they were put on a download site made available by Kevin Glueck, "http://xastir.tamu.edu/". The 2006 Second Edition data were processed by Jason Winningham and made available on the ftp://aprs.tamu.edu/ site by Gerry Creager. Thanks go to Tom, Derrick, Kevin, Jason and Gerry for making these maps so accessible to the rest of us.
The second step to rolling your own TIGER/Line shapefiles is to assemble the polygons. This requires GDAL/OGR configured with python support, and requires that you have the Python language installed. Use the script Xastir_tigerpoly.py included in the "scripts" directory of Xastir's source tree.
As an example, if you have un-zipped the file TGR35001.zip (the TIGER/Line file for Bernalillo County, NM) into a directory called TGR35001, then
Xastir_tigerpoly.py TGR35001 Bernalillo_County_NM_Polys.shp
would create a shapefile of TIGER polygons (water bodies, political boundaries, parks, wilderness areas) that you can install in your maps directory and read directly using normal shapefile support.
Viewing these shapefiles as filled polygons requires dbfawk support, and the rules for displaying them are contained in the file tgr2shppoly.dbfawk.
Tiger/Line 2000 map data is available from http://www.esri.com/data/download/census2000_tigerline/index.html but requires free registration. A example of these types of files can be found at "http://we7u.wetnet.net/xastir/maps/shapefile/USA/WA/". You'll need to run "tar xzvf <filename>" on each one of the files from that last site after downloading. Some layers that may be of interest:
CMSA/MSA Polygons 2000 tgr*msa00.shp PMSA Polygons 2000 tgr*pms00.shp Consolidated Cities tgr*city.shp County - Current tgr*cty.shp County 2000 tgr*cty00.shp Designated Places 2000 tgr*plc00.shp Designated Places Current tgr*plccu.shp Key Geographic Locations tgr*kgl.shp Landmark Points tgr*lpt.shp Landmark Polygons tgr*lpy.shp Line Features - Hydrography tgr*lkH.shp Line Features - Landmarks tgr*lkD.shp Line Features - Misc. Transport tgr*lkC.shp Line Features - Non-visible tgr*lkF.shp Line Features - Physical tgr*lkE.shp Line Features - Rails tgr*lkB.shp Line Features - Roads tgr*lkA.shp Line Features - Unknown tgr*lkX.shp School Districts - Elementary tgr*elm.shp School Districts - Middle tgr*mid.shp School Districts - Secondary tgr*sec.shp School Districts - Unified tgr*uni.shp Traffic Analysis Zones tgr*taz.shp Urban Areas tgr*urb.shp Water Polygons tgr*wat.shp Alternate Feature Names tgr*alt.shp Address Matching Info tgr*add2.shp ZIP+4 Left and Right Info tgr*zip.shp Key Geographic Location Addresses tgr*add.shp Landmark Polygon Names tgr*lpy2.shp Landmark Polygons Multi-Landmark tgr*lpy3.shp Water Polygons Multi-Names tgr*wat2.shp
Tiger/Line 1997
Older Tiger97 maps converted to shapefile download-able from: http://www.mapshots.com