# Point in Polygon Checker

Test latitude/longitude points against a polygon geofence. Paste GeoJSON or lat,lon lines, choose boundary handling, and export text, CSV, or JSON.

## Run it

- **CLI:** `gizza tool geofence-check '0,0
0,10
10,10
10,0   (or GeoJSON: {"type":"Polygon","coordinates":[[[0,0],[10,0],[10,10],[0,10],[0,0]]]})' 'points=40.0,-105.0,Depot
41.25,-106.5,Warehouse'`
- **Web:** https://gizza.ai/tools/geofence-check/
- **Agents:** machine-readable descriptor (parameters JSON Schema) at https://gizza.ai/tools/geofence-check/tool.json

## Inputs

- `polygon` — Polygon boundary _(field)_
- `points` — Points to test (lat,lon per line) _(field)_
- `coord_order` — Coordinate order (non-GeoJSON) _(field)_
- `boundary` — On-boundary points count as _(field)_
- `output` — Output format _(field)_

## Output

- Result (text)

## Query parameters

Open the tool pre-filled and auto-run via URL:

- `polygon` — Polygon boundary
- `points` — Points to test (lat,lon per line)
- `coord_order` — Coordinate order (non-GeoJSON)
- `boundary` — On-boundary points count as
- `output` — Output format

Example: `https://gizza.ai/tools/geofence-check/?polygon=0%2C0%0A0%2C10%0A10%2C10%0A10%2C0%20%20%20%28or%20GeoJSON%3A%20%7B%22type%22%3A%22Polygon%22%2C%22coordinates%22%3A%5B%5B%5B0%2C0%5D%2C%5B10%2C0%5D%2C%5B10%2C10%5D%2C%5B0%2C10%5D%2C%5B0%2C0%5D%5D%5D%7D%29&points=40.0%2C-105.0%2CDepot%0A41.25%2C-106.5%2CWarehouse&coord_order=lat_lon&boundary=inside&output=text`

---

## About this tool

This point-in-polygon checker tests a batch of latitude/longitude points against
one geofence polygon and reports whether each point is inside, outside, or exactly
on the boundary. It is built for quick geofencing QA: paste a boundary, paste
points from a spreadsheet or a GeoJSON export, choose how boundary points should
be classified, and copy the text, CSV, or JSON result.

The polygon input accepts:

- GeoJSON `Polygon` or `MultiPolygon`, including holes and `Feature` wrappers.
- A simple ring as one coordinate pair per line.
- A JSON array of coordinate pairs for quick scripted input.

Point input accepts CSV-style `lat,lon[,label]` lines, JSON arrays/objects, and
GeoJSON `Point`, `MultiPoint`, `Feature`, or `FeatureCollection` values. For
non-GeoJSON formats you can choose `lat,lon` or `lon,lat`; GeoJSON always uses
standard `[longitude, latitude]` ordering.

### Worked example

Use this square polygon:

```text
0,0
0,10
10,10
10,0
```

and these points:

```text
5,5,Center
10,5,Edge
20,20,Far away
```

With **Boundary = Inside** and **Output = Text**, the result is:

```text
3 points: 2 inside, 1 outside
#1  5, 5 (Center)  inside
#2  10, 5 (Edge)  inside
#3  20, 20 (Far away)  outside
```

Switch to CSV for spreadsheet-friendly `point,latitude,longitude,label,status`
rows, or JSON for structured test results.

## FAQ

<details>
<summary>Does it support holes and multipolygons?</summary>

Yes. GeoJSON polygons can include interior rings; a point inside a hole is
reported outside. `MultiPolygon` inputs are treated as a union of polygons, so a
point is inside when it falls inside any polygon part and not inside that part's
holes.

</details>

<details>
<summary>Which coordinate order should I pick?</summary>

Use **Latitude, Longitude** for ordinary pasted rows such as `40.0,-105.0`.
Choose **Longitude, Latitude** when your non-GeoJSON source is written in GIS
`x,y` order. GeoJSON ignores this setting because GeoJSON coordinates are always
`[longitude, latitude]`.

</details>

<details>
<summary>How are points exactly on the polygon edge handled?</summary>

The **On-boundary points count as** control decides that. Pick **Inside** to match
common geofence behavior, **Outside** for strict containment, or **Boundary** when
you want edge hits reported as their own status in the output.

</details>

<details>
<summary>Can I draw a polygon on a map or import KML/GPX?</summary>

No. This is a deterministic text/GeoJSON checker, not an interactive map editor.
Convert KML or GPX to GeoJSON first, or paste simple coordinate lines. It also
uses decimal degrees only and does not reproject coordinates from other CRSs.

</details>

## Related tools

- [Base Decoder](https://gizza.ai/tools/base-decoder/): Auto-detect and decode Base16, Base32, Base45, Base58, Base64, and Base85 text, including nested layers, locally in your browser.
- [Before / after image slider generator](https://gizza.ai/tools/before-after-slider/): Turn two images into an interactive before/after comparison slider: one self-contained HTML file with inline CSS + JS, no libraries.
- [BSON Inspector](https://gizza.ai/tools/bson-inspector/): Paste BSON bytes as base64 or hex and inspect a typed tree or canonical MongoDB Extended JSON v2 with ObjectId, dates, binary, and int64 preserved.
- [Preview a Bulk File Rename](https://gizza.ai/tools/bulk-file-renamer/): Preview old-to-new filename mappings with find/replace, regex, numbering, case conversion, prefix/suffix, and collision warnings.
- [Decode/Transform Recipe Pipeline](https://gizza.ai/tools/cyberchef-pipeline/): Chain byte-level decode/transform steps — Base64, hex, URL, gzip/zlib, XOR, ROT13 — into one recipe, applied top to bottom. Free, private, runs entirely in your browser.
