Catalog/geometry-point-in-polygon

Geometry

Point in polygon test API

Ray-casting point-in-polygon test for arbitrary simple (incl. concave) polygons, also detecting boundary points. Answers 'is this point inside the polygon?', 'is it on an edge?'.

Price$0.02per request
MethodPOST
Route/v1/geometry/point-in-polygon
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
point-in-polygonray-castingcontainmentconcave2dgeometry
API URLhttps://x402.hexl.dev/v1/geometry/point-in-polygon
Integration docs
Example request
{
  "point": [
    2,
    2
  ],
  "polygon": [
    [
      0,
      0
    ],
    [
      4,
      0
    ],
    [
      4,
      4
    ],
    [
      0,
      4
    ]
  ]
}
Example response
{
  "inside": true,
  "onEdge": false,
  "strictlyInside": true
}
Input schema
{
  "type": "object",
  "required": [
    "point",
    "polygon"
  ],
  "properties": {
    "point": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "examples": [
        [
          2,
          2
        ]
      ]
    },
    "polygon": {
      "type": "array",
      "items": {
        "type": "array",
        "items": {
          "type": "number"
        }
      },
      "examples": [
        [
          [
            0,
            0
          ],
          [
            4,
            0
          ],
          [
            4,
            4
          ],
          [
            0,
            4
          ]
        ]
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}