geoprimsField-grade geospatial math

Random sample points in a polygon

A simple random sample: N points spread uniformly over a polygon, holes left out, reproducible from a seed, with the area each point stands for.

Experimental: not yet fully verified. How results are checked

10,429.6m²

10 random points, one for every 10,429.6 m², from seed 42.

Points
LatitudeLongitude
40.0012676 deg-104.9990808 deg
40.0018569 deg-104.9990814 deg
40.0029772 deg-104.9990544 deg
40.0020925 deg-104.9983210 deg
40.0021021 deg-104.9972855 deg
40.0028821 deg-104.9998478 deg
40.0016783 deg-104.9974210 deg
40.0021967 deg-104.9984916 deg
40.0020620 deg-104.9993843 deg
40.0022478 deg-104.9987153 deg
Polygon area
Points placed
Seed
Plane
Design
Provenance
Computed by
geometry.sampling.random-points 1.0.0, core 0.1.0
Model
The polygon is carried to its UTM zone's transverse Mercator plane and cut into triangles by ear clipping; each point takes two draws from xoshiro256**: the first picks a triangle by its share of the area and, rescaled within that share, is r₁; the second is r₂; P = (1 − √r₁)A + √r₁(1 − r₂)B + √r₁r₂C (Osada et al. 2002 §4.2); then back to latitude and longitude
Accuracy
Every point is inside the polygon as drawn on the plane; uniform by plane area, which differs from ground area by the zone's scale (up to about 0.3% inside a zone)
Notes
1 shown with the answer
Cites
Osada, R., Funkhouser, T., Chazelle, B., and Dobkin, D., ACM Transactions on Graphics, Shape distributions; Blackman, D., and Vigna, S., ACM Transactions on Mathematical Software, Scrambled linear pseudorandom number generators; US Environmental Protection Agency, Guidance on Choosing a Sampling Design for Environmental Data Collection (EPA QA/G-5S)

Something look off?

Your values

Showing an example. Change anything.
KML, KMZ, GPX, GeoJSON, CSV, WKT, or WKB — or drop it on the box. Read on this device.
Run many at once from a CSV

Loading…

How we got thisFormula, worked example, sources, and proof

Model: The polygon is carried to its UTM zone's transverse Mercator plane and cut into triangles by ear clipping; each point takes two draws from xoshiro256**: the first picks a triangle by its share of the area and, rescaled within that share, is r₁; the second is r₂; P = (1 − √r₁)A + √r₁(1 − r₂)B + √r₁r₂C (Osada et al. 2002 §4.2); then back to latitude and longitude

Show your work

  1. Triangles

    ear clipping on the UTM plane

    8 corners, 1 holes = 8 triangles

  2. Points

    P = (1 − √r₁)A + √r₁(1 − r₂)B + √r₁r₂C

    2 draws per point from xoshiro256**, seed 42 = 10 points

  3. Area per point

    a=A/N

    104,296 m² / 10 = 10,429.6 m²

The same steps an agent gets from the MCP server with explain: true.

Accuracy: Every point is inside the polygon as drawn on the plane; uniform by plane area, which differs from ground area by the zone's scale (up to about 0.3% inside a zone)

When to use this: Use this to pick sample sites, plots, or check points at random inside a field, a stand, or a study area. Enter the boundary, how many points, and a seed; the same seed always gives the same points, so the layout can be shared and checked.

Limitations: Points are uniform over the area on the UTM plane, not over the ground surface, a difference far below field accuracy within one zone. The polygon may span at most 500 km and 2,000 corners. It does not keep points apart; for an even spread use a systematic design.

Worked example: Ten points in a field with a pond, seed 42. Source: A 340 m × 333 m field with a pond as a hole.

You enter

Number of points
10
Polygon
40, -105 40, -104.996 40.003, -104.996 40.003, -105 40.001, -104.999, 1 40.002, -104.999, 1 40.002, -104.998, 1 40.001, -104.998, 1
Seed
42

You get

Area per point
10,429.6 m²
Polygon area
104,296.18 m²
Points placed
10
Seed
42
Plane
UTM zone 13N (WGS 84)
Design
Simple random sampling (EPA QA/G-5S ch. 5)

Review: Not yet independently reviewed by a GIS professional.

Last verified: 2026-10-20, when a maintainer last confirmed this tool's sources at the issuer. See the sources ledger.

Status: version 1.0.0, core 0.1.0. See this tool in the verification report.

Checked against: 22 golden test vectors (download the test vectors, each with its source and tolerance). See how results are checked and every source.

Sources

Experimental means this tool has not yet met the stable bar: at least 20 golden vectors, differential tests, and an independent worked example.