├── .gitignore
├── .hgignore
├── Lib
└── pyuac.py
├── Readme.adoc
├── apt
└── Readme.md
├── arcplus
├── AttributedMultiRingBuffer.py
├── arcgisscripting.py
├── arcplus.py
├── autocrop.ClipNoData.pyt.xml
├── autocrop.pyt
├── autocrop.pyt.xml
├── report-versions.py
└── xx-calc-trans.py
├── gis
├── AliasFeatureclassConversion.py
├── Tango-Palette.gpl
├── asSVG.py
├── canvec
│ ├── Using CanVec at Musings.desktop
│ ├── db-friendly-names.txt
│ ├── download-yukon-gml.bat
│ ├── gml2shp.bat
│ ├── gml2shp_friendly_layers.bat
│ └── unpack-canvec-zips.bat
├── gdal_extras
│ ├── Readme.txt
│ ├── bin
│ │ ├── fortiff.cmd
│ │ ├── fusion.py
│ │ ├── gdal-help.bat
│ │ ├── gdal_vrtmerge.py
│ │ ├── gdalcopyproj.py
│ │ └── gdalsetnull.py
│ ├── data
│ │ └── NTS-50kindex.csv
│ ├── gdal-extras-install.bat
│ ├── gdal_plugins
│ │ ├── gdal_SDE_91.dll
│ │ └── gdal_SDE_92.dll
│ ├── pics
│ │ └── bcg_tool.xpm
│ ├── proj_lib
│ │ └── yukon_albers.epsg
│ ├── setfw_portable.cmd
│ └── tools
│ │ └── Tool_BrightContrastGamma.py
├── geobase
│ ├── Automatic download and conversion of Geobase Road Network at Musings.desktop
│ └── nrn2yukon.bat
├── list-fc-aliases.py
├── misc
│ ├── cov2shp.cmd
│ ├── nts-html-table.htm
│ ├── nts_map_as_html_table.py
│ └── tissot
│ │ ├── generate_tissot.py
│ │ ├── tissot.dbf
│ │ ├── tissot.prj
│ │ ├── tissot.shp
│ │ └── tissot.shx
├── o4w_extras
│ ├── Readme.txt
│ ├── bin
│ │ ├── BuildAptExe.bat
│ │ ├── TestAptExe.bat
│ │ ├── apt.py
│ │ ├── cyg-apt.py
│ │ ├── gdal-makeworld.py
│ │ ├── gdalcopyproj.py
│ │ ├── gdalsetnull.py
│ │ ├── proj2wkt.py
│ │ └── wkt2proj.py
│ ├── install-o4w-extras.bat
│ ├── share
│ │ ├── gdal
│ │ │ └── NTS-50kindex.csv
│ │ └── proj
│ │ │ └── _put__ntv2_0.gsb__here.URL
│ ├── tests
│ │ └── apt-from-scratch.bat
│ └── xcopy_exclude.txt
├── qgis
│ ├── h3-grid-from-layer.py
│ ├── h3-in-qgis.assets
│ │ ├── h3-edit-min-max.png
│ │ ├── h3-results.png
│ │ └── h3-select-and-open.png
│ └── h3-in-qgis.md
├── recursive_apr_update
│ ├── .viminfo
│ ├── Copy of replace.vim
│ ├── ReadMe.txt
│ ├── build-replace.vim
│ ├── replace.src.txt
│ ├── replace.vim
│ ├── rgn_update.tws
│ ├── set-vim.bat
│ ├── upgrade-all.bat
│ ├── vim
│ │ ├── vim57
│ │ │ └── _put_vim_runtime_here_
│ │ └── vimrc
│ ├── viminfo
│ └── worknotes.txt
├── uninstall-ALL-ArcGIS-products.bat
├── xx-set-alias.py
└── yt30m_dem
│ ├── 50kdem
│ ├── 50k_dem.tws
│ ├── 50k_dem_anudem.tws
│ ├── _ReadMe.aml
│ ├── _TODO.txt
│ ├── _readme-anudem.txt
│ ├── _template.aml
│ ├── adem2grid.aml
│ ├── anudem.aml
│ ├── append_elev.aml
│ ├── append_h2o.aml
│ ├── border-tiles.txt
│ ├── build_dem_cmd.aml
│ ├── clip_100m.aml
│ ├── clip_lakes.aml
│ ├── cover2generate.aml
│ ├── dem2lib.aml
│ ├── find_paths.aml
│ ├── flat_lakes.aml
│ ├── flip_streams.aml
│ ├── float2int.aml
│ ├── flowdirect.aml
│ ├── get_akpnts.aml
│ ├── grid2catalog.aml
│ ├── index-all.txt
│ ├── job.list.txt
│ ├── kill_flipgrids.aml
│ ├── kill_locks.aml
│ ├── make_buffers.aml
│ ├── make_dems.aml
│ ├── make_flipgrid.aml
│ ├── make_shade.aml
│ ├── make_tilestruct.aml
│ ├── mosaic_250k.aml
│ ├── nuke.aml
│ ├── out2anudem.aml
│ ├── pkg_250k.aml
│ ├── pkg_50k.aml
│ ├── redo-center.aml
│ ├── rinse.aml
│ ├── run_anudem.aml
│ ├── scrap.aml
│ ├── sed.txt
│ ├── update-library.aml
│ └── whole-hog.aml
│ ├── LICENSE.txt
│ ├── depends
│ ├── UNIX2DOS.EXE
│ ├── cygwin1.dll
│ ├── gunzip.exe
│ ├── gzip.exe
│ └── sed.exe
│ ├── readme.txt
│ ├── resources
│ ├── FW geomorphometry DEM creation from digitized map (Summary of Replies).txt
│ ├── Overview.txt
│ └── SUM_contour-biasing.txt
│ └── setenv_50kdem.aml
├── metril
└── import_onenote_zip.py
├── other
├── OpenWithNotepad.reg
├── RelaunchElevated.cmd
├── RelaunchElevated_EmbeddedScripts.cmd
├── RemoveOpenWithNotepad.reg
├── add2shims.bat
├── args.py
├── assoc-py.cmd
├── bats
│ ├── chrome-me-um.bat
│ ├── dupe-search.bat
│ ├── enable-remote-desktop.bat
│ ├── make-bat-for-py.bat
│ ├── paint.bat
│ ├── printpdf.bat
│ └── search-path.bat
├── cmdline.bat
├── cmdline.py
├── create-leobat.bat
├── cyg-apt.py
├── dezoomify.rb
├── doskey-aliases.txt
├── doskey-reload.bat
├── foobar.py
├── ftype-py-arc10.cmd
├── ftype-py-from-env.cmd
├── get-unc-path.bat
├── install-pip.py
├── micromamba
│ └── install-micromamba.cmd
├── pdf-extract
│ ├── .gitignore
│ ├── Environment.md
│ ├── Extract images from PDF without resampling, in python - Stack Overflow.URL
│ ├── extract-pdf-img-alex.py
│ ├── extract-pdf-img.py
│ └── requirements.txt
├── pdf2jpg
│ ├── bin
│ │ ├── pdf2jpg-all.bat
│ │ ├── pdf2jpg-dir.bat
│ │ ├── pdf2jpg.bat
│ │ └── test-pdf-files.bat
│ ├── pdf2jpg.md
│ └── setenv.bat
├── proj-dir
│ ├── Readme.md
│ ├── scripts
│ │ └── x-help.bat
│ └── setenv.bat
├── psh
│ ├── Microsoft.PowerShell_profile.ps1
│ ├── Update-SessionEnvironment.ps1
│ └── install-winget.ps1
├── remote-install-vnc.bat
├── replace_mspaint_with_paintdotnet.reg
├── replace_notepad_with_LightTable.reg
├── replace_notepad_with_notepad++.reg
├── replace_notepad_with_notepad2.reg
├── rewrite-maphew2mhwgov.sh
├── rewrite-mhwgov2maphew.sh
├── show_ad_group_members.py
├── time_cmd.py
├── win10-start-menu-no-internet-results.reg
├── xx-convert-mov2m4v.bat
├── xx-convert-wma2mp3.bat
└── xxcopy-change-install-date.bat
├── register-python
├── classy-reggie.bat
├── classy-reggie.py
├── list-python-installs.py
├── list-registry.py
├── register-python.bat
├── register-python.py
├── samples
│ ├── hkcu_py-reg_d-drive.reg
│ ├── hklm_o4wpy-reg_23.reg
│ ├── hklm_o4wpy-reg_d-drive.reg
│ ├── hklm_x64_default_install.reg
│ ├── hklm_x64_py27.reg
│ ├── hklm_x64_pyqt4_py27.reg
│ └── py25_x32_default_install.reg
├── switch-python.py
├── walk-registry.py
├── win-specialfolders.py
└── xx-parse.py
├── scrapbook
├── kml2wld.sh
└── tag2semver.py
├── tools
├── Readme.md
└── gitignore_to_fossil.py
└── win-remote-reboot.ps1
/.gitignore:
--------------------------------------------------------------------------------
1 | /other/micromamba/micromamba.tar.bz2
2 |
--------------------------------------------------------------------------------
/.hgignore:
--------------------------------------------------------------------------------
1 | syntax: glob
2 | *.pyc
3 | google-code.txt
4 | *.egg-info
5 |
--------------------------------------------------------------------------------
/Readme.adoc:
--------------------------------------------------------------------------------
1 | = Matt's code thicket
2 |
3 | A sometimes-tended garden of things a _hewer of maps_ has made
4 | and copied that can occasionally be turned to useful work.
5 |
6 |
--------------------------------------------------------------------------------
/apt/Readme.md:
--------------------------------------------------------------------------------
1 | *2014-Oct-24*
2 |
3 | Apt has moved to
4 | [https://github.com/maphew/apt](https://github.com/maphew/apt)
5 |
6 |
--------------------------------------------------------------------------------
/arcplus/AttributedMultiRingBuffer.py:
--------------------------------------------------------------------------------
1 | '''
2 | Moved to https://github.com/maphew/arcplus
3 | '''
4 |
--------------------------------------------------------------------------------
/arcplus/arcgisscripting.py:
--------------------------------------------------------------------------------
1 | ## Here for archival purposes. It's not needed for Arcplus any more.
2 | ## 2010-Aug-11
3 | '''----------------------------------------------------------------------------------
4 | arcgisscripting.py
5 | Version: 0.9.1
6 | Author: Philippe Le Grand
7 | Required Argumuments: None
8 | Description: This module serves to replace ESRI's arcgisscripting.dll
9 | on configurations where it is not available
10 |
11 | arcgisscripting is a custom dll module that is build against the
12 | python24.dll library; you cannot get it to work under python25;
13 | you have to use the old style pywin32 system instead.
14 |
15 | Assuming you have pywin32 installed for python 2.5, the script
16 | below can serve as a wrapper that will allow you to circumvent
17 | the problem. Just save it as arcgisscripting.py in your
18 | pythonpath
19 | -- http://forums.esri.com/Thread.asp?c=93&f=1729&t=216040
20 |
21 |
22 | This script is free software; you can redistribute it and/or modify
23 | it under the terms of the GNU General Public License as published by
24 | the Free Software Foundation; either version 2 of the License, or
25 | (at your option) any later version.
26 |
27 | This program is distributed in the hope that it will be useful,
28 | but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | GNU General Public License for more details.
31 |
32 | A copy of the GNU General Public License may be obtained
33 | online at
34 |
35 | http://www.gnu.org/copyleft/gpl.html
36 |
37 | or by writing to the
38 |
39 | Free Software Foundation, Inc.,
40 | 51 Franklin Street, Fifth Floor,
41 | Boston, MA 02110-1301 USA
42 |
43 | ----------------------------------------------------------------------------------'''
44 |
45 | import win32com.client
46 |
47 | def create(licensetype=None):
48 | gp = win32com.client.Dispatch("esriGeoprocessing.GpDispatch.1")
49 | if licensetype is not None:
50 | Licensed=gp.SetProduct(licensetype)
51 | if not (Licensed in ["NotLicensed","Failed"]):
52 | return gp
53 | #Either the licensetype was not set, or it failed
54 | #Try to get the highest possible license
55 | types = ["ArcInfo","ArcEditor","ArcView"]
56 | for license in types:
57 | Licensed=gp.CheckProduct(license)
58 | if not (Licensed in ["NotLicensed","Failed"]):
59 | Licensed = gp.SetProduct(license)
60 | print "geoprocessor started with license: %s (%s)"%(license,Licensed)
61 | return gp
62 | else:
63 | print "license %s is %s"%(license,Licensed)
64 | gp.AddError("No License available for geoprocessor")
65 | raise ValueError,"No License available for geoprocessor"
66 |
67 | if (__name__=="__main__"):
68 | gp=create()
69 |
70 |
--------------------------------------------------------------------------------
/arcplus/arcplus.py:
--------------------------------------------------------------------------------
1 | #@+leo-ver=5-thin
2 | #@+node:maphew.20120201135209.1859: * @file arcplus.py
3 | ''' arcplus.py: functions missing from regular ol' arcpy module '''
4 |
5 | import os, arcgisscripting
6 | gp = arcgisscripting.create(9.3)
7 |
8 | #@+others
9 | #@+node:maphew.20110208134351.3123: ** list All Feature Classes
10 | def listAllFeatureClasses (gdb,**kwargs):
11 | ''' list all Feature Classes in a geodatabase or coverage recursively (normal listFeatureClasses does not recurse)'''
12 |
13 | gp.workspace = gdb
14 |
15 | if not kwargs.has_key('fc_filter'): fc_filter = '*'
16 | else: fc_filter = kwargs ['fc_filter']
17 |
18 | if not kwargs.has_key('fd_filter'): fd_filter = '*'
19 | else: fd_filter = kwargs ['fd_filter']
20 |
21 | print 'Looking in %s for "%s" ' % (gp.workspace,fc_filter)
22 |
23 | fcs = []
24 | for fds in gp.ListDatasets(fd_filter,'feature') + ['']:
25 | for fc in gp.ListFeatureClasses(fc_filter,'',fds):
26 | #print '%s\\%s' % (fds,fc)
27 | fcs.append(os.path.join(fds,fc))
28 |
29 | return fcs
30 |
31 | #@+node:maphew.20110314104726.3195: *3* extended docstring
32 | '''
33 | Optional keyword arguments, for example:
34 |
35 | fc_filter = 'HD_*', fd_filter = '*Hydro*
36 |
37 | will process only feature classes that start with 'HD_' within feature datasets containing '*Hydro*'
38 |
39 | Thank you Gotchula:
40 | @url http://gis.stackexchange.com/questions/5893/list-all-feature-classes-in-gdb-including-within-feature-datasets
41 | and http://stackoverflow.com/questions/3394835/args-and-kwargs
42 | '''
43 | #@-others
44 | #@-leo
45 |
--------------------------------------------------------------------------------
/arcplus/autocrop.ClipNoData.pyt.xml:
--------------------------------------------------------------------------------
1 |
2 | 20130322084846001.0TRUE20130503143406Clip NoDataArcToolbox Tool
3 |
--------------------------------------------------------------------------------
/arcplus/autocrop.pyt.xml:
--------------------------------------------------------------------------------
1 |
2 | 20130322084845001.0TRUE20130503143405c:\arcgis\desktop10.1\Help\gpautocropArcToolbox Toolbox
3 |
--------------------------------------------------------------------------------
/arcplus/report-versions.py:
--------------------------------------------------------------------------------
1 | r'''
2 | Report ArcGIS Pro's primary library versions
3 | From
4 |
5 |
6 | Locate ArcGIS Pro's python folder with Everything Search CLI:
7 |
8 | es pro-py
9 | --> C:\ArcGIS\bin\Python\envs\arcgispro-py3
10 |
11 | Run:
12 | C:\ArcGIS\bin\Python\envs\arcgispro-py3\python.exe path\to\arcplus\report-versions.py
13 |
14 | --> python: 3.9.16 [MSC v.1931 64 bit (AMD64)]
15 | matplotlib 3.6.0
16 | numpy: 1.20.1
17 | scipy: 1.6.2
18 | '''
19 | import sys
20 | import matplotlib
21 | import numpy
22 | import scipy
23 | print(f'python:\t\t{sys.version}')
24 | print(f'matplotlib:\t{matplotlib.__version__}')
25 | print(f'numpy:\t\t{numpy.__version__}')
26 | print(f'scipy:\t\t{scipy.__version__}')
27 |
--------------------------------------------------------------------------------
/arcplus/xx-calc-trans.py:
--------------------------------------------------------------------------------
1 | #@+leo-ver=5-thin
2 | #@+node:maphew.20120203103945.1813: * @file xx-calc-trans.py
3 | ''' scratchpad file: test out ideas for how to calculate transparency percentage of each ring buffer given approximate start and end values.
4 | '''
5 | ring_width = 1000 # width of each buffer ring
6 | num_rings = 7 # total number of rings to create
7 | darkest = 50 # uppermost layer transparency %
8 | lightest = 80 # lowermost layer transparency %
9 |
10 | first_ring = ring_width # 1000
11 |
12 | #@+others
13 | #@+node:maphew.20120203121800.1759: ** get_transparency_dict
14 | def get_transparency_dict(darkest, lightest, steps):
15 | '''build dictionary of transparency percentages with specified number of steps
16 | Returns {0:50, 1:55, 2:60 ...}'''
17 | transparency_dict = {}
18 | stepsize = (lightest - darkest) / steps # percent to lighten/darken each ring
19 | for e,i in enumerate(range(darkest, lightest, stepsize)):
20 | # print "Ring #",e+1, "transparency is", i
21 | transparency_dict[e + 1] = i
22 | return transparency_dict
23 | #@-others
24 |
25 | transparency_dict = get_transparency_dict(darkest, lightest, num_rings)
26 |
27 | import arcpy
28 |
29 | wspace = 'd:/s/default.gdb'
30 | in_fc = 'FNTT'
31 | out_fc = in_fc + '_buffers'
32 | num_rings = 7
33 | ring_width = 1000
34 | ring_type = 'INSIDE'
35 |
36 | sideType = "OUTSIDE_ONLY"
37 | endType = "ROUND"
38 | dissolveType = "LIST"
39 | dissolveFields = "NAME;TYPE" # attributes we want to keep, adjust as needed
40 |
41 | arcpy.env.workspace = wspace
42 |
43 | buffered_fcs = []
44 | for current_ring in range(1, num_rings + 1):
45 | transparency = transparency_dict[current_ring]
46 | width = str(ring_width * current_ring)
47 | buf_fc = arcpy.ValidateTableName('xxx_' + out_fc + width)
48 |
49 | print "...Buffer #{0:2d} width {1} transparency {2}".format(current_ring, width, transparency)
50 |
51 | if ring_type == 'INSIDE':
52 | arcpy.Buffer_analysis(in_fc, buf_fc, '-'+width, sideType, endType, dissolveType, dissolveFields)
53 | else:
54 | arcpy.Buffer_analysis(in_fc, buf_fc, width, sideType, endType, dissolveType, dissolveFields)
55 |
56 | # store buffer width as attribute value
57 | arcpy.AddField_management(buf_fc, 'Width', "TEXT", "", "", 16)
58 | arcpy.CalculateField_management(buf_fc, 'Width', width, "PYTHON")
59 |
60 | # store transparency also
61 | arcpy.AddField_management(buf_fc, 'Transparency', "SHORT")
62 | arcpy.CalculateField_management(buf_fc, 'Transparency', transparency, "PYTHON")
63 |
64 | buffered_fcs.append(buf_fc)
65 |
66 | # arrange buffers from largest to smallest width
67 | # so the draw order is correct after merging
68 | buffered_fcs.sort()
69 | buffered_fcs.reverse()
70 |
71 | print("...Merging intermediate buffers into {0}".format(out_fc))
72 | arcpy.Merge_management(buffered_fcs, out_fc)
73 |
74 | # remove temporary intermediate files
75 | print("...Removing intermediate files")
76 | for fc in arcpy.ListFeatureClasses('xxx_*'):
77 | arcpy.Delete_management(fc)
78 | #@-leo
79 |
--------------------------------------------------------------------------------
/gis/AliasFeatureclassConversion.py:
--------------------------------------------------------------------------------
1 | import ConversionUtils, time
2 |
3 | ConversionUtils.gp.Overwriteoutput = 1
4 |
5 | #Define message constants so they may be translated easily
6 | msgErrorInvalidOutPath = "Output path does not exist"
7 | msgSuccess = "successfully converted to "
8 | msgFailed = "Failed to convert "
9 |
10 | # Argument 1 is the list of feature classes to be converted
11 | inFeatureClasses = ConversionUtils.gp.GetParameterAsText(0)
12 |
13 | # The list is split by semicolons ";"
14 | inFeatureClasses = ConversionUtils.SplitMultiInputs(inFeatureClasses)
15 |
16 | # The output workspace where the shapefiles are created
17 | outWorkspace = ConversionUtils.gp.GetParameterAsText(1)
18 |
19 | # Set the destination workspace parameter (which is the same value as the output workspace)
20 | # the purpose of this parameter is to allow connectivity in Model Builder.
21 | ConversionUtils.gp.SetParameterAsText(2,outWorkspace)
22 |
23 | # Set the progressor
24 | ConversionUtils.gp.SetProgressor("step", "Converting multiple feature classes ...", 0, len(inFeatureClasses))
25 |
26 | # Loop through the list of input feature classes and convert/copy each to the output geodatabase or folder
27 | for inFeatureClass in inFeatureClasses:
28 | try:
29 | # Set the progressor label
30 | ConversionUtils.gp.SetProgressorLabel("Converting " + inFeatureClass)
31 |
32 | # Generate a valid output output name
33 | outFeatureClass = ConversionUtils.GenerateOutputName(inFeatureClass, outWorkspace)
34 |
35 | # Copy/Convert the inFeatureClasses to the outFeatureClasses
36 | ConversionUtils.CopyFeatures(inFeatureClass, outFeatureClass)
37 |
38 | # If the Copy/Convert was successfull add a message stating this
39 | ConversionUtils.gp.AddMessage("%s %s %s" % (inFeatureClass, msgSuccess, outFeatureClass))
40 |
41 | except Exception, ErrorDesc:
42 | # Except block for the loop. If the tool fails to convert one of the feature classes, it will come into this block
43 | # and add warnings to the messages, then proceed to attempt to convert the next input feature class.
44 | msgWarning = msgFailed + "%s" % inFeatureClass
45 | msgStr = ConversionUtils.gp.GetMessages(2)
46 | ConversionUtils.gp.AddWarning(ConversionUtils.ExceptionMessages(msgWarning, msgStr, ErrorDesc))
47 |
48 | ConversionUtils.gp.SetProgressorPosition()
49 |
50 | time.sleep(0.5)
51 |
--------------------------------------------------------------------------------
/gis/Tango-Palette.gpl:
--------------------------------------------------------------------------------
1 | GIMP Palette
2 | Name: Tango icons
3 | Columns: 3
4 | #
5 | 252 233 79 Butter 1
6 | 237 212 0 Butter 2
7 | 196 160 0 Butter 3
8 | 138 226 52 Chameleon 1
9 | 115 210 22 Chameleon 2
10 | 78 154 6 Chameleon 3
11 | 252 175 62 Orange 1
12 | 245 121 0 Orange 2
13 | 206 92 0 Orange 3
14 | 114 159 207 Sky Blue 1
15 | 52 101 164 Sky Blue 2
16 | 32 74 135 Sky Blue 3
17 | 173 127 168 Plum 1
18 | 117 80 123 Plum 2
19 | 92 53 102 Plum 3
20 | 233 185 110 Chocolate 1
21 | 193 125 17 Chocolate 2
22 | 143 89 2 Chocolate 3
23 | 239 41 41 Scarlet Red 1
24 | 204 0 0 Scarlet Red 2
25 | 164 0 0 Scarlet Red 3
26 | 238 238 236 Aluminium 1
27 | 211 215 207 Aluminium 2
28 | 186 189 182 Aluminium 3
29 | 136 138 133 Aluminium 4
30 | 85 87 83 Aluminium 5
31 | 46 52 54 Aluminium 6
32 |
--------------------------------------------------------------------------------
/gis/canvec/Using CanVec at Musings.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Version=1.0
3 | Encoding=UTF-8
4 | Name=Link to Using CanVec at Musings
5 | Type=Link
6 | URL=http://www.uttara.ca/blog/gis/using-canvec
7 | Icon=gnome-fs-bookmark
8 |
--------------------------------------------------------------------------------
/gis/canvec/db-friendly-names.txt:
--------------------------------------------------------------------------------
1 | Database Name Friendly Name
2 | BS_1250009 Navigational aid
3 | BS_1370009 Residential area
4 | BS_2000009 Parabolic antenna
5 | BS_2010009 Building
6 | BS_2060009 Chimney
7 | BS_2080009 Tank
8 | BS_2120009 Cross
9 | BS_2230009 Transmission line
10 | BS_2240009 Wall or fence
11 | BS_2310009 Pipeline (Sewage or liquid waste)
12 | BS_2350009 Well
13 | BS_2380009 Underground reservoir
14 | BS_2440009 Silo
15 | BS_2530009 Tower
16 | EN_1120009 Power transmission line
17 | EN_1180009 Pipeline
18 | EN_1340009 Valve
19 | EN_1360049 Gas and oil facilities
20 | EN_1360059 Transformer station
21 | EN_2170009 Wind-operated device
22 | FO_1030009 Contour
23 | FO_1080019 Landform
24 | FO_1080029 Esker
25 | FO_1080039 Glacial debris undifferentiated
26 | FO_1080049 Moraine
27 | FO_1080059 Sand
28 | FO_1080069 Tundra polygon
29 | FO_1080079 Pingo
30 | FO_1200009 Elevation point
31 | FO_2570009 Contour imperial
32 | FO_2610009 Elevation point imperial
33 | HD_1140009 Permanent snow and ice
34 | HD_1150009 Coastal water
35 | HD_1450009 Manmade hydrographic entity
36 | HD_1460009 Hydrographic obstacle entity
37 | HD_1470009 Single line watercourse
38 | HD_1480009 Waterbody
39 | HD_1490009 Island
40 | IC_1350019 Pit
41 | IC_1350029 Quarry
42 | IC_1350039 Extraction area
43 | IC_1350049 Mine
44 | IC_1350059 Peat cutting
45 | IC_1360019 Domestic waste
46 | IC_1360029 Industrial solid waste
47 | IC_1360039 Industrial and commercial area
48 | IC_2110009 Lumber yard
49 | IC_2360009 Auto wrecker
50 | IC_2600009 Mining area
51 | LI_1210009 NTS50K boundary polygon
52 | LX_1000019 Lookout
53 | LX_1000029 Ski centre
54 | LX_1000039 Cemetery
55 | LX_1000049 Fort
56 | LX_1000059 Designated area
57 | LX_1000069 Marina
58 | LX_1000079 Sports track or Race track
59 | LX_1000089 Golf course
60 | LX_2030009 Camp
61 | LX_2070009 Drive-in theatre
62 | LX_2200009 Botanical garden
63 | LX_2210009 Shrine
64 | LX_2220009 Historical site or Point of interest
65 | LX_2260009 Amusement park
66 | LX_2270009 Park or sports field
67 | LX_2280009 Footbridge
68 | LX_2400009 Ruins
69 | LX_2420009 Trail
70 | LX_2460009 Stadium
71 | LX_2480009 Campground
72 | LX_2490009 Picnic site
73 | LX_2500009 Golf drining range
74 | LX_2510009 Exhibition ground
75 | LX_2560009 Zoo
76 | SS_1320019 Tundra pond
77 | SS_1320029 Palsa bog
78 | SS_1320039 Saturated soil
79 | SS_1320049 Wetland
80 | SS_1320059 String bog
81 | TO_2520009 Toponym
82 | TR_1020009 Railway
83 | TR_1190009 Runway
84 | TR_1750009 Ferry connection segment [GeoBase]
85 | TR_1760009 Road segment [GeoBase]
86 | TR_1770009 Junction [GeoBase]
87 | TR_1780009 Blocked passage [GeoBase]
88 | TR_1790009 Toll point [GeoBase]
89 | TR_2320009 Turntable
90 | VE_1240009 Wooded area
91 | VE_2290009 Cut line
92 |
--------------------------------------------------------------------------------
/gis/canvec/download-yukon-gml.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | :: rev 0.1, 2007 May 02, maphew@gmail.com
3 | echo.
4 | echo. Going to download 1:50,000 CanVec data for Yukon as GML, which could
5 | echo. take awhile. This script can be aborted and rerun, it will resume
6 | echo. where it left off.
7 | echo.
8 | setlocal
9 |
10 | call :ChkReqs wget.exe
11 | goto :EOF
12 |
13 | :ChkReqs
14 | :: test for wget, if it is in path we can carry on.
15 | if exist "%~$PATH:1" (
16 | call :Download ) else (
17 | echo %1 not found! can't continue
18 | )
19 | goto :EOF
20 |
21 | :Download
22 | set urlRoot=ftp://ftp2.cits.rncan.gc.ca/pub/canvec/50k_gml
23 |
24 | :: Change these NTS numbers as required for your area of interest
25 | set QuadList=115 105 095 106 116 117 114 094 104
26 |
27 | for %%a in (%QuadList%) do (
28 | wget --recursive --continue --level=3 --no-host-directories --cut-dirs=2 %urlRoot%/%%a/*
29 | )
30 | goto :EOF
31 |
--------------------------------------------------------------------------------
/gis/canvec/gml2shp.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | :: Merge all gml files in specified directory to shapefiles, with optional OGR parameters
3 | ::
4 | if "%2" =="" goto :Usage
5 |
6 | :: Handle command line arguments,
7 | :: kudos to Patrick Cuff - http://stackoverflow.com/questions/382587
8 | for /f "tokens=1-3*" %%a in ("%*") do (
9 | set srcDir=%1
10 | set outDir=%2
11 | set arg3=%%c
12 | set argTheRest=%%d
13 | )
14 |
15 | set ogrArgs= -f "esri shapefile"
16 |
17 | :: OGR parameters to project from NAD83CSRS to Yukon Albers
18 | set yt_alb="+proj=aea +lat_1=61.66666666666666 +lat_2=68.0 +lat_0=59.0 +lon_0=-132.5 +x_0=500000 +y_0=500000 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"
19 |
20 | if "%arg3%"=="yukon" (
21 | set ogrArgs=%ogrArgs% -s_srs epsg:4617 -t_srs %yt_alb% ) else (
22 | set ogrArgs=%ogrArgs% %argTheRest%
23 | )
24 |
25 | call :Main
26 | goto :EOF
27 |
28 | :Main
29 | pushd %srcDir%
30 | for %%f in (*.gml) do (
31 | echo Processing %%f
32 | REM convert from GML to SHP and merge
33 | if not exist [%outDir%] (call :New %%f) else (call :Append %%f)
34 | )
35 | popd
36 | goto :EOF
37 |
38 | :New
39 | echo ogr2ogr %ogrArgs% %outDir% %1
40 | ogr2ogr %ogrArgs% -append %outDir% %1
41 | goto :eof
42 |
43 | :Append
44 | echo ogr2ogr %ogrArgs% -update -append %outDir% %1
45 | ogr2ogr %ogrArgs% -update -append %outDir% %1
46 | goto :eof
47 |
48 | :Usage
49 | echo.
50 | echo. Usage: %~n0 [path\to\*.gml] [output dir] {ogr arguments}
51 | echo.
52 |
--------------------------------------------------------------------------------
/gis/canvec/gml2shp_friendly_layers.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | setlocal enabledelayedexpansion
3 |
4 | if [%2] ==[] goto :Usage
5 |
6 | set _inFile=%1
7 | set _outDir=%2
8 |
9 | set _yt_alb="+proj=aea +lat_1=61_66666666666666 +lat_2=68_0 +lat_0=59_0 +lon_0=-132_5 +x_0=500000 +y_0=500000 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"
10 | set _opt=-s_srs epsg:4617 -t_srs %_yt_alb%
11 |
12 | :Main
13 | for /f "skip=1 tokens=1,2*" %%g in (bin\db-friendly-names.txt) do (
14 | set inLayer=%%g
15 | set outLayer=%%h %%i
16 |
17 | echo Processing "%_inFile%"
18 | if not exist "%_outDir%\!outLayer!*" (
19 | echo ogr2ogr -append %_opt% -nln "!outLayer!" %_outdir% "%_inFile%" !inLayer!
20 | ogr2ogr -append %_opt% -nln "!outLayer!" %_outdir% "%_inFile%" !inLayer!) else (
21 | rem echo___ogr2ogr -update -append %opt% -nln "!outLayer!" %outdir% %inFile% !inLayer!
22 | ogr2ogr -update -append -nln "!outLayer!" "%_outdir%" "%_inFile%" !inLayer! %_opt%
23 | )
24 |
25 | )
26 | goto :eof
27 |
28 | :Usage
29 | echo_
30 | echo_ Usage: %~n0 [path\to\*_gml] [output dir] {optional ogr arguments}
31 | echo_
32 |
--------------------------------------------------------------------------------
/gis/canvec/unpack-canvec-zips.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | echo.
3 | echo. Unpack downloaded CanVec files for area of interest.
4 | echo.
5 |
6 | :: Set to 1:50,000 NTS numbers for area of interest
7 | set tileList=116b14 116b15 116b16 116a13 116b11 116b10 116b09 116a12 116b06 116b07 116b08 116a05 116b03 116b02 116b01 116a04
8 |
9 | if "%2" == "" goto :Usage
10 |
11 | set xsrc=%1
12 | set dst=%2
13 | set _home=%cd%
14 |
15 | if not exist %dst% mkdir %dst%
16 |
17 | call :unZip
18 | call :Organise
19 | goto :EOF
20 |
21 | :UnZip
22 | for %%f in (%tileList%) do (
23 | for /f "tokens=*" %%a in ('dir /s/b %src%\*%%f*') do unzip -n -d %dst% %%a
24 | )
25 | goto :EOF
26 |
27 | :Organise
28 | :: put all docs & metadata into it's own folder
29 | cd %dst%
30 | mkdir meta
31 | for %%f in (*.html *.txt *.xml *.xsd) do move %%f meta
32 | cd %_home%
33 | goto :EOF
34 |
35 | :Usage
36 | echo.
37 | echo. Usage: %~n0 [path\to\canvec_archives] [output dir]
38 | echo.
39 |
40 |
--------------------------------------------------------------------------------
/gis/gdal_extras/Readme.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/maphew/mhwcode/5dadd78280fd20b5280727017624a269c80aeac3/gis/gdal_extras/Readme.txt
--------------------------------------------------------------------------------
/gis/gdal_extras/bin/fortiff.cmd:
--------------------------------------------------------------------------------
1 | for %%a in (*.tif) do %*
2 |
--------------------------------------------------------------------------------
/gis/gdal_extras/bin/gdal-help.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | echo.
3 | if [%GDAL_DATA%]==[] goto :NoGDAL
4 |
5 | gdalinfo --version
6 |
7 | echo. & echo Available exe commands: & echo.
8 | dir /d %GDAL_DATA%\..\bin\*.exe |find ".exe"
9 | echo. & echo Available python commands: & echo.
10 | dir /d %GDAL_DATA%\..\bin\*.py |find ".py"
11 |
12 | goto :EOF
13 |
14 | :NoGDAL
15 | echo ERROR: GDAL environment not set
16 | echo.
17 |
--------------------------------------------------------------------------------
/gis/gdal_extras/bin/gdalcopyproj.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # ******************************************************************************
3 | # $Id$
4 | #
5 | # Name: gdalcopyproj.py
6 | # Project: GDAL Python Interface
7 | # Purpose: Duplicate the geotransform and projection metadata from
8 | # one raster dataset to another, which can be useful after
9 | # performing image manipulations with other software that
10 | # ignores or discards georeferencing metadata.
11 | # Author: Schuyler Erle, schuyler@nocat.net
12 | #
13 | # ******************************************************************************
14 | # Copyright (c) 2005, Frank Warmerdam
15 | #
16 | # Permission is hereby granted, free of charge, to any person obtaining a
17 | # copy of this software and associated documentation files (the "Software"),
18 | # to deal in the Software without restriction, including without limitation
19 | # the rights to use, copy, modify, merge, publish, distribute, sublicense,
20 | # and/or sell copies of the Software, and to permit persons to whom the
21 | # Software is furnished to do so, subject to the following conditions:
22 | #
23 | # The above copyright notice and this permission notice shall be included
24 | # in all copies or substantial portions of the Software.
25 | #
26 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
27 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
29 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
31 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
32 | # DEALINGS IN THE SOFTWARE.
33 | # ******************************************************************************
34 | #
35 | # $Log$
36 | try:
37 | from osgeo import gdal
38 | except ImportError:
39 | import gdal
40 |
41 | import sys
42 | import os.path
43 |
44 | if len(sys.argv) < 3:
45 | print("Usage: gdalcopyproj.py source_file dest_file")
46 | sys.exit(1)
47 |
48 | input = sys.argv[1]
49 | dataset = gdal.Open(input)
50 | if dataset is None:
51 | print("Unable to open", input, "for reading")
52 | sys.exit(1)
53 |
54 | projection = dataset.GetProjection()
55 | geotransform = dataset.GetGeoTransform()
56 |
57 | if projection is None and geotransform is None:
58 | print("No projection or geotransform found on file" + input)
59 | sys.exit(1)
60 |
61 | output = sys.argv[2]
62 | dataset2 = gdal.Open(output, gdal.GA_Update)
63 |
64 | if dataset2 is None:
65 | print("Unable to open", output, "for writing")
66 | sys.exit(1)
67 |
68 | if geotransform is not None:
69 | dataset2.SetGeoTransform(geotransform)
70 |
71 | if projection is not None:
72 | dataset2.SetProjection(projection)
73 |
--------------------------------------------------------------------------------
/gis/gdal_extras/bin/gdalsetnull.py:
--------------------------------------------------------------------------------
1 | #@+leo-ver=5-thin
2 | #@+node:maphew.20100601093031.2394: * @file gdalsetnull.py
3 | #@@language python
4 | #@@tabwidth -4
5 | #@+<>
6 | #@+node:maphew.20100601093031.2403: ** <>> and license
7 | #!/usr/bin/env python
8 | #******************************************************************************
9 | # $Id: gdalsetnull.py 2008-07-08 maphew $
10 | #
11 | # Project: GDAL
12 | # Purpose: Simple command line program to set speficied raster value NODATA,
13 | # without creating a new raster.
14 | # Author: Matt Wilkie, maphew@gmail.com
15 | #
16 | #******************************************************************************
17 | # Copyright (c) 2000, Frank Warmerdam
18 | #
19 | # Permission is hereby granted, free of charge, to any person obtaining a
20 | # copy of this software and associated documentation files (the "Software"),
21 | # to deal in the Software without restriction, including without limitation
22 | # the rights to use, copy, modify, merge, publish, distribute, sublicense,
23 | # and/or sell copies of the Software, and to permit persons to whom the
24 | # Software is furnished to do so, subject to the following conditions:
25 | #
26 | # The above copyright notice and this permission notice shall be included
27 | # in all copies or substantial portions of the Software.
28 | #
29 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
30 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
32 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
34 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
35 | # DEALINGS IN THE SOFTWARE.
36 | #******************************************************************************
37 | #@-<>
38 | #@+<>
39 | #@+node:maphew.20100601093031.2402: ** <>
40 | import sys
41 | import os.path
42 | try:
43 | from osgeo import gdal
44 | except ImportError:
45 | import gdal
46 | #@-<>
47 | #@+others
48 | #@+node:maphew.20100601093031.2401: ** usage
49 | if len(sys.argv) < 2:
50 | print "Usage: gdalsetnull.py raster_file null_value {null band2} {null band3} ..."
51 | sys.exit(1)
52 | #@+node:maphew.20100601093031.2400: ** Main
53 | input = sys.argv[1]
54 | null_value = sys.argv[2]
55 |
56 | dataset = gdal.Open( input, gdal.GA_Update )
57 | if dataset is None:
58 | print 'Unable to open', input, 'for writing'
59 | sys.exit(1)
60 |
61 | for band_num in range(1, dataset.RasterCount+1):
62 | band = dataset.GetRasterBand(band_num)
63 | print 'Initial nodata for band %s \t %s' % (band_num,band.GetNoDataValue() )
64 |
65 | # the 2nd commandline argument is for band#1, arg3 for band2, etc.
66 | arg_num = band_num + 1
67 | # optionally set different nodata values for each bands
68 | if arg_num > 2:
69 | if sys.argv[arg_num]:
70 | null_value = sys.argv[band_num]
71 |
72 | # FIXME: handle case where we want to remove nodata altogether (change to 'None')
73 | band.SetNoDataValue( float(null_value) )
74 |
75 | print 'Output nodata for band %s \t %s' % (band_num,band.GetNoDataValue() )
76 | #@-others
77 | #@-leo
78 |
--------------------------------------------------------------------------------
/gis/gdal_extras/gdal-extras-install.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | :: there are few things which are not included in the default fwtools install which I always need to add later.
3 | if %GDAL_DATA%=="" goto :NotGdalShell
4 | if %FWTOOLS_DIR%=="" goto :NotGdalShell
5 | setlocal
6 |
7 | :: remember where we started from
8 | set rememberCD=%cd%
9 |
10 | :: Root gdal_exrtas home dir to the same directory this script exists in
11 | set gd-extras=%~dp0
12 | :: Rmove trailing backslash
13 | set gd-extras=%gd-extras:~0,-1%
14 | echo gdal_extras home is %gd-extras% & echo.
15 |
16 |
17 | :: copy each of the files in bin and data to gdal, but only if they don't exist already
18 | :Bin
19 | cd /d %gd-extras%\bin
20 | for %%a in (*) do (
21 | if not exist "%FWTOOLS_DIR%\bin\%%~nxa" copy "%%a" "%FWTOOLS_DIR%\bin\%%~nxa"
22 | )
23 | :Data
24 | cd /d %gd-extras%\data
25 | for %%a in (*) do (
26 | if not exist "%FWTOOLS_DIR%\data\%%~nxa" copy "%%a" "%FWTOOLS_DIR%\data\%%~nxa"
27 | )
28 | :Tools
29 | cd /d %gd-extras%\tools
30 | for %%a in (*) do (
31 | if not exist "%FWTOOLS_DIR%\tools\%%~nxa" copy "%%a" "%FWTOOLS_DIR%\tools\%%~nxa"
32 | )
33 | goto skip
34 |
35 | :Combined
36 | for %%b in (bin, data, tools, pics) do (
37 | cd /d %gd-extras%\%%b
38 | for %%a in (*) do (
39 | if not exist "%FWTOOLS_DIR%\%%b\%%~nxa" copy "%%a" "%FWTOOLS_DIR%\%%b\%%~nxa"
40 | )
41 | )
42 |
43 | :skip
44 | :: for fwtools on a portable device
45 | copy /-y %gd-extras%\setfw_portable.cmd %FWTOOLS_DIR%\
46 |
47 | :: change gdal_SDE_92.dll to match version of SDE (e.g. 9.1 or 9.2)
48 | rem copy /-y %gd-extras%\gdal_plugins\gdal_SDE_91.dll %FWTOOLS_DIR%\gdal_plugins\gdal_SDE.dll
49 |
50 | :: Add Yukon Albers (epsg:3578) to projection list (won't be needed after next epsg update)
51 | rem type %gd-extras%\proj_lib\yukon_albers.epsg >> %PROJ_LIB%\epsg
52 |
53 | :Samples
54 | ::: create a batch file to run each of the samples.
55 | cd /d %FWTOOLS_DIR%\bin
56 | for %%a in (*.py) do (
57 | if not exist %%~na.bat echo @python "%%FWTOOLS_DIR%%\bin\%%a" %%* > %%~na.bat
58 | )
59 |
60 | cd /d %rememberCD%
61 | goto :EOF
62 |
63 | :NotGdalShell
64 | echo.
65 | echo. Error! GDAL_DATA and/or FWTOOLS_DIR environment is not set
66 | echo. Are you sure this is an FWTools or GDAL shell?
67 | echo.
68 | goto :EOF
69 |
--------------------------------------------------------------------------------
/gis/gdal_extras/gdal_plugins/gdal_SDE_91.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/maphew/mhwcode/5dadd78280fd20b5280727017624a269c80aeac3/gis/gdal_extras/gdal_plugins/gdal_SDE_91.dll
--------------------------------------------------------------------------------
/gis/gdal_extras/gdal_plugins/gdal_SDE_92.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/maphew/mhwcode/5dadd78280fd20b5280727017624a269c80aeac3/gis/gdal_extras/gdal_plugins/gdal_SDE_92.dll
--------------------------------------------------------------------------------
/gis/gdal_extras/pics/bcg_tool.xpm:
--------------------------------------------------------------------------------
1 | /* XPM */
2 | static char * bcg_tool_xpm[] = {
3 | "22 22 66 1",
4 | " c None",
5 | ". c #000000",
6 | "+ c #474747",
7 | "@ c #E3E3E3",
8 | "# c #FAFAFA",
9 | "$ c #FDFDFD",
10 | "% c #F9F9F9",
11 | "& c #D3D3D3",
12 | "* c #434343",
13 | "= c #B7B7B7",
14 | "- c #FCFCFC",
15 | "; c #F7F7F7",
16 | "> c #F6F6F6",
17 | ", c #D7D7D7",
18 | "' c #959595",
19 | ") c #B0B0B0",
20 | "! c #F5F5F5",
21 | "~ c #A1A1A1",
22 | "{ c #4D4D4D",
23 | "] c #1E1E1E",
24 | "^ c #F2F2F2",
25 | "/ c #F3F3F3",
26 | "( c #F4F4F4",
27 | "_ c #D1D1D1",
28 | ": c #909090",
29 | "< c #414141",
30 | "[ c #F8F8F8",
31 | "} c #F1F1F1",
32 | "| c #6D6D6D",
33 | "1 c #262626",
34 | "2 c #606060",
35 | "3 c #323232",
36 | "4 c #D0D0D0",
37 | "5 c #333333",
38 | "6 c #9F9F9F",
39 | "7 c #353535",
40 | "8 c #010101",
41 | "9 c #ECECEC",
42 | "0 c #A3A3A3",
43 | "a c #585858",
44 | "b c #C2C2C2",
45 | "c c #484848",
46 | "d c #454545",
47 | "e c #4C4C4C",
48 | "f c #2B2B2B",
49 | "g c #5B5B5B",
50 | "h c #C8C8C8",
51 | "i c #E2E2E2",
52 | "j c #A0A0A0",
53 | "k c #181818",
54 | "l c #A4A4A4",
55 | "m c #FBFBFB",
56 | "n c #6F6F6F",
57 | "o c #0A0A0A",
58 | "p c #B2B2B2",
59 | "q c #3C3C3C",
60 | "r c #070707",
61 | "s c #D2D2D2",
62 | "t c #888888",
63 | "u c #9A9A9A",
64 | "v c #E8E8E8",
65 | "w c #EBEBEB",
66 | "x c #CDCDCD",
67 | "y c #D9D9D9",
68 | "z c #D6D6D6",
69 | "A c #ACACAC",
70 | " ",
71 | " ",
72 | " ",
73 | " ...... ",
74 | " .+@#$$%&*. ",
75 | " .=-#;>>>>,'. ",
76 | " .)#!~{]^//(_:. ",
77 | " <[}|123//(((45 ",
78 | " .,;67238/(!!>90. ",
79 | " .(^a23..(!!>>;b. ",
80 | " .%}cd...!!>>;;_. ",
81 | " .(^ef...!>>;;[&. ",
82 | " .;^g58..>>;;[%h. ",
83 | " .i(j1k..>;[[%}l. ",
84 | " +m!no..;[[%%b5 ",
85 | " .p%>jqr[[%%st. ",
86 | " .uv[;[[>wxt. ",
87 | " .q=,yz4A5. ",
88 | " ...... ",
89 | " ",
90 | " ",
91 | " "};
92 |
--------------------------------------------------------------------------------
/gis/gdal_extras/proj_lib/yukon_albers.epsg:
--------------------------------------------------------------------------------
1 | # Yukon_Albers_NAD83
2 | <3578> +proj=aea +lat_1=61.66666666667 +lat_2=68.0 +lat_0=59.0 +lon_0=-132.5 +x_0=500000 +y_0=500000 +ellps=GRS80 +datum=NAD83 +units=m
3 |
--------------------------------------------------------------------------------
/gis/gdal_extras/setfw_portable.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 | :: A simple script to allow one to use FWTools for Windows from a USB device
3 | :: without installing anything on the host.
4 | ::
5 | :: Save with .cmd extension to ensure command.com is not used (a hold over
6 | :: from Win9x). The script will only work on Windows 2000 and newer.
7 | ::
8 | :: Initial version 2007 Feb 16, Matt Wilkie (maphew@gmail.com) [mhw]
9 | :: 2007-OCt-25 [mhw] added missing call for setfwenv.bat, (thanks to Farley Klotz)
10 |
11 | if not %cmdextversion% GEQ 2 goto :WrongCmd
12 |
13 | :Main
14 | cls & echo.
15 | rem Root fwtools home dir to the same directory this script exists in
16 | set FWTOOLS_DIR=%~dp0
17 | rem Rmove trailing backslash
18 | set FWTOOLS_DIR=%FWTOOLS_DIR:~0,-1%
19 | echo FWTools home is %FWTOOLS_DIR% & echo.
20 |
21 | rem Add fwtools bin directory to path and make sure gdal is there.
22 | for %%a in (gdalinfo.exe) do (
23 | if [%%~dp$PATH:a]==[] path=%FWTOOLS_DIR%\bin;%PATH%
24 | )
25 | gdalinfo --version || goto :NotFound
26 |
27 | rem Configure environment for python modules, proj lib data, drivers, etc.
28 | call %FWTOOLS_DIR%\bin\setfwenv.bat
29 |
30 | rem Add local preferences (e.g. for "--config" parameters)
31 | rem For 'gdaladdo', use external pyramids in .aux file
32 | set USE_RRD=YES
33 | rem Up the default amount of memory used
34 | set GDAL_CACHEMAX=512
35 |
36 | rem Remember the yukon albers projection parameters.
37 | set ytalbers="+proj=aea +lat_1=61.66666666666666 +lat_2=68 +lat_0=59 +lon_0=-132.5 +x_0=500000 +y_0=500000 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"
38 |
39 | rem List available commands
40 | echo. & echo Available exe commands are: & echo.
41 | dir /d %FWTOOLS_DIR%\bin\*.exe |find ".exe"
42 | echo. & echo Available python commands are: & echo.
43 | dir /d %FWTOOLS_DIR%\bin\*.py |find ".py"
44 |
45 | goto :EOF
46 |
47 | :WrongCmd
48 | echo.
49 | echo Sorry, this script requires CMD.exe with extension
50 | echo version 2 or above (Windows 2000 or later)
51 | echo.
52 | echo Yours appears to be: %CMDEXTVERSION%
53 | echo.
54 | goto :EOF
55 |
56 | :NotFound
57 | echo.
58 | echo Sorry, I can't find GDAL Utilities
59 | echo.
60 |
--------------------------------------------------------------------------------
/gis/geobase/Automatic download and conversion of Geobase Road Network at Musings.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Version=1.0
3 | Encoding=UTF-8
4 | Name=Link to Automatic download and conversion of Geobase Road Network at Musings
5 | Type=Link
6 | URL=http://www.uttara.ca/blog/gis/automatic-download-and-conversion-of-geobase-road-network
7 | Icon=gnome-fs-bookmark
8 |
--------------------------------------------------------------------------------
/gis/geobase/nrn2yukon.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | :: rev 0.1 ~ 2007 Nov 10, Matt Wilkie - maphew@gmail.com
3 | echo.
4 | echo. Going to download National Road Network files from Geobase
5 | echo. for Yukon and adjacent regions.
6 | echo. When finished downloading I will attempt to unpack the archives
7 | echo. and project the data to Yukon Albers, in shapefiles.
8 | echo.
9 | echo.
10 | setlocal
11 |
12 | call :ChkReqs wget.exe
13 | call :Unpack
14 | call :gml2shp
15 | goto :EOF
16 |
17 | :ChkReqs
18 | :: test for wget, if it is in path we can carry on.
19 | if exist “%~$PATH:1″ (
20 | call :D ownload ) else (
21 | echo %1 not found! can’t continue
22 | )
23 | goto :EOF
24 |
25 | :Download
26 | set urlRoot=http://ftp2.cits.rncan.gc.ca/pub/geobase/official/nrn_rrn/
27 |
28 | :: Regions to download (ab = alberta, etc.)
29 | set regions=yt nt bc ab
30 |
31 | :: gml or shapefiles?
32 | set type=gml
33 | rem set type=shp
34 |
35 | if not exist zips mkdir zips
36 | cd zips
37 | for %%a in (%regions%) do (
38 | wget –continue %urlRoot%/%%a/nrn_rrn_%%a_%type%_en.zip
39 | )
40 | cd ..
41 |
42 | goto :EOF
43 |
44 | :Unpack
45 | :: FIXME: chkreq is hardcoded to download on successful check
46 | rem call :ChkReqs 7z.exe
47 | if not exist unpack mkdir unpack
48 | cd unpack
49 | 7z x ..\zips\*.zip
50 | cd ..
51 |
52 | echo.
53 | echo. Finished unpacking.
54 | echo.
55 | goto :EOF
56 |
57 | :gml2shp
58 | echo.
59 | echo. Now I’m going to convert from GML to shapefile,
60 | echo. and project to Yukon Albers in the process.
61 | echo. This could take awhile.
62 | echo.
63 |
64 | :: projection parameters. Example is of NAD83CSRS in lat-long to NAD83 Yukon Albers
65 | :: refer to gdal/ogr docs for more info on how to use these parameters
66 | set prj_params=-s_srs epsg:4617 -t_srs epsg:3578
67 | for %%a in (%regions%) do (
68 | echo ogr2ogr -f “esri shapefile” -overwrite %prj_params% %%a unpack\NRN_%%a*.gml
69 | ogr2ogr -f “esri shapefile” -overwrite %prj_params% %%a unpack\NRN_%%a*.gml
70 | )
71 | goto :EOF
72 |
--------------------------------------------------------------------------------
/gis/list-fc-aliases.py:
--------------------------------------------------------------------------------
1 | # my first start-to-finish script using Leo Editor
2 | # Displays the names and aliases for all the feature classes in a geodatabases
3 | # (prep work for learning how to import Canvec feature classes from GML, while
4 | # making use of
5 | # http://code.google.com/p/maphew/source/browse/trunk/gis/canvec/db-friendly-names.txt)
6 | # Matt Wilkie, begun 2009 May 01
7 | import sys, arcgisscripting
8 | gp = arcgisscripting.create(9.3)
9 | ws_root = sys.argv[1]
10 | gp.workspace = ws_root
11 |
12 | name_table = {}
13 |
14 | def getDataSets():
15 | ''' Get feature datasets in current workspace and call listFeatureClassNames on each '''
16 | fds = gp.ListDatasets()
17 | for fd in fds:
18 | print ("\n%s\%s:") % (gp.workspace, fd)
19 | listFeatureClassNames(fd)
20 | return
21 |
22 | def listFeatureClassNames(path):
23 | ''' Build table of Feature Class Name <-> Alias Names from FCs in specified path'''
24 | gp.workspace = path
25 | fcs = gp.ListFeatureClasses()
26 | for fc in fcs:
27 | desc = gp.describe(fc)
28 | #print '%s \t %s' % (desc.aliasname, desc.name)
29 | name_table[desc.name] = desc.aliasname
30 | gp.workspace = ws_root
31 | return
32 |
33 | def reportResult(table):
34 | ''' Print alias <-> feature class lookup table '''
35 | print '%s -- %50s' % ('Alias', 'Feature Class')
36 | for name, aliasname in sorted(table.items()):
37 | print '%s -- %50s' % (aliasname, name)
38 | return
39 |
40 | getDataSets()
41 | listFeatureClassNames(ws_root) # catch feature classes not in Feature Dataset container
42 | reportResult(name_table)
43 |
--------------------------------------------------------------------------------
/gis/misc/cov2shp.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 | :: 2008-April-16 - Matt.wilkie@gov.yk.ca - this script is public domain
3 | ::
4 | :: Need an automated way to convert coverage to shape with out knowing ahead of time geometry type (line, point, poly)
5 | :: ArcCatalog drag 'n drop for coverages doesn't work, and FeatureClassToFeatureclassMultuple is broken for coverages
6 | :: so using ogr2ogr instead (which is faster anyway)
7 | ::
8 | :: Only polygons, lines and points are handled, so Region subcoverages and node networks etc. need to processed elsewhere
9 |
10 | if [%2] == [] goto Usage
11 | set incov=%1
12 | set outshp=%2
13 | set debug=%3
14 |
15 | if not exist %incov% goto NoCov
16 |
17 | set scratchDir=%outshp%_%random%
18 | mkdir %scratchDir%
19 |
20 | if not exist %outshp% mkdir %outshp%
21 |
22 | :Cov2shp
23 | ogr2ogr %scratchDir%\%incov% %incov%
24 | :: polygons
25 | if exist %incov%\pal.adf (
26 | copy %scratchDir%\%incov%\PAL.* %outshp%\%incov%_ply.* > nul
27 | goto :EndCov2shp rem With polys we don't need the lines or label points, so skip
28 | )
29 | :: lines, then points
30 | if exist %incov%\arc.adf copy %scratchDir%\%incov%\ARC.* %outshp%\%incov%_lin.* > nul
31 | if exist %incov%\pat.adf copy %scratchDir%\%incov%\LAB.* %outshp%\%incov%_pnt.* > nul
32 | :EndCov2shp
33 |
34 | ::CleanUp
35 | if /i not [%debug%]==[--debug] (
36 | rd /s/q %scratchDir%
37 | ) else (
38 | echo. --debug specified, not removing "%scratchDir%"
39 | )
40 |
41 | ::Report results
42 | echo.
43 | echo. Results in "%outshp%":
44 | echo.
45 | dir /b %outshp%\%incov%*
46 | echo.
47 | echo. Note: polygon islands still need to be manually removed
48 |
49 | goto :EOF
50 |
51 | :Usage
52 | echo.
53 | echo. -={ Cover to Shape }=-
54 | echo.
55 | echo. %~n0 [in cover] [out directory] {--debug}
56 | echo.
57 | goto :EOF
58 |
59 | :NoCov
60 | echo.
61 | echo. Input "%1" not found
62 | echo.
63 | goto :EOF
64 |
--------------------------------------------------------------------------------
/gis/misc/nts-html-table.htm:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/gis/misc/nts_map_as_html_table.py:
--------------------------------------------------------------------------------
1 | '''Print Yukon NTS tile names as html table with links, arranged in same order as they appear in a map index.
2 |
3 | 2015-Aug-19, Matt.Wilkie@gov.yk.ca
4 | License: X/MIT
5 | '''
6 |
7 | nts_txt_ordered = '''117C 117D
8 | 117B 117A
9 | 116NO 116P
10 | 116JK 116I 106L 106K
11 | 116FG 116H 106E 106F
12 | 116BC 116A 106D 106C 106B
13 | 115NO 115P 105M 105N 105O 105P
14 | 115JK 115I 105L 105K 105J 105I
15 | 115FG 115H 105E 105F 105G 105H 095E
16 | 115BC 115A 105D 105C 105B 105A 095D 095C
17 | '''
18 |
19 | style = ''''''
28 |
29 | def link(txt, prefix=None):
30 | return '{txt}'.format(prefix=prefix, txt=txt)
31 |
32 |
33 | if __name__ == '__main__':
34 | print style
35 | print ''
36 | for row in nts_txt_ordered.splitlines():
37 | print ''
38 | for x in row.split():
39 | ## prefix = '/maps/media/uploads/pdf-maps/Administrative_Boundaries_'
40 | prefix = 'xxx/'
41 | print '',link(x, prefix),' | '
42 | print '
'
43 | print '
'
44 |
45 |
--------------------------------------------------------------------------------
/gis/misc/tissot/generate_tissot.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # Tissot Circles
3 | # Represent perfect circles of equal area on a globe
4 | # but will appear distorted in ANY 2d projection.
5 | # Used to show the size, shape and directional distortion
6 | # by Matthew T. Perry
7 | # 12/10/2005
8 |
9 | import ogr
10 | import os
11 | import osr
12 |
13 | output = 'tissot.shp'
14 | debug = False
15 |
16 | # Create the Shapefile
17 | driver = ogr.GetDriverByName('ESRI Shapefile')
18 | if os.path.exists(output):
19 | driver.DeleteDataSource(output)
20 | ds = driver.CreateDataSource(output)
21 | layer = ds.CreateLayer(output, geom_type=ogr.wkbPolygon)
22 |
23 | # Set up spatial reference systems
24 | latlong = osr.SpatialReference()
25 | ortho = osr.SpatialReference()
26 | latlong.ImportFromProj4('+proj=latlong')
27 |
28 | # For each grid point, reproject to ortho centered on itself,
29 | # buffer by 640,000 meters, reproject back to latlong,
30 | # and output the latlong ellipse to shapefile
31 | for x in range(-165,180,30):
32 | for y in range (-60,90,30):
33 | f= ogr.Feature(feature_def=layer.GetLayerDefn())
34 | wkt = 'POINT(%f %f)' % (x, y)
35 | p = ogr.CreateGeometryFromWkt(wkt)
36 | p.AssignSpatialReference(latlong)
37 | proj = '+proj=ortho +lon_0=%f +lat_0=%f' % (x,y)
38 | ortho.ImportFromProj4(proj)
39 | p.TransformTo(ortho)
40 | b = p.Buffer(640000)
41 | b.AssignSpatialReference(ortho)
42 | b.TransformTo(latlong)
43 | f.SetGeometryDirectly(b)
44 | layer.CreateFeature(f)
45 | f.Destroy()
46 |
47 | ds.Destroy()
48 |
--------------------------------------------------------------------------------
/gis/misc/tissot/tissot.dbf:
--------------------------------------------------------------------------------
1 | _<