Skip to main content
Glama
geocode.js793 B
import logger from "../logger.js"; import { fetchJSON } from "../helpers/http.js"; export const GEOCODE_SOURCE = "Géoplateforme (service d'autocomplétion)"; /** * Get coordinates for a given location * * @see https://geoservices.ign.fr/documentation/services/services-geoplateforme/autocompletion * * @param {string} text * @returns */ export async function geocode(text) { logger.info(`geocode(${JSON.stringify(text)})...`); const url = 'https://data.geopf.fr/geocodage/completion/?' + new URLSearchParams({ text: text, maximumResponses: 3 }).toString(); const json = await fetchJSON(url); return json.results.map((item)=>{return { lon: item.x, lat: item.y, fulltext: item.fulltext }}); }

Implementation Reference

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ignfab/geocontext'

If you have feedback or need assistance with the MCP directory API, please join our Discord server