feat(map): amap as map api provider and display template

This commit is contained in:
A1phaN
2026-09-07 10:04:12 +08:00
committed by Maurice
parent a066c94ec5
commit 57eac32f9f
92 changed files with 2910 additions and 70 deletions
+19
View File
@@ -97,6 +97,25 @@ export function isVectorStyle(url: string | null | undefined): boolean {
return /^https?:\/\//i.test(u) || u.startsWith('mapbox://')
}
/**
* Tiles drawn in GCJ-02 rather than WGS-84.
*
* Amap serves its raster tiles from `*.is.autonavi.com`, and they are shifted
* from the WGS-84 coordinates everything else in TREK uses — by 100 to 800 m
* depending on where in China you are. A map on one of these has to project
* through components/Map/gcj02Crs.ts or every marker lands on the wrong street.
*
* Matched on the host, not on the preset constants, so a self-hosted proxy in
* front of the same tiles still gets the right CRS as long as the hostname
* survives — and so a template a user typed in by hand does too.
*/
const GCJ02_TILE_HOST = /(^|\.)is\.autonavi\.com$/i
export function isGcj02Basemap(url: string | null | undefined): boolean {
if (!url) return false
return GCJ02_TILE_HOST.test(templateHost(url))
}
/**
* What a map should draw, given the user's template and the app's default.
*