The tool Create Random Point is able to generate a certain number of points within polygons. I am wondering, given a bounding box, is there any way that I can generate random points outside those polygon?

3 Answers 3


Personally I do not like the random point algorithm in ArcGIS. Alternatively, use Geospatial Modelling Environment's (GME) genrandompnts function. You will be able to identify specific polygons where random points will be excluded (see highlighted area in attached .jpg). Best of all this software is free.

GME provides you with a suite of analysis and modelling tools, ranging from small 'building blocks' that you can use to construct a sophisticated work-flow, to completely self-contained analysis programs. It also uses the extraordinarily powerful open source software R as the statistical engine to drive some of the analysis tools. One of the many strengths of R is that it is open source, completely transparent and well documented: important characteristics for any scientific analytical software.

enter image description here

  • 1
    Can you give further info on why you don't like the default random points algorithm, and why GME's is more optimal? Sep 19, 2012 at 23:17
  • @Aaron Nice one! Haven't tried this since it was Hawth's Modelling Tools - I'll have to download it and give it a crack!
    – om_henners
    Sep 19, 2012 at 23:20
  • 3
    @Stephen Within the last month, I was generating random points across four classes. I encountered several issues: 1) ArcGIS produced several points outside of my input polygons 2) Arc had a difficult time dealing with areas too small for my input parameters (e.g.. minimum allowed distance = 50m & points = 50), whereas GME handled these issues by producing random points up until rules were violated then displaying a warning message 3) Arc's RPG is slower than GME's probably due to R's use of local memory.
    – Aaron
    Sep 19, 2012 at 23:54
  • Nice one! Does it have a python bounding so that I can do some batch processing @Aaron ?
    – Seen
    Sep 20, 2012 at 0:56
  • 2
    @Seen check out automation and batch processing section (p10) in the support document: spatialecology.com/gme/images/SpatialEcologyGME.pdf
    – Aaron
    Sep 20, 2012 at 14:07

You are going to have to create a donut polygon with the donut hole representing the interior non-point space and some spatial extent representing the bounding area of the polygonal area.

  • Just an addendum: with an ArcInfo license you can do this with the Erase tool
    – om_henners
    Sep 19, 2012 at 23:18

Sorry, I just can't resist. Since it is always good to know what is going on under the hood with something like GME, here is a solution in actual R code.


# Create example polygon data
x <- readWKT("POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))")
y <- readWKT("POLYGON ((3 3, 7 3, 7 7, 3 7, 3 3))")

# Calculate difference in polygon geometries to create null polygon
d <- gDifference(x,y)

# Create random sample in non-null polygon
rs <- spsample(d, 20, type="random")  

# Plot results  
plot(d, col="red")

This approach is likely very different than how GME does this but is using native R sp spatial classes and a fairly new topology library making the code very efficient. This also gives an example that can easily be wrapped in a for loop.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.