Administrative region lookup
Administrative region lookup
Query level country/province/city/district with optional query and discovered parent countryCode/provinceCode/cityCode. limit is 1–100 (default 20). Inspect total, truncated, scopeIssue and coverage. Never assume the first ambiguous result is correct. This catalog verifies administrative paths, not coordinates or street addresses; preserve address text when correcting a location.
system.location.region.search
sl system location region search (--definition-json <json>|--definition-file <path>) [--json]
Parameters:
level(required) — country, province, city or district.query(optional) — Name, accepted abbreviation or exact code. Omit to browse within the parent scope.countryCode(optional) — ISO alpha-2 code discovered from country search. Required with provinceCode or cityCode.provinceCode(optional) — Exact province code from search; restricts city or district results to that path.cityCode(optional) — Exact city code from search; restricts district results to that path.limit(optional) — 1-100, defaults to 20. If truncated, narrow the query or parent scope; results are never an automatic resolution.
sl system location region search --definition-json '{"level":"country","query":"China","limit":10}' --json
Distance and routing
system.location.distance.calculate
sl system location distance calculate --definition-json '{"origin":{"longitude":116.35506,"latitude":39.92277},"destination":{"longitude":116.39751,"latitude":39.90854}}' --json
Calculates great-circle distance locally from WGS84 coordinates and returns distanceMeters and coordinateSystem: "WGS84". No resource is required.
system.location.route.calculate
sl system location route calculate --definition-json '{"resourceKey":"tianditu-map-main","origin":{"longitude":116.35506,"latitude":39.92277},"destination":{"longitude":116.39751,"latitude":39.90854},"mode":"driving"}' --json
resourceKey selects an active map resource in the current tenant. Alternatively, supply provider (tianditu, mapbox, or google) and apiKey; these modes are mutually exclusive. origin and destination must be WGS84 { longitude, latitude } objects. mode defaults to driving; all providers support walking, and Mapbox/Google also support cycling. Returns { resourceKey, provider, mode, coordinateSystem, distanceMeters, durationSeconds, path, alternatives }, with [longitude, latitude][] in path. Resource mode uses its existing apiKey; direct mode uses the supplied key without reading or saving a resource, returning resourceKey: null. The selected key must permit routing and server requests, with quota and any required billing. Failures never switch provider or substitute straight-line distance. Both commands also accept --definition-file instead of --definition-json.
For a supplied key, put this input in a file and run sl system location route calculate --definition-file route.json --json:
{"provider":"mapbox","apiKey":"YOUR_SERVER_ROUTE_KEY","origin":{"longitude":116.35506,"latitude":39.92277},"destination":{"longitude":116.39751,"latitude":39.90854},"mode":"driving"}
Alternative routes
Set alternatives: true to request additional Mapbox or Google routes in either resource or direct-key mode. Top-level distanceMeters, durationSeconds and path describe the primary route; returned alternatives contains only additional routes with those same fields. Default false returns alternatives: []. Mapbox can return up to two additional routes, Google up to three; the provider may return none. Current Tianditu integration rejects true with MAP_ROUTE_ALTERNATIVES_UNSUPPORTED without a provider request.
sl system location route calculate --definition-json '{"resourceKey":"mapbox-main","origin":{"longitude":116.35506,"latitude":39.92277},"destination":{"longitude":116.39751,"latitude":39.90854},"mode":"driving","alternatives":true}' --json