forked from Xastir/Xastir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.MAPS
1522 lines (1199 loc) · 68.3 KB
/
README.MAPS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
$Id: $
Recommended Configurations for:
U.S. Users:
-----------
Minimum: Shapelib, pcre
--------
Allows use of all built-in map types plus 2003 (and later) Tigermap data,
shapefile weather alerts, and local ESRI Shapefile format
maps, including U.S. satellite/image/topo maps via Internet.
Medium: Shapelib, pcre, lcms, ImageMagick, libcurl/wget,
-------
Allows use of all the above plus Internet maps and local image
maps.
Maximum: Shapelib, pcre, lcms, ImageMagick, libcurl/wget,
-------- libtif, libproj, libgeotiff
Allows use of all the above plus USGS topo maps.
Bleeding edge: GDAL/OGR
--------------
Adds more map types, but they're not fully supported yet. You
can certainly get some use out of them though, like overlaying
SDTS contour vectors on top of terraserver satellite images.
Rest of World:
--------------
Minimum: lcms, ImageMagick, libcurl/wget
--------
Allows use of all built-in map types plus local and Internet
image maps, including Canadian topo maps via Internet.
Medium: lcms, ImageMagick, libcurl/wget, Shapelib, pcre,
-------
Allows use of all the above plus ESRI Shapefile maps.
Maximum: libproj/libtiff/libgeotiff/GDAL/OGR
--------
Adds more map types. Some of these may not be useful in your
part of the world. GDAL/OGR stuff is not fully supported yet.
Map Type: Libraries Required/Notes:
--------------- -------------------------
DosAPRS Built-in.
WinAPRS Built-in.
X-APRS Built-in.
MacAPRS Built-in.
PocketAPRS Built-in.
USGS GNIS Built-in. Can split into county-sized chunks
using xastir/scripts/split_gnis.pl to speed
things up.
Address Lookup Built-in.
Weather Alerts Shapelib
pre-2003 Tigermaps Shapelib
post-2003 Tigermaps Shapelib, pcre
ESRI Shapefiles Shapelib
Image Maps ImageMagick. Often need lcms library and others
as well (whatever it takes to make ImageMagick
happy). Can also use the XPM library for some
image types without installing ImageMagick.
Internet Maps ImageMagick plus wget or libcurl. Often need
lcms library and others as well (whatever it
takes to make ImageMagick happy).
UI-View Maps Convert from .INF to .GEO format using
xastir/scripts/inf2geo.pl
OziExplorer Maps Convert some maps to .GEO format using
xastir/scripts/ozi2geo.pl
USGS DRG Topo libtiff, libtiff-devel, libproj, libgeotiff
USGS SDTS GDAL/OGR. Preliminary.
MapInfo GDAL/OGR. Preliminary.
Tiger/Line Raw GDAL/OGR. Preliminary.
Microstation DGN GDAL/OGR. Preliminary.
S57 GDAL/OGR. Preliminary.
APRS Overlays Convert to Shapefile maps with scripts/pos2shp.pl
The default map, "worldhi.map", is used with permission of its creator, Keith Sproul, WU2Z.
How to Use APRS Overlay Maps (*.POS files) within Xastir:
---------------------------------------------------------
Use the "xastir/scripts/pos2shp.pl" script to convert the
overlay files to ESRI Shapefile maps:
# ./pos2shp.pl test.pos testmap
# cp testmap* /usr/local/share/xastir/maps/.
Xastir: Map->Configure->Index: Add New Maps
Map Chooser: Select the "testmap" map
Getting Maps and other Data Files for Xastir:
---------------------------------------------
NOTE: Set map FILES to permissions 644 ("rw-r--r--"), map
DIRECTORIES to 755 ("rwxr-xr-x") using the "chmod" command.
These permissions will allow anyone on the box to read the map
files, and access the map directories. Type these
commands exactly as shown in order to set the map directory's
permissions properly. Do this as the root user:
cd /usr/local/share/xastir/maps
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
You can repeat these commands at anytime, to fix up errant map
permissions that are created by downloading/installing new
maps.
Currently the maps/GPS directory needs to be writable by normal users
in order to support downloading GPS data using GPSMan. This will be
changed at some future date, moving this directory into the user's
home directory instead.
cd /usr/local/share/xastir/maps
chmod 777 GPS
find GPS -type d -exec chmod 777 {} \;
find GPS -type f -exec chmod 777 {} \;
Download some maps:
If you compiled with ImageMagick and have wget or libcurl installed,
you can skip this step and use the online Tiger/Terraserver maps
exclusively. However, having maps on your computer is often faster
than transferring images over a modem, and is not subject to the
failures of your Internet connection. See the section below on map
caching for an exciting feature that works with most online maps to
really speed things up!
You can have any number of maps in the /usr/local/share/xastir/maps
directory. You can organize the maps however you like. You can also
use symbolic links to link to files/directories on other disks. Map
files are loaded in the order that they appear in the chooser unless
you adjust the layering priorities in the "Properties" dialog (it's
recommended that you use these now instead of a directory hierarchy to
choose the layering).
There are many methods for organizing many maps. Create a map
hierarchy using something that makes sense to you. The old method of
creating transparent/filled or raster/vector directories has been
superceded by the new map layering features in the Map
Chooser->Properties dialog. It's now suggested that the map layering
be done there, and the directory layout designed to make it easiest
for the user to select maps. Perhaps a good start would be:
World/
Canada/
Canada/Province/
USA/
USA/State/WA/
USA/State/WA/County/
...
GNIS/
Overlay/
Please note that the map directories are entirely up to the user
now. Use the map layering facilities (Map Chooser->Properties) to
determine the order in which they will be drawn, and to determine
which will draw filled areas. Note that raster maps will always draw
filled, not matter what the setting suggests. For vector maps, you
have a choice of:
Fill = No Polygons will never be filled
Fill = Yes Polygons will always be filled
Fill = Auto Polygon fill is determined by map (or if it's a
Shapefile, by any associated dbfawk file).
Map types available by extension:
Vector Format:
.shp/.shx/.dbf Shapefile vector map (need all three files)
.pdb PocketAPRS vector map
.map APRSdos/WinAPRS/MacAPRS vector map
.gnis GNIS labels file (actually points instead of vectors)
.geo Vector map or Internet vector map. Note that for
http/ftp-based maps Xastir requires an IMAGESIZE line.
Raster Format:
.tif/.fgd geoTIFF raster image map
.geo Raster image map or Internet raster image map. Note that
for http/ftp-based maps Xastir requires an IMAGESIZE line.
Note: .geo is listed twice because it can fit in both categories,
depending on the base format of the map file that the .geo file
points to. .geo files are handled by the XPM library or by
ImageMagick, so most anything that can be handled by those installed
libraries can by handled by Xastir.
A few maps of various types are available from:
http://we7u.wetnet.net/xastir/maps/
Here's a page that we'll try to keep up-to-date which will have lots of
links to download-able maps on it:
http://xastir.org/index.php/Xastir_Maps
Dos/Win/MacAPRS style vector/fill maps:
http://www.winaprs.com/Maps.htm
http://www.cnunix.com/ftp/hamradio/rutgers.mirror/maps/maps2/
ftp://ftp.tapr.org/aprssig/maps/
WORLDHI.MAP is suggested as a basic view of the world map.
You can use any of the other maps available from this site. Many of
them were created from Tiger/Line maps, but they are several years out of
date. It is suggested that you don't use these as your primary
street-level maps; the newer shapefile-based maps are usually preferable.
In cases where you cannot compile shapefile support, these maps suffice.
PocketAPRS vector maps:
The WinAPRS 2.51 distribution included the full collection of
PocketAPRS vector maps for the USA. The download is about 60MB, from the
TAPR ftp site.
ftp://ftp.tapr.org/aprssig/winstuff/WinAPRS/waprs251.zip
Raster Maps:
For Canada there is a country wide set of topographic map images available
from the "Department of Natural Resources Geomatics Canada". Running
/scripts/toporama250k.pl will pull down 430mb of 1:250k map images
from that departments site. If thats not enough data, running
/scripts/toporama50k.pl will pull down around 10gigs
**** Note that recent changes at the "Department of Natural Resources Geomatics
Canada" have made these scripts fail. Changes to the scripts are being coded
and tested. Git will be updated once the scripts are proven to work again. ****
For Ireland, EI8IC (http://www.mapability.com) has produced a set of overlay
maps that show the County Borders, Main Towns and Roads. John, EI7IG, has
created a set of ".geo" files to go with them and they are all available in one
tarball from [http://ireland.aprs2.net/xastir/IrelandMaps/Ireland.tar.gz
ireland.aprs2.net] They are free for non-commercial use.
Also available are a map of the
[http://ireland.aprs2.net/xastir/IrelandMaps/Ireland1600x2000.bmp country], with
an associated [http://ireland.aprs2.net/xastir/IrelandMapsIreland1600x2000.geo
geo] file, the [http://ireland.aprs2.net/xastir/IrelandMaps/Ireland1600x2000.bmp
South East], it's associated
[http://ireland.aprs2.net/xastir/IrelandMapsIreland1600x2000.geo geo] and a
[http://ireland.aprs2.net/xastir/IrelandMaps/IrishMET.geo Weather Radar] .geo file.
Shapefile format maps (Requires shapefile support):
Shapefile format maps are slowly becoming the standard vector format of
maps used with Xastir. Xastir 1.3.2 and above by default enable dbfawk
support for parsing shapefile metadata, see below.
A nice world map is available at http://aprsworld.net/gisdata/world/
thanks to James Jefferson, TerraSpace, Russia, and the Digital Chart
of the World (for Antarctica). Note that this file is currently
available only in uncompressed or in tar/bzip2 format. To decompress
the latter file, you'd type "bunzip2 filename" and then
"tar xvf filename".
TIGER/Line Shapefiles:
Tiger/Line 2006 Second Edition 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
Older Tiger97 maps converted to shapefile download-able from:
http://www.mapshots.com
Some other shapefile format maps are available at:
http://www.nws.noaa.gov/geodata/
Still other shapefiles are available from esri.com, geographynetwork.com
and gisdatadepot.com (from their "free data" link). Lot's of useful
stuff at these sites, just look around. You can also check
with your County GIS office for shapefiles of your county. You can
convert them from State Plane to Lat/Long projection using
instructions later in this document.
Canada street maps in Shapefile format are available at
http://www.geobase.ca
If you also use GeoTIFF images, get the handy usgs_24kgrid.zip file from
http://data.geocomm.com/quadindex/. This file provides a grid of all of
the 7.5' maps and their names for the U.S.
A nice world map is available at http://aprsworld.net/gisdata/world/
thanks to James Jefferson, TerraSpace, Russia, and the Digital Chart
of the World (for Antarctica). Note that this file is currently
available only in uncompressed or in tar/bzip2 format. To decompress
the latter file, you'd type "bunzip2 filename" and then
"tar xvf filename".
www.bts.gov has the "National Transportation Atlas" that you can download
pieces of (at least for the larger layers) or ask for (free) CD-ROM's to be
mailed to you.
-----
Re-projecting shapefiles (or: why doesn't my shapefile show up?)
A shapefile is pretty much just a collection of points and lines
between points. Xastir expects that those points are expressed in
degrees of longitude and latitude with positive values indicating N
and E and negative values indicating S and W.
One often comes across shapefiles with data in some other format, such
as UTM or state-plane projections with units in meters or feet. You
must re-project these sorts of shapefiles in order to use them in
Xastir. You must either know what the current format is of the
shapefile you wish to re-project, or have the .prj file that some
shapefiles come with.
Fortunately, the shapelib-1.2.10 distribution (which you probably
compiled and installed to enable shapefile maps in Xastir) includes a
tool for performing this re-projection.
First make the shpproj utility by:
1. change to directory: <shapelib source directory>/contrib
2. type 'make' to compile the contrib files
3. Optionally install shpproj by copying it to /usr/local/bin
shpproj takes 4 arguments:
shpproj shp_file new_shp -i="in_params" -o="out_params"
shp_file is the name of your existing shapefile triad (without the
extension).
new_shp is the name of your new shapefile triad (which doesn't exist
yet).
-i="in_params" are the parameters describing the existing shapefile.
-o="out_params" are the parameters describing the new shapefile. We
want this to be "geographic".
Examples:
Convert shapefile triad from US State-plane, South Central Texas region
(FIPS code 4204), in feet to geographic:
shpproj stateplane_shapefile geographic_shapefile \
-i="init=nad83:4204 units=us-ft" -o=geographic
Convert UTM zone 15 to geographic:
shpproj utm_shapefile geographic_shapefile \
-i="proj=utm zone=15 units=m" -o=geographic
To get a listing of the FIPS codes, you need to have proj installed
(see elsewhere in this file for more information). Look in the
"<proj source directory>/nad/nad.lst" file.
For more detailed documentation, see the shpproj.txt file in the
"<shapelib source directory>/contrib/doc" directory.
There's a resource for looking up the FIPS codes for a particular
area:
http://www.aprs.net/fips/
An important note about using shpproj to re-project maps
The shpproj program cannot be used to convert shapefiles unless they're
already using the NAD83 or WGS84 datum. shpproj will do the conversion
if you ask it to, but it will do it incorrectly.
A simple program to convert shapefiles between various projections
that does do datum conversions correctly is "shpcs2cs," available
from
<http://www.swcp.com/~russo/shape_web/>
That program requires libproj to be installed properly, and uses a
command line format similar to the "cs2cs" program that comes with
libproj.
If you already have GDAL installed, you should have the "ogr2ogr"
program available to you. ogr2ogr will not only convert projections
and geodetic datum correctly, but will also convert format (ArcView
binary format to shapefile, TIGER/Line files to shapefile, etc.).
Some detailed instructions for using ogr2ogr to do this conversion
are available at
<http://www.swcp.com/~russo/shape_web/>
-----
Using "dbfawk" to interpret shapefile DBF data: Each shapefile
map (*.shp, *.shx) comes with a DBase data file (*.dbf) in which
each shape in the .shp file has a corresponding set of descriptive
data about that shape in the .dbf file. While shapefiles are all
a standard format and will most always draw (possibly after having
been re-projected with shpproj), the corresponding .dbf data varies
widely depending on the data source. For example, US Census
Tiger/Line files contain 20 attributes for each shape including such
values as the name of the shape (i.e. street name), and a "Census
Feature Class Code" (CFCC) which indicates whether a shape is a
dirt road or a superhighway, for example.
In "pre-dbfawk" Xastir, knowledge of the various sources of
shape files was built into the program and it was necessary to
add code to support new shapefile sources (such as those
produced by local government agencies, non-US, etc.). Xastir
with dbfawk moves this logic into metadata files named *.dbfawk.
These files are linked to the .shp/.dbf files they belong with in
one of two ways:
1. "Signature" recognition. .dbfawk files located in the config/
directory are read to find the "dbfinfo" signature, which is
simply the ordered list of attribute names found in the .dbf file.
If you browse config/*.dbfawk you will see dbfawk's for the most
well know shapefile types. For example, tgrlk.dbfawk matches
all the "tgr*lk?.dbf" US Census Tiger/Line files. When a shapefile
map is displayed, it's .dbf signature is matched up with one of
the config/*.dbfawk files.
2. "Tied" to a file. If you installed a .dbfawk file in the same
directory as the .shp and .dbf files (e.g. sample.shp, sample.dbf
get a corresponding sample.dbfawk) then that file is used instead
of signature matching.
The first method allows a single .dbfawk file to be automatically
used for hundreds of standard shapefile maps. The later allows you
to customize how your particular shapefile map displays.
What's in a .dbfawk file? The best documentation of these files
is found by looking at the commented examples in config/*.dbfawk.
dbfawk is modeled after the "awk" pattern scanning and processing
language -- but, it is *not* exactly awk:
- Regular expression syntax is that used by Perl (the pcre library
is used) rather than pure awk.
- Action statements are much more limited than full-blown awk.
- The concept of records and fields is used since a .dbf record
is structured of usually several fields (name, feature type, etc.).
That said, what dbfawk does is allow a great degree of control of
how and when shapes and their names are displayed. This is done by
setting the values of several "builtin" variables [Technically, these
are only built-in to shapefile support. Potentially the awk-like
code can be extended to other uses.]:
dbfinfo: the "signature" to match against.
dbffields: which fields to read from the .dbf file.
color: what color code to display the shape with.
lanes: width of the shape.
name: name of the shape.
key: search key (used for WX alerts to find the shape)
symbol: symbol for landmarks, etc.
filled: draw polygons filled. Filled="Yes" or "No" in the Map
Properties dialog will override this option. Set to "Auto"
in that dialog to have the dbfawk file control this.
fill_style: style of fill (0=solid, 1=FillTiled, 2=FillStippled, etc.)
fill_color: color of fill
fill_stipple: stipple pattern if fill_style=2 ("FillStipple")
0=13 percent, 1=25 percent, 2=50 percent.
pattern: solid or dashed lines.
display_level: at what zoom level to begin displaying the shape
label_level: at what zoom level to begin displaying labels
label_color: color to use for labels
Execution of a dbfawk file: Just like awk, the file consists of
patterns that are matched against input data and actions to take
when the pattern matches. There are four special patterns in dbfawk:
BEGIN_RECORD: action is executed just before parsing a record.
BEGIN: action is executed just before parsing a field.
END: action is executed just after parsing the field.
END_RECORD: action is executed just after parsing a record.
All other patterns are regular expressions that are matched against
a data value of <fieldname>=<value>. For example:
FENAME=Main
Actions in dbfawk files consist of setting variables and two special
actions:
next: skips to the next field in the record.
skip: skips to the next record.
If neither next nor skip is given in the action, then processing falls
through to the next pattern/action pair in the dbfawk file.
The special dbffields variable is used to list which fields of the
record to be processed and in what order. The order is significant
since it may take several DBF fields to build up a complete name.
For example, in Tiger/Line, the street name is actually the
concatenation of FEDIRP, FENAME, TYPE, FEDIRS. Here's an excerpt
from tgrlk.dbfawk to demonstrate:
BEGIN {dbffields="TLID:FEDIRP:FENAME:FETYPE:FEDIRS:CFCC"}
...
/^FEDIRP=(.+)$/ {name="$1 ";next}
/^FENAME=United States Highway (.*)$/ {name="$(name)US $1"; next}
/^FENAME=State Highway (.*)$/ {name="$(name)State $1";next}
/^FENAME=State Route (.*)$/ {name="$(name)SR $1";next}
/^FENAME=(.*)$/ {name="$(name)$1; next}
/^FETYPE=(.+)$/ {name="$(name) $1"; next}
/^FEDIRS=(.+)$/ {name="$(name) $1"; next}
Creating and testing dbfawk files: You can test an existing dbfawk
file by setting debug level 16 in Xastir (this will generate a huge
amount of map rendering debug output, including dbfawk info):
"./xastir -v 16 2>/tmp/log"
Or, use "testdbfawk" which reads a .dbf file (or single field assignments
on the command line). For example:
cd /usr/local/share/xastir
testdbfawk -D config -d Counties/mz01ap14.dbf 2>&1 | less
8 Columns, 479 Records in file
sig: ID:WFO:GL_WFO:NAME:AJOIN0:AJOIN1:LON:LAT
DBF Signatures match!
name=Lake Okeechobee, key=AM_Z610, symbol=, color=8, lanes=2, filled=0, pattern=0, display_level=65536, font_size=2, label_level=512
label_color=20
...
testdbfawk takes the following command line syntax:
testdbfawk --help
Prints command line usage
testdbfawk -D directory -d file.dbf
Scans directory for dbfawk files with signatures matching file.dbf,
runs the dbfawk program that matches if it's found.
testdbfawk -f file.dbfawk -d file.dbf
runs the dbfawk file "file.dbfawk" over the dbf file "file.dbf"
So in the example above, testdbfawk scans the current directory
for dbfawk files with signatures that match tgr36119lkA.dbf's
signature. testdbfawk dumps its output to standard error, so in
the example standard error is redirected to standard out and
piped into "less" for paging.
To create a .dbfawk file, you need to understand the layout and contents
of your .dbf file. Use "dbfinfo" and "dbfdump" which are in the shapelib
contrib directory. Dbfinfo will list the field names and dbfdump will
dump out all fields of all records. Take the field names from dbfinfo,
and concatenate them together in order, separated by ":" to make the
dbfinfo= signature variable assignment.
Your best bet is to start with an existing .dbfawk file as an example.
Dbfawk hints and kinks: You have to think like an awk programmer and
realize that the order that rules are listed matters, that it's important
to use "next" as soon as it makes sense so other rules aren't looked at
unnecessarily and, to use "skip" when you want to fix bad dbf data.
For example, my county's Tiger/Line maps have several coding errors
where a segment of a main highway is incorrectly labeled as a local
street. This rule overrides one of those incorrect records:
# This Furnace Dock Rd segment is really Rt 9!
/^TLID=139773160$/ {name="Briarcliff-Peekskill Pky"; display_level=8192; label_level=512; color=4; lanes=4; skip;}
TLID is the Tiger/Line ID which is the unique identifier for this
segment.
-----
Rolling your own shapefile maps:
It is relatively easy to create your own shapefile maps (for example,
if you want to highlight a walk-a-thon course). There are several
methods available with Xastir:
1. Use GPSMan to download a GPS track to a shapefile.
2. Save a station tracklog of an actual station or an object that
you manually move along the course. When you select Station Info,
you are presented with the option to save the track, which gets
put in
.xastir/tracklogs/<datestamp>_<callsign>_APRS_Trail_<color>.*
You can move the .shp, .shx, and .dbf files to your maps directory.
Use DBFAWK to make a map-specific .dbfawk file. For example:
BEGIN {dbfinfo="Credits:DateTime";dbffields="Credits:"}
BEGIN_RECORD {key=""; lanes=4; color=12; name=""; filled=0;
pattern=1; display_level=8192; label_level=32; symbol=""}
This makes the track width 4 and red (12).
3. You can use xastir's "object" capability to generate shapefile maps.
a) Turn off object transmission using
Interface->Disable Transmit:Objects
b) Put objects where you want. Set the display symbol as you like it.
c) run the "object2shp.pl" script in the scripts directory
(/usr/local/share/xastir/scripts/object2shp.pl in most installations)
to generate a shapefile:
/usr/local/share/xastir/scripts/object2shp.pl ~/.xastir/object.log myshape
This requires the four shapelib utilities "dbfcreate", "shpcreate",
"shpadd" and "dbfadd" as described below.
d) EXIT XASTIR
e) REMOVE ~/.xastir/config/object.log
f) move "myshape.shp," "myshape.shx," and "myshape.dbf" to your maps
directory.
g) restart xastir.
h) select your newmap in the map chooser.
Creating maps in this way is basically just a scripted version of the
manual map generation technique in (4) below.
4. You can also use the shapelib tools (shpproj was presented earlier)
to manually create a shapefile. For example, the following
marks out the mile-posts for a marathon, using tgrlpt.dbfawk
(US Census Tiger/Line landmark points with an APRS(tm) symbol extension)
for the metadata:
#!/bin/sh
# turn mileposts into a Tiger landmark shapefile
rm -f posts.shp posts.dbf
shpcreate posts point
dbfcreate posts -n ID 8 0 -s CFCC 3 -s NAME 30
shpadd posts -74.0570 40.6025
dbfadd posts 1 'X\m ' Start
shpadd posts -74.0443 40.6065
dbfadd posts 2 'X\m ' 1M
shpadd posts -74.0353 40.6093
dbfadd posts 3 'X\m ' 2M
shpadd posts -74.0268 40.6260
dbfadd posts 4 'X\m ' 3R
shpadd posts -74.0200 40.6277
dbfadd posts 5 'X\m ' 3G
shpadd posts -74.0270 40.6252
dbfadd posts 6 'X\m ' 3B
shpadd posts -74.0197 40.6395
dbfadd posts 7 'X\m ' 4R
shpadd posts -74.0203 40.6388
dbfadd posts 8 'X\m ' 4BG
shpadd posts -74.0077 40.6508
dbfadd posts 9 'X\m ' 5R
shpadd posts -74.0083 40.6503
dbfadd posts 10 'X\m ' 5BG
shpadd posts -73.9957 40.6623
dbfadd posts 11 'X\m ' 6R
shpadd posts -73.9962 40.6617
dbfadd posts 12 'X\m ' 6BG
shpadd posts -73.9850 40.6743
dbfadd posts 13 'X\m ' 7R
shpadd posts -73.9858 40.6738
dbfadd posts 14 'X\m ' 7BG
shpadd posts -73.9782 40.6865
dbfadd posts 15 'X\m ' 8M
shpadd posts -73.9597 40.6890
dbfadd posts 16 'X\m ' 9M
shpadd posts -73.9573 40.7007
dbfadd posts 17 'X\m ' 10M
shpadd posts -73.9622 40.7122
dbfadd posts 18 'X\m ' 11M
shpadd posts -73.9515 40.7230
dbfadd posts 19 'X\m ' 12M
shpadd posts -73.9520 40.7345
dbfadd posts 20 'X\m ' 13M
shpadd posts -73.9525 40.7465
dbfadd posts 22 'X\m ' 14M
shpadd posts -73.9403 40.7503
dbfadd posts 23 'X\m ' 15M
shpadd posts -73.9578 40.7587
dbfadd posts 24 'X\m ' 16M
shpadd posts -73.9556 40.7675
dbfadd posts 25 'X\m ' 17M
shpadd posts -73.9465 40.7808
dbfadd posts 26 'X\m ' 18M
shpadd posts -73.9372 40.7935
dbfadd posts 27 'X\m ' 19M
shpadd posts -73.9272 40.8047
dbfadd posts 28 'X\m ' 20M
shpadd posts -73.9343 40.8142
dbfadd posts 29 'X\m ' 21M
shpadd posts -73.9453 40.8050
dbfadd posts 30 'X\m ' 22M
shpadd posts -73.9525 40.7923
dbfadd posts 31 'X\m ' 23M
shpadd posts -73.9630 40.7810
dbfadd posts 32 'X\m ' 24M
shpadd posts -73.9720 40.7696
dbfadd posts 33 'X\m ' 25M
shpadd posts -73.9811 40.7683
dbfadd posts 34 'X\m ' 26M
shpadd posts -73.9763 40.7720
dbfadd posts 35 'X\m ' Finish
---------
Splitting large Shapefile maps into regularly-sized tiles:
Look for "shp2tile" at http://imaptools.com/tools/, it does
exactly that. This can speed up Xastir tremendously if you're
zoomed in quite a bit on a large Shapefile map (or maps). If
it is broken into tiles Xastir only has to load the tiles of
interest instead of slogging through the entire large file
each time.
GeoTIFF Map files (requires GeoTIFF):
If you compiled in geoTIFF support, you can use USGS DRG topographic
maps. These are primarily useful to U.S. users. DRG topo maps can be
found for free for most states, and can be purchased for others.
http://www.bianifc.org/gis_gps/gps/drgfree.html
http://www.gisdatadepot.com
or try a google search with "free drg maps" as the search query.
If you have no luck finding free DRG maps, go to
http://www.geocomm.com/ and check out the "DRG Data Bundles"
they have available. You can purchase a DVD containing all the
DRGs for an entire state in three scales, all of them usable in
xastir, for a relatively low price. Be warned, however, that
parts of the US have DRGs that are produced by an agency other
than the United States Geological Survey, and these DRGs are not
necessarily in correct GeoTIFF format. The areas covered by the
Tennessee Valley Authority appear to be among those, as one
xastir user discovered when purchasing a DVD of DRGs for North
Carolina. It is still possible to use these DRG files, but they
need preprocessing. See the section below entitled "Defective
GeoTIFF files need even more special processing."
Many useful US maps can be downloaded from the National Map Viewer:
http://nmviewogc.cr.usgs.gov/viewer.htm
Free FAA sectional charts can be downloaded from
http://aviationtoolbox.org/raw_data/FAA_sectionals/current/
This site was set up by someone who had a subscription to the FAA
DVD collection and made them available on the web (this is legal per
FAA's terms of use). They are no longer being updated as of mid 2005.
These charts are in Lambert Conformal Conic projection, though, and
need to be converted with gdalwarp to be usable in xastir (see below).
Current, valid-for-navigation FAA sectional charts may be purchased
from the FAA at
https://naco.faa.gov/ecomp/Catalog.aspx?a=AERO+NOS+DIGITAL
for about $1.50US each. These files are also in GeoTIFF and are the
same type as those that are available on aviationtoolbox, but these are
updated every 6 months and are kept current. You will have to process
them before viewing in xastir.
The 7.5' topo maps work the best so far. Be sure to install the .tif AND
the .fgd files side-by-side into the map directories. Without the .fgd
file Xastir won't be able to crop the white border from the map. Xastir
currently knows how to handle NAD27, NAD83, and WGS84 geoTIFF files.
GeoTIFF files created in other datums will be displayed at an incorrect
location with Xastir. The .tfw files included with most geoTIFF images
are not used by Xastir.
If you must make FGD files by hand, the included script mapfgd.pl can
create them for you from the USGS geoTIFF files. The format Xastir is
looking for is the following:
1.5.1.1 WEST BOUNDING COORDINATE: -122.000000
1.5.1.2 EAST BOUNDING COORDINATE: -120.000000
1.5.1.3 NORTH BOUNDING COORDINATE: 48.000000
1.5.1.4 SOUTH BOUNDING COORDINATE: 47.000000
-or-
1.5.1.1 West_Bounding_Coordinate: -122.000000
1.5.1.2 East_Bounding_Coordinate: -120.000000
1.5.1.3 North_Bounding_Coordinate: 48.000000
1.5.1.4 South_Bounding_Coordinate: 47.000000
Notes about DRG-Enhanced (DRG-E) files:
* The DRG-E files will draw over the correct spots if you remove
the .fgd file, but will overflow their boundaries and
* The DRG-E files will draw over the correct spots with decent
boundary trimming (as far as I can tell, which isn't very far:
correct me!) if you use a .fgd file taken from 'real' DRG files
from USGS.
Basically: get rid of the .fgd file from the DRG-E!!
Highly Compressed MrSID image files:
Be wary of DRG-E or DOQQ files that are compressed with MrSID
compression. That is a proprietary compression format for
which we do not have access to the decoding algorithm. We
cannot use those from within Xastir. There's possible good news
lurking on the horizon though: LizardTech has mentioned on the
gdal-dev mailing list that they might be supporting open-source
with a driver for gdal sometime soon.
It is also possible to decompress these files with a free tool
from LizardTech called "mrsiddecode", available at
http://www.lizardtech.com/download/dl_options.php?page=tools
mrsiddecode can produce GeoTIFF output with the right command line
options. There is a Linux version of mrsiddecode, but one user
has observed that the Windows version running under Wine is a little
more robust. Your milage may vary.
Be warned that MrSID is a very effective compression algorithm, and
compressed MrSID files of size 5MB could easily decompress into 50MB
GeoTIFFs.
Note also that many GIS departments take perfectly usable
GeoTIFF files with all projection and datum tags and use ESRI products
to compress them down into MrSID files, thereby losing all the
GeoTIFF tags. See below.
GeoTIFF files in certain projections need special processing:
Not all geotiff files available on the net are usable directly in
xastir. Some of them are in projections that xastir can't use
properly, and others are missing all of the metadata information that
is needed to work out how to convert them to Lat/Lon unprojected rasters.
If you encounter a geotiff file that has the correct tags, but is
in some projection other than UTM, you can convert that file to a
lat/lon raster if you have gdal installed. Simply run the following
command:
gdalwarp -t_srs EPSG:4326 original_raster.tif usable_raster.tif
This will warp the geotiff file "original raster.tif" from
whatever projection it was in into an unprojected lat/lon raster
"usable_raster.tif" that can be directly read into xastir.
Depending on the source projection, you might get a map that
doesn't tile well with other maps due to the inclusion of opaque
border material, but it can sometimes be the only way to import
a map you need to use.
Defective GeoTIFF files need even more special processing:
It is unfortunately the case that the ESRI software in use by many
GIS departments produces GeoTIFF files that have NO information about
the coordinate system that applies to them --- they'll have just
enough information to know what the numerical coordinates of each
pixel are, but no information to tell you whether those coordinates are
UTM, Lat/Lon, State Plane, or anything else. For such maps you will
need to determine the coordinate system by finding external files
called "metadata" that are associated with the images. US
Federal datasources have a standardized file format (".fgd") that
provides this information, but many state or university GIS departments
just make some other format up for themselves. Most sources of
map data should have such metadata available, but sometimes it is a bit
of a chore to find it.
You can determine whether a .tif file has coordinate system information
in it using the "gdalinfo" command from the GDAL suite or "listgeo" from
the libgeotiff distribution. If gdalinfo shows something like this:
Driver: GTiff/GeoTIFF
Size is 5364, 7620
Coordinate System is `'
Origin = (588067.750000,5331248.500000)
you're the lucky owner of a file that has no coordinate system info
(because the only thing after "Coordinate System is" is a pair of
quotation marks). Another dead givaway would be:
Metadata:
TIFFTAG_SOFTWARE=Arc/Info
which tells you that the image was processed with a piece of software
that fails to put in all the right tags.
If you get maps whose metadata say are in UTM projection but for which
gdal indicates missing geoTIFF tags like it does in the example above,
xastir won't be able to display them unless you fix them up.
Fortunately, the GDAL library tool "gdal_translate" can do the
job. For example, if you have a source map with metadata that
says it's in UTM Zone 10, NAD83 datum, to make it suitable for
Xastir to read you can do something like this:
gdal_translate -a_srs EPSG:26910 original.tif georeferenced.tif
The inclusion of the "-a_srs" option to gdal_translate
forces the new tiff file to have the correct geotiff tags to
indicate that coordinate system.
The EPSG number to use for images in UTM projection with NAD83
datum is 26900 plus the UTM zone number. The EPSG number for UTM in
NAD27 is 26700 plus the zone number. The above command
will allow Xastir to read in the image and reference it
properly. If you do the gdalwarp option above instead, you can end up
with solid color areas between the edges of the original image
and the lat/long rectangle that the image will be warped to; these
extra pixels represent "no data" areas due to the difference in shape
between the original rectangular image and the warped image. The
color of this area depends on the colors present in the original
image; GDAL attempts to use a color that is different from any in the
source image. If those areas don't matter to you, then either
method will work for you. If you're planning to tile multiple
UTM images together, then the gdal_translate option is best.
If your maps are NOT in UTM, you must also gdalwarp, because xastir
cannot properly display geotiffs that are in projections other than
UTM or "unprojected" lat/lon.
EPSG numbers for odd-ball coordinate systems can be found at
http://www.remotesensing.org/geotiff/proj_list/Wkt_adam.zip
Maps that require gdalwarp include the FAA sectionals mentioned above,
and some topo maps in obscure state plane coordinates from various state
GIS departments.
XASTIR can only use GeoTIFF files that are 8-bit per pixel with one band
Some geotiff files contain multiple bands or multiple bytes per pixel.
Xastir currently uses only BYTE format, so you may need to convert the
geotiff file with gdal_translate. The number of bands, bytes per
pixel and other information about geotiff files can be obtained using
gdalinfo.