Services

Address API – Geocoding

Vorwärts‑Geocoding: Adresse/Ort → Koordinaten (WGS84).

Route

  • Methode: POST
  • URL: /api/address/geocoding
  • Auth: x-api-key (Header) oder intern

Request

  • q: string – Suchbegriff (Adresse/POI)
  • lat, lng: number – optional, Ranking‑Bias

Beispiel

/api/address/geocoding (POST)

{
  "q": "Alexanderplatz"
}
curl -X POST "https://dev.nuvisphere.de/api/address/geocoding" \
  -H "Content-Type: application/json" \
  -H "x-api-key: API_KEY"
  -d '{
  "q": "Alexanderplatz"
}'
// server-side (Node/Next.js)
const res = await fetch("https://dev.nuvisphere.de/api/address/geocoding", {
  method: "POST",
  headers: {
    "content-type": "application/json",
    "x-api-key": process.env.MAILER_API_KEY!,

  },
  body: JSON.stringify({
  "q": "Alexanderplatz"
}),
});
if (!res.ok) throw new Error(`Request failed ${res.status}`);
const json = await res.json();
  • API Key niemals im Browser verwenden – nur serverseitig (z. B. process.env.MAILER_API_KEY).
  • Lässt du optionale Felder weg, nutzt die API ggf. Template-/Defaultwerte.

Antwort

Enthält Treffer mit lat/lng und Bestandsdaten. Qualität abhängig von Suchbegriff und Datenquelle.