urbanisme
Retrieve urban planning regulations (PLU, PLUi, POS, CC, PSMV) for specific coordinates using France's Géoplateforme data to check land use restrictions and zoning information.
Instructions
Renvoie les informations du document d'urbanisme (PLU, PLUi, POS, CC, PSMV) pour une position donnée par sa longitude et sa latitude (source: Géoplateforme - (WFS Géoportail de l'Urbanisme)).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lon | Yes | La longitude du point | |
| lat | Yes | La latitude du point |
Implementation Reference
- src/tools/UrbanismeTool.ts:25-28 (handler)The execute method of UrbanismeTool, which handles the tool invocation by logging and calling the getUrbanisme helper function.async execute(input: UrbanismeInput) { logger.info(`urbanisme(${input.lon},${input.lat})...`); return getUrbanisme(input.lon, input.lat); }
- src/tools/UrbanismeTool.ts:14-23 (schema)Zod-based input schema defining longitude (lon) and latitude (lat) as numbers with descriptions.schema = { lon: { type: z.number(), description: "La longitude du point", }, lat: { type: z.number(), description: "La latitude du point", }, };
- src/tools/UrbanismeTool.ts:10-12 (registration)Class definition extending MCPTool, setting the tool name to 'urbanisme' and providing a detailed description including the data source.class UrbanismeTool extends MCPTool<UrbanismeInput> { name = "urbanisme"; description = `Renvoie les informations du document d'urbanisme (PLU, PLUi, POS, CC, PSMV) pour une position donnée par sa longitude et sa latitude (source: ${URBANISME_SOURCE}).`;
- src/gpf/urbanisme.js:30-65 (helper)Helper function that performs the actual API call to Géoplateforme WFS service to retrieve urbanisme features (SCOT, PLU, etc.) within 30 meters of the given coordinates, processes the features to include type, id, bbox, and distance.export async function getUrbanisme(lon, lat) { logger.info(`getUrbanisme(${lon},${lat})...`); // note that EPSG:4326 means lat,lon order for GeoServer -> flipped coordinates... const cql_filter = `DWITHIN(the_geom,Point(${lat} ${lon}),30,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: URBANISME_TYPES.join(','), outputFormat: 'application/json', cql_filter: cql_filter }).toString(); const featureCollection = await fetchJSON(url); return 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 ) * 1000.0) }, feature.properties); }); }