Skip to main content
Glama

gva_export_geojson

Export geographic features from Valencian Community GIS data to GeoJSON format using SQL filters, field selection, and result limits.

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

  • TypeScript handler for the 'gva_export_geojson' tool. Queries the GVA GIS FeatureServer with provided parameters, fetches features, converts them to GeoJSON FeatureCollection format, 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), }, ], }; }
  • Python handler for the 'gva_export_geojson' tool in MCP server. Performs query to ArcGIS FeatureServer, converts response features to GeoJSON, and returns as TextContent.
    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 input schema definition for 'gva_export_geojson' tool, including properties for where clause, output fields, and record count.
    { 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: [], }, },
  • Python input schema definition for 'gva_export_geojson' tool within the Tool registration, defining where, out_fields, and result_record_count parameters.
    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": [] } )
  • Tool registration in the list_tools handler for TypeScript MCP server, including gva_export_geojson.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ { name: "gva_layer_info", description: "Get metadata information about the GVA GIS layer (fields, geometry type, spatial reference, extent)", inputSchema: { type: "object", properties: {}, required: [], }, }, { name: "gva_query", description: "Query features from the GVA GIS layer with SQL-like WHERE clause and optional parameters", inputSchema: { type: "object", properties: { where: { type: "string", description: 'SQL WHERE clause (e.g., "1=1" for all, "MUNICIPIO=\'Valencia\'")', default: "1=1", }, out_fields: { type: "string", description: "Comma-separated field names or '*' for all fields", default: "*", }, return_geometry: { type: "boolean", description: "Whether to return geometry data", default: true, }, result_record_count: { type: "number", description: "Maximum number of records to return", default: 10, }, result_offset: { type: "number", description: "Offset for pagination", default: 0, }, }, required: [], }, }, { name: "gva_count", description: "Count features matching a WHERE clause", inputSchema: { type: "object", properties: { where: { type: "string", description: 'SQL WHERE clause (e.g., "1=1" for all)', default: "1=1", }, }, required: [], }, }, { 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: [], }, }, ] as Tool[], }; });

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