Spatial queryPro tier
nearest_n
Return the N nearest POIs to (lat, lon), optionally filtered by theme. Differs from spatial_search by always returning up to N results regardless of distance, capped at max_radius_m. Use when you want a fixed result count, not a fixed radius.
Use cases
- Always show the 5 closest hospitals regardless of how far the user is from urban centers.
- Build a route-planning UI that needs the K nearest charging stations / transit stops.
- Avoid empty results in rural areas where a fixed-radius search would return nothing.
- Generate a “nearest of each kind” feature pack by calling once per theme.
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
| lat | number | required | Latitude in WGS84. |
| lon | number | required | Longitude in WGS84. |
| n | integer | optional | How many results. Range 1 – 100. Default 10. |
| theme | string | optional | Restrict to a single theme schema. |
| max_radius_m | number | optional | Hard radius cap (meters). Range 100 – 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_n",
"arguments": {
"lat": 41.9028,
"lon": 12.4964,
"n": 5,
"theme": "education"
}
}
}'
Example response
JSON-RPC 2.0 result
json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"content": [
{
"type": "text",
"text": "[\n { \"name\": \"Liceo Visconti\", \"source\": \"education.miur_scuole\", \"distance_m\": 280, \"lat\": 41.9015, \"lon\": 12.4951 },\n { \"name\": \"Istituto San Giuseppe\", \"source\": \"education.miur_scuole\", \"distance_m\": 412, \"lat\": 41.9061, \"lon\": 12.4992 }\n]"
}
]
}
}
Prompts to try
Drop these into Claude Desktop, Cursor, or any MCP-aware client wired to https://mcp.qubitdata.it/mcp.
-
Claude Desktop
Show the 5 nearest pharmacies to the Colosseum.
-
Cursor
Use nearest_n with theme=mobility to return the 10 closest train stations to my coordinate.
-
Custom MCP client
For each property in the batch, fetch the 3 nearest schools.
Related tools
spatial_search · nearest_geometry · site_profile
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: