mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2024-11-25 08:41:54 +00:00
Radost updates
This commit is contained in:
parent
ddd8868c95
commit
980092de06
28500
map/tools/constants.jsp
Normal file
28500
map/tools/constants.jsp
Normal file
File diff suppressed because it is too large
Load Diff
14
map/tools/extract_height_data.py
Normal file
14
map/tools/extract_height_data.py
Normal 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
31
map/tools/height_from_utm_chunk.jsp
Normal file
31
map/tools/height_from_utm_chunk.jsp
Normal 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
8
map/tools/make.sh
Normal 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
|
Loading…
Reference in New Issue
Block a user