feat: refine complex junction geometry and workbench
This commit is contained in:
1 parent
7c04d086db
commit
05614d1a69
20 files changed
+315
-267
No files matched your search
@@ -3,6 +3,10 @@
|
||||
const fs = require('fs');
|
||||
|
||||
const PI = Math.PI;
|
||||
// GCJ-02 conversion is deliberately self-contained, but the local-metre scale
|
||||
// is the compiler-wide equirectangular metric — one copy keeps reference
|
||||
// matching and SVG projection consistent with native road geometry.
|
||||
const { METERS_PER_DEGREE, distanceMeters } = require('../geometry/metric');
|
||||
const EARTH_A = 6378245.0;
|
||||
const EARTH_EE = 0.00669342162296594323;
|
||||
|
||||
@@ -92,11 +96,6 @@ function centerOf(bounds) {
|
||||
return [(bounds.minLon + bounds.maxLon) / 2, (bounds.minLat + bounds.maxLat) / 2];
|
||||
}
|
||||
|
||||
function distanceMeters(first, second) {
|
||||
const lonScale = 111320 * Math.cos((first[1] * PI) / 180);
|
||||
return Math.hypot((second[0] - first[0]) * lonScale, (second[1] - first[1]) * 111320);
|
||||
}
|
||||
|
||||
function parseOsmNodes(xml) {
|
||||
const nodes = [];
|
||||
for (const match of xml.matchAll(/<node\b([^>]*?)(?:\/>|>([\s\S]*?)<\/node>)/g)) {
|
||||
@@ -218,10 +217,10 @@ function inspectReference({
|
||||
function localReferenceSvg({ converted, nativeIntersection, center, radiusMeters = 180 }) {
|
||||
const width = 1000;
|
||||
const height = 1000;
|
||||
const lonScale = 111320 * Math.cos((center[1] * PI) / 180);
|
||||
const lonScale = METERS_PER_DEGREE * Math.cos((center[1] * PI) / 180);
|
||||
const project = (point) => [
|
||||
width / 2 + ((point[0] - center[0]) * lonScale * width) / (radiusMeters * 2),
|
||||
height / 2 - ((point[1] - center[1]) * 111320 * height) / (radiusMeters * 2),
|
||||
height / 2 - ((point[1] - center[1]) * METERS_PER_DEGREE * height) / (radiusMeters * 2),
|
||||
];
|
||||
const pathFor = (coordinates) => {
|
||||
const parts = [];
|
||||
|
||||
Reference in new issue
Block a user