Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Yukon NTS Index in various formats
'''Print Yukon NTS tile names as html table with links, arranged in same order as they appear in a map index.
2015-Aug-19, Matt.Wilkie@gov.yk.ca
License: X/MIT
'''
nts_txt_ordered = '''117C 117D
117B 117A
116NO 116P
116JK 116I 106L 106K
116FG 116H 106E 106F
116BC 116A 106D 106C 106B
115NO 115P 105M 105N 105O 105P
115JK 115I 105L 105K 105J 105I
115FG 115H 105E 105F 105G 105H 095E
115BC 115A 105D 105C 105B 105A 095D 095C
'''
style = '''<style type="text/css">
.ntsgrid {color:#333333;width:auto;border-width: 1px;border-color: #6D92A8;border-collapse: collapse;}
.ntsgrid tr {background-color:#f9fafb;}
.ntsgrid td {border-width: 1px;padding: 0.7em 0.5em;border-style: solid;
border-color: #6D92A8;
text-align:center;}
.ntsgrid td:hover {background-color:#FDECC5;}
.ntsgrid a {text-decoration:none}
</style>'''
def link(txt, prefix=None):
return '<a href="{prefix}{txt}">{txt}</a>'.format(prefix=prefix, txt=txt)
if __name__ == '__main__':
print style
print '<table class="ntsgrid">'
for row in nts_txt_ordered.splitlines():
print '<tr>'
for x in row.split():
## prefix = '/maps/media/uploads/pdf-maps/Administrative_Boundaries_'
prefix = 'xxx/'
print '<td>',link(x, prefix),'</td>'
print '</tr>'
print '</table>'
<style type="text/css">
.ntsgrid {color:#333333;width:auto;border-width: 1px;border-color: #6D92A8;border-collapse: collapse;}
.ntsgrid tr {background-color:#f9fafb;}
.ntsgrid td {border-width: 1px;padding: 0.7em 0.5em;border-style: solid;
border-color: #6D92A8;
text-align:center;}
.ntsgrid td:hover {background-color:#FDECC5;}
.ntsgrid a {text-decoration:none}
</style>
<table class="ntsgrid">
<tr>
<td> <a href="xxx/117C">117C</a> </td>
<td> <a href="xxx/117D">117D</a> </td>
</tr>
<tr>
<td> <a href="xxx/117B">117B</a> </td>
<td> <a href="xxx/117A">117A</a> </td>
</tr>
<tr>
<td> <a href="xxx/116NO">116NO</a> </td>
<td> <a href="xxx/116P">116P</a> </td>
</tr>
<tr>
<td> <a href="xxx/116JK">116JK</a> </td>
<td> <a href="xxx/116I">116I</a> </td>
<td> <a href="xxx/106L">106L</a> </td>
<td> <a href="xxx/106K">106K</a> </td>
</tr>
<tr>
<td> <a href="xxx/116FG">116FG</a> </td>
<td> <a href="xxx/116H">116H</a> </td>
<td> <a href="xxx/106E">106E</a> </td>
<td> <a href="xxx/106F">106F</a> </td>
</tr>
<tr>
<td> <a href="xxx/116BC">116BC</a> </td>
<td> <a href="xxx/116A">116A</a> </td>
<td> <a href="xxx/106D">106D</a> </td>
<td> <a href="xxx/106C">106C</a> </td>
<td> <a href="xxx/106B">106B</a> </td>
</tr>
<tr>
<td> <a href="xxx/115NO">115NO</a> </td>
<td> <a href="xxx/115P">115P</a> </td>
<td> <a href="xxx/105M">105M</a> </td>
<td> <a href="xxx/105N">105N</a> </td>
<td> <a href="xxx/105O">105O</a> </td>
<td> <a href="xxx/105P">105P</a> </td>
</tr>
<tr>
<td> <a href="xxx/115JK">115JK</a> </td>
<td> <a href="xxx/115I">115I</a> </td>
<td> <a href="xxx/105L">105L</a> </td>
<td> <a href="xxx/105K">105K</a> </td>
<td> <a href="xxx/105J">105J</a> </td>
<td> <a href="xxx/105I">105I</a> </td>
</tr>
<tr>
<td> <a href="xxx/115FG">115FG</a> </td>
<td> <a href="xxx/115H">115H</a> </td>
<td> <a href="xxx/105E">105E</a> </td>
<td> <a href="xxx/105F">105F</a> </td>
<td> <a href="xxx/105G">105G</a> </td>
<td> <a href="xxx/105H">105H</a> </td>
<td> <a href="xxx/095E">095E</a> </td>
</tr>
<tr>
<td> <a href="xxx/115BC">115BC</a> </td>
<td> <a href="xxx/115A">115A</a> </td>
<td> <a href="xxx/105D">105D</a> </td>
<td> <a href="xxx/105C">105C</a> </td>
<td> <a href="xxx/105B">105B</a> </td>
<td> <a href="xxx/105A">105A</a> </td>
<td> <a href="xxx/095D">095D</a> </td>
<td> <a href="xxx/095C">095C</a> </td>
</tr>
</table>
+--------------+
| 117C | 117D |
+--------------+
| 117B | 117A |
+--------------+
| 116NO | 116P |
+----------------------------+
| 116JK | 116I | 106L | 106K |
+----------------------------+
| 116FG | 116H | 106E | 106F |
+-----------------------------------+
| 116BC | 116A | 106D | 106C | 106B |
+------------------------------------------+
| 115NO | 115P | 105M | 105N | 105O | 105P |
+------------------------------------------+
| 115JK | 115I | 105L | 105K | 105J | 105I |
+-------------------------------------------------+
| 115FG | 115H | 105E | 105F | 105G | 105H | 095E |
+--------------------------------------------------------+
| 115BC | 115A | 105D | 105C | 105B | 105A | 095D | 095C |
+--------------------------------------------------------+
117C 117D
117B 117A
116NO 116P
116JK 116I 106L 106K
116FG 116H 106E 106F
116BC 116A 106D 106C 106B
115NO 115P 105M 105N 105O 105P
115JK 115I 105L 105K 105J 105I
115FG 115H 105E 105F 105G 105H 095E
115BC 115A 105D 105C 105B 105A 095D 095C
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.