From bc468ce2f2cf19ace5a81110a41c69bf98dd4fa1 Mon Sep 17 00:00:00 2001 From: Regina Obe Date: Sat, 9 Jul 2011 01:23:10 +0000 Subject: [PATCH] example of using geocode geometry filter git-svn-id: http://svn.osgeo.org/postgis/trunk@7623 b70326c6-7e19-0410-871a-916f4a2858ee --- doc/extras_tigergeocoder.xml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/doc/extras_tigergeocoder.xml b/doc/extras_tigergeocoder.xml index 310d67a58..1e434cc2e 100644 --- a/doc/extras_tigergeocoder.xml +++ b/doc/extras_tigergeocoder.xml @@ -109,6 +109,7 @@ DROP TABLE tiger_data.pa_zip_state_loc; setof record geocode norm_addy in_addy integer max_results=10 + geometry restrict_region=NULL norm_addy OUT addy geometry OUT geomout integer OUT rating @@ -128,7 +129,7 @@ DROP TABLE tiger_data.pa_zip_state_loc; - Examples + Examples: Basic The below examples timings are on a fairly old 1.9 GHZ single processor Windows XP machine with 3GB ram running PostgreSQL 9/PostGIS 2.0 loaded with all of Massachusetts state Tiger data. Exact matches are faster to compute (205ms) SELECT g.rating, ST_X(g.geomout) As lon, ST_Y(g.geomout) As lat, @@ -205,6 +206,22 @@ SELECT * FROM addresses_to_geocode WHERE rating is not null; 5 | 950 Main Street, Worcester, MA 01610 | -71.82361 | 42.24948 | 950 Main St, Worcester, MA 01610 | 0 + + Examples: Using Geometry filter + SELECT g.rating, ST_AsText(ST_SnapToGrid(g.geomout,0.00001)) As wktlonlat, + (addy).address As stno, (addy).streetname As street, + (addy).streettypeabbrev As styp, (addy).location As city, (addy).stateabbrev As st,(addy).zip + FROM geocode('31 - 37 Stewart Street, Boston, MA 02116', 5, + ST_GeomFromText('POLYGON((-71.0596 42.35105,-71.05998 42.34914,-71.06106 42.34751,-71.06269 42.34643, +-71.0646 42.34605,-71.06651 42.34643,-71.06814 42.34751,-71.06922 42.34914,-71.0696 42.35105, +-71.06922 42.35296,-71.06814 42.35459,-71.06651 42.35567,-71.0646 42.35605, +-71.06269 42.35567,-71.06106 42.35459,-71.05998 42.35296,-71.0596 42.35105))',4326)) As g; + + rating | wktlonlat | stno | street | styp | city | st | zip +--------+--------------------------+------+--------+------+--------+----+------- + 70 | POINT(-71.0646 42.35105) | 31 | Stuart | St | Boston | MA | 02116 + + -- 2.50.1