Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
whereNoSQL WHERE clause to filter features1=1
out_fieldsNoComma-separated field names or '*' for all*
result_record_countNoMaximum number of features to export

Implementation Reference

  • 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 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), }, ], }; }
  • 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": [] } )
  • 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 type definition (schema) for the input arguments of gva_export_geojson.
    interface ExportGeoJsonArguments { where?: string; out_fields?: string; result_record_count?: number; }

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/pepo1275/mcp4gva'

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