Basic GIS calculations that may be useful in Sahana eden: * Centroid {{{ select name, asText(Centroid(the_geom)) from table where name='location'; }}} * Bounding boxes {{{ select name, asText(Envelope(the_geom) from table where name='location'; select name, extent(the_geom) from table where name = 'location' group by name; }}} * buffer calculations * Distance measurements {{{ select distance( (transform(GeomFromText('Point(lon lat)'), 900913), 26915), (transform(GeomFromText('Point(lon lat)'), 900913), 26915); }}} * intersections {{{ select name from location where GeomFromText('Point(lon lat)',900913) && the_geom AND within (GeomFromText('Point(lon lat)', 900913), the_geom); }}} * Point within polygon {{{ select name from location where GeomFromText('Point(lon lat)', 900913) && the_geom; }}} * Spherical distance {{{ select distance_sphere( (transform(GeomFromText('Point(lon lat)'), 900913), (transform(GeomFromText('Point(lon lat)'), 900913); }}} * Spheroid distance {{{ select distance_spheroid( (GeomFromText('Point(lon lat)'), 900913), (GeomFromText('Point(lon lat)'), 900913), 'SPHEROID["GRS 1980", 6378137, 298.257222101]'); }}}