Determines if a coordinate point lies inside a polygon boundary using the ray casting algorithm. Access via MCP in Cursor or Windsurf for geofencing logic, or call GET /v1/geo/point-in-polygon directly. Pass latitude/longitude and polygon coordinates — returns true/false. The ray casting method handles complex polygons and edge cases reliably.
curl "https://tinyfn.io/v1/geo/point-in-polygon" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/geo/point-in-polygon', {
headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://tinyfn.io/v1/geo/point-in-polygon',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's geolocation tools:
{
"mcpServers": {
"tinyfn-geo": {
"url": "https://tinyfn.io/mcp/geo",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
Ray casting draws an imaginary line from the point to infinity and counts polygon edge intersections. Odd intersections mean the point is inside, even means outside.
Pass the point as latitude/longitude decimal degrees and polygon as an array of coordinate pairs in the same format.
Yes, AI agents in Cursor or Claude Code can check if user locations fall within delivery zones, restricted areas, or service boundaries using this tool.
The ray casting algorithm works with any simple polygon but doesn't handle holes. For complex polygons with holes, you'll need additional logic.
Edge cases are handled consistently by the algorithm implementation, typically returning true for points on boundaries, but check your specific use case requirements.
Get your free API key and start using Point In Polygon in seconds.
Get Free API Key