docs(maps): an Amap link needs a coordinate

A bare amap.com/place page carries an id and nothing else, and turning that
id into a location would need a keyed detail lookup the URL resolver has no
user for. It answers 400, which AMAP-084 pins. The wiki offered the link as
paste-able and the parseAmapUrl comment still promised the lookup, so both
now say what the code does.

The provider header also claimed photoRefs/photoBytes were deliberately
left out, naming two methods the places-provider interface no longer has.
The reason is unchanged: an Amap picture comes without a licence statement
we could show, so an Amap place gets its picture from Wikimedia.
This commit is contained in:
Maurice
2026-09-12 17:25:29 +02:00
parent ba535e5aab
commit f2bd116044
2 changed files with 14 additions and 10 deletions
@@ -22,11 +22,11 @@
* otherwise the controller's error mapping would report every failure as an
* empty result.
*
* Deliberately not implemented: `photoRefs`/`photoBytes`. Amap's POI photos come
* with no licence statement we could show a user, and the existing Wikimedia
* fallback already produces a picture *with* its attribution. An unattributable
* image is worse than no image, so the photo path falls through to Wikimedia for
* Amap places.
* No picture comes out of this provider. Amap's POI photos carry no licence
* statement we could show a user, and the Wikimedia fallback the place-details
* column already uses produces a picture *with* its attribution. An
* unattributable image is worse than no image, so an Amap place gets its picture
* the same way a place found on OpenStreetMap does.
*/
import { createHash } from 'node:crypto';
import { fromAmapLocation, gcj02ToWgs84, toAmapLocation } from '@trek/shared';
@@ -436,8 +436,10 @@ export class AmapPlacesProvider implements PlacesProvider {
* The formats people paste, in the order they are tried:
* - `uri.amap.com/marker?position=<lng>,<lat>&name=…` — what our own "open in
* Amap" links look like, and what the mobile app's share sheet produces
* - `amap.com/place/<id>` or `…/detail?id=<id>` — a POI page, whose id we can
* look up when a key is configured
* - `amap.com/place/<id>` or `…/detail?id=<id>`: a POI page carries an id and
* no coordinate, so it comes back with the id and NaN. Turning that id into
* a location needs a keyed detail lookup, and the URL resolver has no user
* to resolve a key for, so it answers 400 instead
* - `?p=…` / `#…` viewport fragments carrying a bare `lng,lat`
*
* Returned coordinates are WGS-84; the link carries GCJ-02.
+5 -3
View File
@@ -48,8 +48,10 @@ Amap place gets its picture from Wikimedia Commons like any other, with the cred
A place remembers where it came from. One picked from Amap keeps its Amap id, one picked from Google keeps its Google
id, and each keeps opening against the provider that knows it, whichever provider the admin selects later.
You can also paste an Amap share link into the search box: `uri.amap.com/marker?…`, `amap.com/place/…` or a
`surl.amap.com` short link, the same way a Google Maps URL works below.
You can also paste an Amap link into the search box, the same way a Google Maps URL works below, as long as the link
carries a coordinate: a `uri.amap.com/marker?position=…` share link does, a map URL with the coordinate in the address
does, and a `surl.amap.com` short link does when it resolves to one of those. A bare `amap.com/place/…` POI page is an
id and nothing else, and TREK answers that one with an error rather than guessing where it is.
### Which provider answers
@@ -94,7 +96,7 @@ The column is desktop-only; the mobile place sheet is unchanged.
Paste a `maps.app.goo.gl/…`, `goo.gl/maps/…`, or `maps.google.*/…` URL directly into the search box and press the search button. TREK resolves it server-side and populates the name, address, and coordinates.
Amap links work the same way: `uri.amap.com/marker?…`, `amap.com/place/…` and `surl.amap.com` short links. Their coordinates are converted from GCJ-02 to WGS-84 on the way in, so the place lands where it belongs on every other map.
Amap links work the same way, as long as the link carries a coordinate: `uri.amap.com/marker?position=…` share links, map URLs with the coordinate in the address, and `surl.amap.com` short links that resolve to one of those. A bare `amap.com/place/…` POI page is an id and nothing else, and TREK answers it with an error. Coordinates are converted from GCJ-02 to WGS-84 on the way in, so the place lands where it belongs on every other map.
## Entering coordinates manually