cadastre
Retrieve cadastral information including district, municipality, plot, and fiscal subdivision data for specific geographic coordinates using France's official Géoplateforme services.
Instructions
Renvoie les informations cadastrales (arrondissement, commune, feuille, parcelle, subdivision_fiscale, localisant) pour une position donnée par sa longitude et sa latitude (source :Géoplateforme (WFS, CADASTRALPARCELS.PARCELLAIRE_EXPRESS)).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lon | Yes | La longitude du point | |
| lat | Yes | La latitude du point |
Implementation Reference
- src/tools/CadastreTool.ts:25-28 (handler)The handler function for the 'cadastre' tool. Logs the input coordinates and delegates to the getParcellaireExpress helper to fetch cadastral data.async execute(input: CadastreInput) { logger.info(`cadastre(${input.lon},${input.lat})...`); return getParcellaireExpress(input.lon, input.lat); }
- src/tools/CadastreTool.ts:14-23 (schema)Zod schema definition for the tool's input parameters: longitude (lon) and latitude (lat).schema = { lon: { type: z.number(), description: "La longitude du point", }, lat: { type: z.number(), description: "La latitude du point", }, };
- src/gpf/parcellaire-express.js:52-87 (helper)Core helper function that queries the Géoplateforme WFS service for cadastral parcels (PARCELLAIRE_EXPRESS) within 10m of the point, processes features, calculates distances, and returns the nearest per type.export async function getParcellaireExpress(lon, lat) { logger.info(`getParcellaireExpress(${lon},${lat}) ...`); // note that EPSG:4326 means lat,lon order for GeoServer -> flipped coordinates... const cql_filter = `DWITHIN(geom,Point(${lat} ${lon}),10,meters)`; const sourceGeom = { "type": "Point", "coordinates": [lon,lat] }; // TODO : avoid useless geometry retrieval at WFS level const url = 'https://data.geopf.fr/wfs?' + new URLSearchParams({ service: 'WFS', request: 'GetFeature', typeName: PARCELLAIRE_EXPRESS_TYPES.map((type) => { return `CADASTRALPARCELS.PARCELLAIRE_EXPRESS:${type}` }).join(','), outputFormat: 'application/json', cql_filter: cql_filter }).toString(); const featureCollection = await fetchJSON(url); return filterByDistance(featureCollection.features.map((feature) => { // parse type from id (ex: "commune.3837") const type = feature.id.split('.')[0]; // ignore geometry and extend properties return Object.assign({ type: type, id: feature.id, bbox: feature.bbox, distance: distance( sourceGeom, feature.geometry ), source: PARCELLAIRE_EXPRESS_SOURCE, }, feature.properties); })); }