Compare commits
No commits in common. "ec3c151a52d74131e8843362c507143e0d24ede3" and "6d81afb3951238a2b0d9604f44b32f152ad81062" have entirely different histories.
ec3c151a52
...
6d81afb395
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1 @@
|
|||
data/plats.geojson
|
||||
satellite/
|
||||
|
|
8
Makefile
8
Makefile
|
@ -1,10 +1,2 @@
|
|||
plats.json: scripts/get_plats.py
|
||||
./scripts/get_plats.py data/plats.geojson
|
||||
|
||||
.PHONY: satellite
|
||||
satellite:
|
||||
./scripts/download_satellite.py
|
||||
|
||||
.PHONY: deploy
|
||||
deploy: plats.json satellite
|
||||
rsync -avz ./ bert:/srv/www/lawrencedeerclub.chandlerswift.com/
|
||||
|
|
26
map.html
26
map.html
|
@ -63,27 +63,11 @@
|
|||
<div id="popupcontainer" class="leaflet-container"></div>
|
||||
<script>
|
||||
(async function() {
|
||||
const map = L.map('map', {
|
||||
minZoom: 12,
|
||||
maxZoom: 21,
|
||||
maxBounds: [
|
||||
[47.517085, -93.427584],
|
||||
[47.457925, -93.340026],
|
||||
],
|
||||
}).setView([94.505, -0.09], 13);
|
||||
const map = L.map('map').setView([94.505, -0.09], 13);
|
||||
// L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
// maxZoom: 19,
|
||||
// attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
||||
// }).addTo(map);
|
||||
L.tileLayer('./satellite/{z}/{x}/{y}.png', {
|
||||
minNativeZoom: 12,
|
||||
maxNativeZoom: 20,
|
||||
bounds: [
|
||||
[47.517085, -93.427584],
|
||||
[47.457925, -93.340026],
|
||||
],
|
||||
}).addTo(map);
|
||||
|
||||
|
||||
// Make these requests in parallel
|
||||
const track_req_promise = fetch('data/track.geojson');
|
||||
|
@ -96,6 +80,8 @@
|
|||
const plats = await plats_req.json();
|
||||
const data = await data_req.json();
|
||||
|
||||
L.geoJSON(track).addTo(map);
|
||||
|
||||
L.geoJSON(plats, {
|
||||
filter: feature => !feature.properties.TAO_NAME.toLowerCase().includes("lawrence deer club"),
|
||||
onEachFeature: function(feature, layer) {
|
||||
|
@ -115,12 +101,6 @@
|
|||
},
|
||||
}).addTo(map);
|
||||
|
||||
L.geoJSON(track, {
|
||||
style: {
|
||||
color: "maroon",
|
||||
},
|
||||
}).addTo(map);
|
||||
|
||||
for (let stand of data.stands) {
|
||||
if (stand.location) {
|
||||
const marker = L.marker(stand.location).addTo(map);
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell --quiet -p python312 -p python312Packages.pillow -i python
|
||||
|
||||
# https://svc.pictometry.com/Image/D2B06344-7A2D-5BD0-FC89-DFDDC9888C41/wmts?SERVICE=WMTS&REQUEST=GetCapabilities
|
||||
|
||||
import os
|
||||
import urllib.request
|
||||
from PIL import Image
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
MAX_ZOOM=20
|
||||
|
||||
def download_all():
|
||||
current, total = 0, (4 ** (MAX_ZOOM - 11) - 1)//3
|
||||
with ThreadPoolExecutor() as executor:
|
||||
for z in range(12, MAX_ZOOM + 1):
|
||||
scale = 2 ** (z - 12)
|
||||
start_x = 985 * scale
|
||||
start_y = 1432 * scale
|
||||
for x in range(start_x, start_x + scale):
|
||||
for y in range(start_y, start_y + scale):
|
||||
executor.submit(download_image, z, x, y, total, current)
|
||||
current += 1
|
||||
|
||||
def download_image(z, x, y, total, current):
|
||||
progress = f"[{current:0{len(str(total))}d}/{total}]"
|
||||
url = f"https://svc.pictometry.com/Image/D2B06344-7A2D-5BD0-FC89-DFDDC9888C41/wmts/PICT-MNITAS23-EDVs7UTOVt/default/GoogleMapsCompatible/{z}/{x}/{y}.jpg"
|
||||
file = os.path.normpath(os.path.join(os.path.dirname(__file__), f"../satellite/{z}/{x}/{y}.jpg"))
|
||||
os.makedirs(os.path.dirname(file), exist_ok=True)
|
||||
if os.path.isfile(file):
|
||||
try: # does it already exist and look good?
|
||||
Image.open(file).verify() # CRC check on PNGs; nothing on other file types? https://pillow.readthedocs.io/en/latest/_modules/PIL/PngImagePlugin.html#ChunkStream.verify
|
||||
print(f"{progress} {file} already exists; skipping")
|
||||
return
|
||||
except OSError as e:
|
||||
print(f"{progress} replacing corrupt {file}")
|
||||
else:
|
||||
print(f"{progress} downloading {file}")
|
||||
urllib.request.urlretrieve(url, file)
|
||||
|
||||
download_all()
|
Loading…
Reference in a new issue