Spatial queryPro tier
snap_to_geometry
Snap a noisy (lat, lon) onto the closest feature in any qualified table within max_dist_m. Returns the snapped lon/lat, distance, and feature WKT. Useful to clean up geocoder results that drift onto rooftops or sidewalks.
Use cases
- Fix geocoder output that lands a few meters off the actual road.
- Snap a user-clicked point onto the nearest building footprint.
- Align scraped addresses onto a canonical road network before routing.
- Pre-process noisy GPS traces by snapping each fix to the nearest road segment.
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
| qualified_table | string | required | Target table containing the geometries to snap onto. |
| geom_column | string | optional | Geometry column. Default geometry. |
| lat | number | required | Input latitude (noisy). |
| lon | number | required | Input longitude (noisy). |
| max_dist_m | number | optional | Max distance to consider a snap valid. Range 1 – 5,000. Default 1,000. |
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": "snap_to_geometry",
"arguments": {
"qualified_table": "mobility.osm_roads",
"lat": 45.4642,
"lon": 9.1899,
"max_dist_m": 50
}
}
}'
Example response
JSON-RPC 2.0 result
json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"content": [
{
"type": "text",
"text": "{\n \"snapped_lat\": 45.4641,\n \"snapped_lon\": 9.1898,\n \"dist_m\": 18,\n \"feature_wkt\": \"LINESTRING(9.1895 45.464, 9.1903 45.4642)\"\n}"
}
]
}
}
Prompts to try
Drop these into Claude Desktop, Cursor, or any MCP-aware client wired to https://mcp.qubitdata.it/mcp.
-
Claude Desktop
Snap (45.4642, 9.1899) onto the nearest road in mobility.osm_roads within 50m.
-
Cursor
Use snap_to_geometry to clean each address in my batch onto building footprints.
-
Custom MCP client
For each GPS fix, return the snapped position on the canonical road graph.
Related tools
nearest_geometry · geometry_validate
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: