Skip to main content

A simple Python library based on Shapely to generate random points on Polygon or MultiPolygon

Project description

random-points-on-polygon

A simple Python library based on Shapely to generate random points on Polygon or MultiPolygon

Installation

From PyPI directly:

pip install random-points-on-polygon

Examples

Generate 10 random points on a polygon

from random_points_on_polygon import PointsGenerator
from random_points_on_polygon.samples import POLYGON_SAMPLE_1

pg: PointsGenerator = PointsGenerator(POLYGON_SAMPLE_1)
pg.generate(10)

Get Polygon (or MultiPolygon) including generated points as GeoJSON.

geojson_output: dict = pg.geojson()

Get generated points as GeoJSON

geojson_output: dict = pg.points_as_geojson()

Get Polygon (or MultiPolygon) as GeoJSON

geojson_output: dict = pg.polygon_as_geojson()

Graphically view the result

You can copy and paste the geojson_output content into geojson.io to graphically view the result

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

random-points-on-polygon-0.0.3.tar.gz (8.9 kB view hashes)

Uploaded Source

Built Distribution

random_points_on_polygon-0.0.3-py3-none-any.whl (9.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page