summaryrefslogtreecommitdiff
path: root/ipl/gpacks/tiger/tgrsort
diff options
context:
space:
mode:
Diffstat (limited to 'ipl/gpacks/tiger/tgrsort')
-rwxr-xr-xipl/gpacks/tiger/tgrsort31
1 files changed, 31 insertions, 0 deletions
diff --git a/ipl/gpacks/tiger/tgrsort b/ipl/gpacks/tiger/tgrsort
new file mode 100755
index 0000000..825f5bd
--- /dev/null
+++ b/ipl/gpacks/tiger/tgrsort
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# tgrsort [file] -- sort TIGER line chains
+#
+# Sort keys are:
+#
+# 1. CFCC feature class, in this order:
+# boundary
+# water
+# other topographic feature (rare)
+# road
+# railroad
+# pipeline, power line, etc.
+# landmark
+# unclassified
+#
+# 2. Major category, largest (least significant) first
+#
+# The feature class and category sorting is chosen so that more important
+# chains are drawn later, obscuring lesser chains, instead of the reverse.
+#
+# Note that this sorting can reverse the positions of the first two lines
+# of the file (the min/max lines), but tgrmap.icn can handle that.
+
+TR1=FHEABCDX
+TR2=JKLMNPQR
+
+cat $1 |
+tr $TR1 $TR2 |
+sort -t: -k 1.1,1.1 -k 1.2,1.3r -k 1.4 |
+tr $TR2 $TR1