How do you generate a RandomPoint
in a geographic region?
state = Entity["AdministrativeDivision", {"Illinois", "UnitedStates"}];
GeoGraphics[{EdgeForm[Red], Opacity[0.1], Polygon[state]}]
This produces the polygon outline of the state. I would like to get a random point (location coordinates) in the geographic region. I tried -
RandomPoint[Polygon[state]]
but this gives the error
RandomPoint::creg: The first argument Polygon[Illinois, United States] is expected to be a parameter-free region. >>
How do you use RandomPoint
for geographic regions?
GeoPosition[ RandomPoint[ EntityValue[state, EntityProperty["AdministrativeDivision", "Polygon"]] /. GeoPosition -> Identity]]
$\endgroup$Polygon
is doing something special with a geographic object. Thanks for the workaround. $\endgroup$