In our last post, we looked at a simple random point distribution.As you recall from my book, a single random sample may in fact not be totally random – it will have some clustering of locations with sample points, and other areas that lack any sample points. One way around that is to conduct a systematic sample where we have samples placed at regular intervals. The problem with systematic samples is that they may in fact mask an underlying systematic or periodic pattern in the data. Therefore, we showed in the book (Figure 7.9, Case 1) that a systematic unaligned point sample would assure that the entire map space was included in the sample (the systematic part), and that periodicity within the underlying data would be avoided (the unaligned part).
Creating a systematic unaligned point sample is quite easy in SQL. Lets assume we have a grid of quadrats called “tiles”. We can utilize the MinX, MinY, RectWidth and Rectheight function within SQL to offset random points from the lower left of each quadrat.
SELECT NewPoint(MinX([Geom (I)])+rnd*RectWidth([Geom (I)]), MinY([Geom (I)])+rnd*RectHeight([Geom (I)])) AS g FROM tiles
and like we’ve been doing throughout this series, we can wrap that entire query into a NewPoint function to create the points.
This SQL statement creates a new point for each quadrat. We set the origin of each quadrat’s point with the Newpoint(MinX, MinY) syntax. However, by multiplying the height and width by a random number (rnd*RectWidth) and adding it to the origin point, we have randomly placed points within each quadrat, giving us an unaligned grid as shown below:
Comments