feat(catalog): add Tianditu, Amap, and Tencent basemaps for mainland China - #33
Conversation
…China Every basemap in the catalog is hosted outside mainland China with no presence inside it, so for users there the whole picker degrades from slow to unreachable: OpenStreetMap, OpenFreeMap, Protomaps, Carto, Google, and Mapbox alike. Add the three providers that are actually served from inside China: - Tianditu (天地图), the official National Platform for Common Geospatial Information Services: vector, imagery, and terrain, each with its separate label overlay. Needs a free `tk`, wired through as `tiandituApiKey` alongside the existing provider credentials (option, setter, API-keys panel field, and "Get a Tianditu API key" help link). - Amap (高德地图): street, satellite, and a transparent roads-and-labels overlay. Keyless. - Tencent Maps (腾讯地图): street and dark. Keyless, and TMS rather than xyz, so `rasterBasemap` now forwards `scheme` (the control already honored it). Tianditu is the one to reach for when the map also carries your own data: Amap and Tencent publish in GCJ-02, the offset datum Chinese law mandates, which silently displaces WGS84 overlays by roughly 100-700 m, while Tianditu publishes in CGCS2000 and lines up. Nothing here applies the shift, so every affected basemap says so in its description and the README leads with it. All three are tagged with their Chinese names, so 天地图, 高德, and 腾讯 find them in the panel's search alongside the English ones. Two limits found by probing the endpoints rather than reading docs: the Tianditu terrain pair stops at zoom 14 where its vector and imagery layers reach 18, and Amap returns a "no imagery" placeholder rather than a 404 past zoom 18, so its satellite layer caps there and lets MapLibre overzoom. Also replaces the nested ternary in `_missingRasterKeyError` with a lookup map, which had already drifted out of indentation at four providers. Verified in Chromium against the live endpoints: Amap and Tencent tiles load 200 from all four hosts each and render correctly oriented (which is what proves the TMS flip), Tianditu raises its missing-credential error with the right message, and the key field renders in the API keys view.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe catalog adds Tianditu, Amap, and Tencent basemaps with provider-specific tile URLs, schemes, metadata, and zoom limits. ChangesChina basemap providers
Estimated code review effort: 3 (Moderate) | ~25 minutes Mergeability Score: ⚪ Minimal · up to The change adds China-hosted basemap providers and related credential handling; no actionable merge-blocking risk remains beyond normal checks and review. Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Why
Every basemap in the catalog is hosted outside mainland China with no presence inside it, so for users there the whole picker degrades from slow to unreachable: OpenStreetMap, OpenFreeMap, Protomaps, Carto, Google, and Mapbox alike. This adds the three providers that are actually served from inside China.
What
tianditu-vector,tianditu-imagery,tianditu-terrain+ their-labelsoverlaystiandituApiKeyamap-street,amap-satellite,amap-labelstencent-street,tencent-darktk, wired through astiandituApiKeyalongside the existing provider credentials: option,setTiandituApiKey(), a field in the API-keys panel, and a "Get a Tianditu API key" help link on the missing-credential error.rasterBasemapnow forwardsscheme(the control already honored it).天地图,高德, and腾讯find them in the panel's search alongside the English ones.The datum matters more than the speed
Amap and Tencent publish in GCJ-02, the offset datum Chinese law mandates, which silently displaces WGS84 overlays by roughly 100-700 m. Tianditu publishes in CGCS2000 and lines up. Nothing here applies the shift, so Tianditu is the one to reach for when the map also carries your own data — every affected basemap says so in its description, and the README leads with it.
Two limits found by probing rather than reading docs
ter_w/cta_w) stops at zoom 14, where its vector and imagery layers reach 18.amap-satellitecaps there and lets MapLibre overzoom instead of painting placeholders.Drive-by
Replaces the nested ternary in
_missingRasterKeyErrorwith a lookup map. It had already drifted out of indentation at four providers, and this PR would have made it five.Verification
7 new tests (109 total, all passing), plus a Chromium run against the live endpoints:
200from all fourwprd0{1-4}/webst0{1-4}hosts and render correctly placed.200from all fourrt{0-3}hosts and render correctly oriented, which is what proves the TMS flip is applied.Enter a Tianditu API key before applying this layer.and reveals its key field.I could not fetch a Tianditu tile from this network: their CloudWAF answers foreign requests with a
418block page regardless of key or UA. The URL shape is the documentedDataServerform and the key substitution is covered by tests, but someone inside China should confirm the tiles before release.Not included: GeoQ (智图, Esri China). Its host resolves but every port is filtered from outside China, so I could not confirm the service is still alive, and shipping an unverifiable endpoint into a public catalog risks a dead entry. Easy to add later if someone can check it from inside China.
Summary by CodeRabbit
New Features
Documentation