[postgis-users] Randomized PointOnSurface?

Obe, Regina robe.dnd at cityofboston.gov
Mon Oct 15 05:07:15 PDT 2007


Not that I know of - but I think you can probably simulate it with the
Postgresql random() function and modulo operator (%).  Something along
the lines of

SELECT
ST_PointN(geom_exterior,CAST(random()*ST_NumPoints(geom_exterior)*1000
As integer) % ST_NumPoints(geom_exterior) + 1)
FROM
(SELECT ST_ExteriorRing(ST_GeometryN(the_geom,generate_series(1,
ST_NumGeometries(the_geom)))) As geom_exterior 
	FROM sometable) As sometableexterior



Where sometable.the_geom is either a POLYGON or MULTIPOLYGON

Hope that helps,
Regina

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Webb
Sprague
Sent: Monday, October 15, 2007 2:59 AM
To: PostGIS Users Discussion
Subject: [postgis-users] Randomized PointOnSurface?

Is there a randomized (I guess uniformly) function like PointOnSurface
- such that if you call it repeatedly it will give you different
points in the polygon?  it would be cool for dot maps and other
simulation things.

I looked a little bit, I promise.

-W
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.




More information about the postgis-users mailing list