ST_GeneratePoints

Name

ST_GeneratePoints — Converts a polygon or multi-polygon into a multi-point composed of randomly location points within the original areas.

Synopsis

geometry ST_GeneratePoints ( g geometry , npoints numeric ) ;

Description

ST_GeneratePoints generates pseudo-random points until the requested number are found within the input area.

Availability: 2.3.0

Examples

Original Polygon

Generated 12 Points overlaid on top of original polygon

SELECT ST_GeneratePoints(
	ST_Buffer(
		ST_GeomFromText(
		'LINESTRING(50 50,150 150,150 50)'
		), 10, 'endcap=round join=round'), 12);