Random Point Generation (Halton Sequence)

A week ago a member of Geospatial Society Of Kenya’s Telegram group posed the following question to the members.
“Hello everyone, I’m stuck on performing quasi random (Halton sequence)
sampling within a specified extent. If anyone has any leads on how to do that kindly help..I am.following  a methodology that used Halton sequence sampling which is a quasi random sequence.  Totally stuck on how the whole Halton stuff.. I understand is there’s a python package for Halton sequence. Any idea of how that can be used in arcmap.or qgis
In response to the same, our team developed the following script and is happy to share the steps with our readers:

 Generating Halton sequence over a specified boundary


  1. Python 2.7.x or higher
  2. Shapefile
  3. Packages: pyshp, matplotlib, numpy, shapely, ghalton


  • If you don’t have the requisite packages (c, above) then install them using pip command or python install command
  • In the root folder of the script, create another folder “halton_shp” for storing the shapefile whose bounds will be used to generate quasi-random numbers according to the generalized Halton sequence
  • Open the script using your favorite python editor (Spyder, PyScripter )
  • Make changes to reflect the name/path of your shapefile (no need for .shp) and the number of halton points you want generated within its bounds. (Note: points intersecting the polygon might be less, so set a higher number to maximize your chances)
  • Run the script. It creates another folder “halton_output” with the quasi-random halton points
  • Launch your favorite GIS software (QGIS ) and load the points, polygon, raster, etc

Sample output using Mandera Boundary – Halton points


Download Sample data here

Coming up…

  • Integrate the solution with QGIS, modify code to accept any spatial reference system. Currently, the code works for shapefiles that are in EPSG 4326

Leave a comment

Your email address will not be published. Required fields are marked *