3. “The future belongs to those who
understand how to use location data,
tools, and services successfully”
http://www.flickr.com/photos/crschmidt/4972140289/
44. W W W . R E F R A C T I O N S . N E T
Sample PostGIS Queries
3. Find all docks that are contained
completely within a lake, not touching a
lake bank.
SELECT a.id
FROM docks a, lakes b
WHERE a.geom && b.geom
AND ST_Relate(a.geom, b.geom, ‘ ’);
SELECT a.id
FROM docks a, lakes b
WHERE a.geom && b.geom
AND ST_Relate(a.geom, b.geom, ‘TFF ’);
SELECT a.id
FROM docks a, lakes b
WHERE a.geom && b.geom
AND ST_Relate(a.geom, b.geom, ‘TFFTFF ’);
SELECT a.id
FROM docks a, lakes b
WHERE a.geom && b.geom
AND ST_Relate(a.geom, b.geom, ‘TFFTFF212’);
SELECT a.id
FROM docks a, lakes b
WHERE a.geom && b.geom
AND ST_Relate(a.geom, b.geom, ‘TFFTFF212’);
45.
46. What about the frontend
Google Maps Openlayers
Fusion Tables
60. class CreateWadusPolygons1 < ActiveRecord::Migration
def self.up
create_table :wadus_polygons do |t|
t.geometry :the_geom, :srid => 4326, :null => false
t.timestamps
end
end
def self.down
drop_table :wadus_polygons
end
end
61. class WadusPoint < ActiveRecord::Base
has_geom :the_geom => :point
end
class WadusPolygon < ActiveRecord::Base
has_geom :the_geom => :polygon
end
74. ActiveRecord distance-based finders
IP-based location lookup utilizing
hostip.info
A before_filter helper to geocoder the
user's location based on IP address,
and retain the location in a cookie.