gva_export_geojson
Export geographic features from GVA GIS data to GeoJSON format for analysis, filtering by SQL queries and selecting specific fields.
Instructions
Export features to GeoJSON format
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| where | No | SQL WHERE clause to filter features | 1=1 |
| out_fields | No | Comma-separated field names or '*' for all | * |
| result_record_count | No | Maximum number of features to export |
Implementation Reference
- mcp4gva/server.py:198-231 (handler)Python handler implementation for the gva_export_geojson tool. Queries the ArcGIS FeatureServer with provided parameters, converts the features to GeoJSON FeatureCollection format, and returns it as text content.
elif name == "gva_export_geojson": # Export to GeoJSON url = f"{BASE_URL}/{LAYER_ID}/query" params = { 'where': arguments.get('where', '1=1'), 'outFields': arguments.get('out_fields', '*'), 'returnGeometry': 'true', 'resultRecordCount': arguments.get('result_record_count', 100), 'f': 'json' } data = make_request(url, params) # Convert to GeoJSON features = data.get('features', []) geojson_features = [] for feature in features: geojson_feature = { 'type': 'Feature', 'properties': feature.get('attributes', {}), 'geometry': feature.get('geometry', {}) } geojson_features.append(geojson_feature) geojson = { 'type': 'FeatureCollection', 'features': geojson_features } return [TextContent( type="text", text=json.dumps(geojson, indent=2, ensure_ascii=False) )] - typescript/src/index.ts:262-296 (handler)TypeScript handler implementation for the gva_export_geojson tool. Queries the ArcGIS FeatureServer using fetch, converts features to GeoJSON FeatureCollection, and returns as text content.
case "gva_export_geojson": { // Export to GeoJSON const exportArgs = args as ExportGeoJsonArguments; const url = `${BASE_URL}/${LAYER_ID}/query`; const params: RequestParams = { where: exportArgs.where || "1=1", outFields: exportArgs.out_fields || "*", returnGeometry: "true", resultRecordCount: exportArgs.result_record_count || 100, f: "json", }; const data = await makeRequest(url, params); // Convert to GeoJSON const features = (data.features || []).map((feature: any) => ({ type: "Feature", properties: feature.attributes || {}, geometry: feature.geometry || {}, })); const geojson = { type: "FeatureCollection", features, }; return { content: [ { type: "text", text: JSON.stringify(geojson, null, 2), }, ], }; } - mcp4gva/server.py:108-132 (registration)Registration of the gva_export_geojson tool in the Python MCP server's list_tools() function, including description and input schema.
Tool( name="gva_export_geojson", description="Export features to GeoJSON format", inputSchema={ "type": "object", "properties": { "where": { "type": "string", "description": "SQL WHERE clause to filter features", "default": "1=1" }, "out_fields": { "type": "string", "description": "Comma-separated field names or '*' for all", "default": "*" }, "result_record_count": { "type": "integer", "description": "Maximum number of features to export", "default": 100 } }, "required": [] } ) - typescript/src/index.ts:153-177 (registration)Registration of the gva_export_geojson tool in the TypeScript MCP server's list tools handler, including description and input schema.
{ name: "gva_export_geojson", description: "Export features to GeoJSON format", inputSchema: { type: "object", properties: { where: { type: "string", description: "SQL WHERE clause to filter features", default: "1=1", }, out_fields: { type: "string", description: "Comma-separated field names or '*' for all", default: "*", }, result_record_count: { type: "number", description: "Maximum number of features to export", default: 100, }, }, required: [], }, }, - typescript/src/index.ts:41-45 (schema)TypeScript type definition (schema) for the input arguments of gva_export_geojson.
interface ExportGeoJsonArguments { where?: string; out_fields?: string; result_record_count?: number; }