Radost updates

This commit is contained in:
Philip Sargent 2023-11-14 19:11:52 +02:00
parent ddd8868c95
commit 980092de06
5 changed files with 57054 additions and 28500 deletions

28500
map/tools/constants.jsp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,14 @@
# This software is MIT licensed
# by Radost Waszkiewicz 2023
#
# This script extracts height information from a .3d file
# and formats it into an array that will later be used by
# a javascript web tool.
import survex3dreader
import pprint
data = survex3dreader.read_svx_file("1623-and-1626-with-terrain.3d")
surface_grid = [x for x in data["station_list"] if "srtm" in x[1]]
# meters to centimeters
pprint.pprint([[x[0][0] / 100, x[0][1] / 100, x[0][2] / 100] for x in surface_grid])

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,31 @@
'use strict'
// This code is MIT licensed.
// Copyright Radost Waszkiewicz 2023
export function heightFromUTM(easting,northing) {
let res = findNearestPoint(raw,[easting,northing]);
let winner = res[0];
let distance = res[1];
return ""+winner+" (refrerence:"+(distance).toFixed(0)+"m away)";
}
function findNearestPoint(points, targetPoint) {
// this function written by chat gpt
let nearestDistance = Infinity;
let nearestPoint = null;
for (let i = 0; i < points.length; i++) {
const [x, y, z] = points[i];
const distance = Math.sqrt(Math.pow(x - targetPoint[0], 2) + Math.pow(y - targetPoint[1], 2));
if (distance < nearestDistance) {
nearestDistance = distance;
nearestPoint = z;
}
}
return [nearestPoint,nearestDistance];
}
let raw =

8
map/tools/make.sh Normal file
View File

@ -0,0 +1,8 @@
# This software is MIT licensed
# by Radost Waszkiewicz 2023
#
# This script combines chunks of javascript into
# one javascript file to be used by a web tool.
python3 extract_height_data.py > constants.jsp
cat height_from_utm_chunk.jsp constants.jsp > height_from_utm.js