一键导入
city-distance
Calculate line-of-sight and road distances between two cities using free OpenStreetMap services.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Calculate line-of-sight and road distances between two cities using free OpenStreetMap services.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Upload and host files anonymously using decentralized storage with Originless and IPFS.
Automate web browsers for AI agents using agent-browser CLI with deterministic element selection.
Log all file changes (write, edit, delete) to a SQLite database for debugging and audit. Use when: (1) Tracking code changes, (2) Debugging issues, (3) Auditing file modifications, or (4) The user asks to track file changes.
Fetch current and historical crypto prices and compute ATH or ATL over common time windows.
Host static websites and assets via zip upload to Originless IPFS. Use when: (1) Deploying static sites, (2) Hosting HTML/CSS/JS projects, (3) Sharing web assets publicly, or (4) User asks to host static files.
Search for torrents by title or IMDB ID via a Torznab-compatible API. Use when: (1) User asks to find a torrent for a movie or show, (2) You need a magnet link for a given title, or (3) User provides an IMDB ID and wants download options.
| name | city-distance |
| description | Calculate line-of-sight and road distances between two cities using free OpenStreetMap services. |
Purpose: Calculate line-of-sight and road distances between two cities using free, API-keyless public services and local haversine calculations.
What it does:
Files:
When to use:
Prerequisites:
Agent prompt:
Calculate both the straight-line (Haversine) distance and the driving distance between {cityA} and {cityB} using free OpenStreetMap services. Return distances in km and optionally list major towns along the driving route.
Bash (uses OSM routing, jq):
set -euo pipefail
CITY_A_LAT=48.8566
CITY_A_LON=2.3522
CITY_B_LAT=52.52
CITY_B_LON=13.4050
URL="https://routing.openstreetmap.de/routed-car/route/v1/driving/${CITY_A_LON},${CITY_A_LAT};${CITY_B_LON},${CITY_B_LAT}?overview=false"
curl -fsS --max-time 10 "$URL" | jq -r '.routes[0].distance / 1000'
Node.js (uses native fetch, AbortController, error handling):
// city_distance_calculator.js
async function fetchJson(url, timeoutMs = 10000) {
const controller = new AbortController();
const id = setTimeout(() => controller.abort(), timeoutMs);
try {
const res = await fetch(url, { signal: controller.signal });
clearTimeout(id);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return await res.json();
} catch (err) {
clearTimeout(id);
throw err;
}
}
function haversine(lat1, lon1, lat2, lon2) {
const R = 6371e3;
const toRad = d => (d * Math.PI) / 180;
const φ1 = toRad(lat1), φ2 = toRad(lat2);
const Δφ = toRad(lat2 - lat1), Δλ = toRad(lon2 - lon1);
const a = Math.sin(Δφ/2)**2 + Math.cos(φ1)*Math.cos(φ2)*Math.sin(Δλ/2)**2;
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
return (R * c) / 1000;
}
(async () => {
const paris = { lat: 48.8566, lon: 2.3522 };
const berlin = { lat: 52.52, lon: 13.4050 };
console.log('Line-of-sight (km):', haversine(paris.lat, paris.lon, berlin.lat, berlin.lon).toFixed(2));
const url = `https://routing.openstreetmap.de/routed-car/route/v1/driving/${paris.lon},${paris.lat};${berlin.lon},${berlin.lat}?overview=false`;
const data = await fetchJson(url, 15000);
console.log('Driving distance (km):', (data.routes[0].distance / 1000).toFixed(2));
})();
Notes / Rate limits:
See also: