Skip to content

Instantly share code, notes, and snippets.

View wburt's full-sized avatar

Will Burt wburt

  • Province of British Columbia @bcgov
  • Nelson, BC
View GitHub Profile
@wburt
wburt / WSL.md
Created June 2, 2025 19:01 — forked from franTarkenton/WSL.md
Windows subsystem for linux 2 setup
@wburt
wburt / WSL.md
Created June 2, 2025 19:01 — forked from franTarkenton/WSL.md
Windows subsystem for linux 2 setup
import os
import requests
import zipfile
import requests
def download_file(url, file_name):
"""Downloads a large file from a URL.
Args:
url: The URL of the file to download.
@wburt
wburt / pagination.py
Created April 6, 2023 23:25
pagination for wfs using requests
import requests
# wfs_url = "https://openmaps.gov.bc.ca/geo/pub/ows?"
# f = 'WHSE_WATER_MANAGEMENT.GW_WATER_WELLS_WRBC_SVW'
def get_data(wfs_url, dataset):
pagesize =10000
r = wfs_query(f)
matched = int(r.get('numberMatched'))
returned = int(r.get('numberReturned'))
@wburt
wburt / fix_bc_laz_with_pdal.py
Last active September 11, 2023 18:49
Python fix for error "Global encoding WKT flag not set for point format 6 - 10." encountered when reading las files with PDAL and QGIS
""" Fixes error
Global encoding WKT flag not set for point format 6 - 10.
encountered when reading las files with PDAL and QGIS
first parameter is laz/las file needing fix
note: can also override the input crs if it is known
https://gis.stackexchange.com/questions/413191/python-pdal-error-reading-format-1-4-las-file-readers-las-error-global-enco
usage:
@wburt
wburt / git_notes.md
Last active June 13, 2024 19:10
overwrite branch with another

Git: steps overwite branch with another

clone repo then -- example below

git checkout alg
git merge -s ours main
git checkout main
git merge alg
git push origin main

@wburt
wburt / generate_qrcode.py
Created September 21, 2022 23:09
Python -- QR Code from URL
#--requires
https://pypi.org/project/qrcode/
pip install -U qrcode[pil]
'''
import qrcode
url = r"https://pub.data.gov.bc.ca/datasets/177864/pdf/082k/082K021.pdf"#sys.argv[1]
output = r"./qrcode/082K021.png"#sys.argv[2]
qr = qrcode.make(url)
if output[-3:] == 'png':
@wburt
wburt / ogr-excel-parse-to-dict.py
Created June 4, 2021 17:30
Parse excel file to dictionary
import os
from osgeo import ogr
def parse_config(xlsx):
''' parses xls into list of dictionaries
{'xls tab name':[{'value':'',
'layer_name':'',
'layer_source':'',
'feature_class':''},{}]
'''
data = []
@wburt
wburt / sync_fork-with-upstream.txt
Last active May 27, 2021 21:20
sync fork with upstream
git remote add upstream https://github.com/bcgov/gis-pantry
git fetch upstream
git checkout master
git reset --hard upstream/master
git push origin master --force
@wburt
wburt / vscode_with_QGIS.bat
Created March 24, 2020 22:58
Start vs code with QGIS env
@echo on
set batch_home=%~dp0
echo %~dp0
set batch_drive=%CD:~0,2%
E:
cd %QGIS_PATH%\bin
call o4w_env.bat
call qt5_env.bat
call py3_env.bat
path %OSGEO4W_ROOT%\apps\qgis\bin;%PATH%