Spatial queryPro tier

nearest_geometry

N nearest features from any qualified table to a (lat, lon) coordinate. Generalizes nearest_n to non-point geometries — works on polygons (administrative boundaries, OMI zones), lines (roads, rails), and points alike.

Use cases

  • Find the OMI real-estate zone polygon nearest to a property coordinate.
  • Identify the closest road segment for routing pre-processing.
  • Locate the nearest census section polygon (ISTAT).
  • Pick the nearest fault-line trace from INGV when no point falls within radius.

Arguments

NameTypeRequiredDescription
qualified_table string required Schema-qualified target table.
geom_column string optional Geometry column name.
Default geometry.
lat number required Latitude in WGS84.
lon number required Longitude in WGS84.
n integer optional How many results.
Range 1 – 100. Default 10.
max_radius_m number optional Hard radius cap (meters).
Range 1 – 100,000. Default 50,000. Tier-capped.

Example request

curl
bash
curl -X POST https://mcp.qubitdata.it/mcp \
  -H "Authorization: Bearer $QUBITDATA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "nearest_geometry",
      "arguments": {
            "qualified_table": "realestate.ade_omi_zone_geometrie",
            "lat": 45.4642,
            "lon": 9.19,
            "n": 3
      }
    }
  }'

Example response

JSON-RPC 2.0 result
json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "[\n  { \"id\": 12504, \"zona\": \"B1\", \"fascia\": \"Centrale\", \"comune\": \"Milano\", \"distance_m\": 0 },\n  { \"id\": 12508, \"zona\": \"B2\", \"fascia\": \"Centrale\", \"comune\": \"Milano\", \"distance_m\": 230 }\n]"
      }
    ]
  }
}

Prompts to try

Drop these into Claude Desktop, Cursor, or any MCP-aware client wired to https://mcp.qubitdata.it/mcp.

  • Claude Desktop
    Which OMI real-estate zone contains (45.4642, 9.1900)? Use nearest_geometry on realestate.ade_omi_zone_geometrie.
  • Cursor
    Find the 5 nearest census sections (census_geom.istat_basi_territoriali) to my coordinate.
  • Custom MCP client
    For a list of points, find the nearest road in mobility.osm_roads.

Related tools

nearest_n · snap_to_geometry · points_in_polygon

Get started

Sign up for a free key to call this tool from your agent. Need a wider geo cap or higher quota? See pricing.

Last updated: