GARS
Not logged in

Global Area Reference System (GARS) is a notation for describing an area.

See the Wikipedia entry for GARS for more information on how GARS is used to describe an area.

SpatiaLite supports a two operations on GARS: ToGARS, which takes a point (geometry blob) and returns the GARS area (as text) that contains that point. GARSMbr, which provides the bounding rectangle that corresponds to a GARS area.

Note that you can't turn a GARS reference back into a point (or a linestring) - it inherently (and only) represents an area.

spatialite> SELECT ToGARS(MakePoint(11.25, 43.76));
383MD27
spatialite> SELECT AsText(GARSMbr("383MD27"));
POLYGON((11.25 43.75, 11.333333 43.75, 11.333333 43.833333, 11.25 43.833333, 11.25 43.75)) 

For the purposes of ToGARS, a point that lies on the line that divides two areas is considered to be in the area to the north or east. Another way to think about this is that the West and South boundaries of a GARS area are inclusive, and the East and North boundaries are non-inclusive.

GARSMbr works on 5 (30 minute by 30 minute cells), 6 (15 minute by 15 minute segments with cells) and 7 (5 minute by 5 minute keypads) alphanumeric references. The size of the boundary rectangle just reflects the size of the area (cell, segment or keypad).