]> granicus.if.org Git - postgis/commitdiff
#1333 geocode intersections
authorRegina Obe <lr@pcorp.us>
Thu, 1 Dec 2011 08:28:22 +0000 (08:28 +0000)
committerRegina Obe <lr@pcorp.us>
Thu, 1 Dec 2011 08:28:22 +0000 (08:28 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@8275 b70326c6-7e19-0410-871a-916f4a2858ee

doc/extras_tigergeocoder.xml
extras/tiger_geocoder/tiger_2010/regress/geocode_regress
extras/tiger_geocoder/tiger_2010/regress/geocode_regress.sql

index 4cd22ceae1b27ba1cf9d20ce76e946b154716d7a..93fbd13d9bc6706a1c8a21c7ddc313c77877946b 100644 (file)
@@ -306,6 +306,71 @@ Total query runtime: 245 ms.
          </refsection>
        </refentry>
        
+       <refentry id="Geocode_Intersection">
+         <refnamediv>
+               <refname>Geocode_Intersection</refname>
+
+               <refpurpose>Takes in 2 streets that intersect and a state, city, zip,  and outputs a set of possible locations on the first cross street that is at the intersection, also includes a point geometry in NAD 83 long lat, a normalized address for each location, and the rating.  The lower the rating the more likely the match.  
+                       Results are sorted by lowest rating first. Can optionally pass in maximum results, defaults to 10</refpurpose>
+         </refnamediv>
+
+         <refsynopsisdiv>
+               <funcsynopsis>
+                 <funcprototype>
+                       <funcdef>setof record <function>geocode</function></funcdef>
+                       <paramdef><type>text </type> <parameter> roadway1</parameter></paramdef>
+                       <paramdef><type>text </type> <parameter> roadway2</parameter></paramdef>
+                       <paramdef><type>text </type> <parameter> in_state</parameter></paramdef>
+                       <paramdef><type choice='opt'>text </type> <parameter> in_city</parameter></paramdef>
+                       <paramdef><type choice='opt'>text </type> <parameter> in_zip</parameter></paramdef>
+                       <paramdef><type choice='opt'>integer </type> <parameter>max_results=10</parameter></paramdef>
+                       <paramdef><type>norm_addy </type> <parameter>OUT addy</parameter></paramdef>
+                       <paramdef><type>geometry </type> <parameter>OUT geomout</parameter></paramdef>
+                       <paramdef><type>integer </type> <parameter>OUT rating</parameter></paramdef>
+                 </funcprototype>
+               </funcsynopsis>
+         </refsynopsisdiv>
+
+         <refsection>
+               <title>Description</title>
+
+               <para>Takes in 2 streets that intersect and a state, city, zip,  and outputs a set of possible locations on the first cross street that is at the intersection, also includes a point geometry in NAD 83 long lat, a normalized address for each location, and the rating.  The lower the rating the more likely the match.  
+                       Results are sorted by lowest rating first. Can optionally pass in maximum results, defaults to 10.
+                       Returns <varname>normalized_address</varname> (addy) for each, geomout as the point location in nad 83 long lat, and the rating.  The lower the rating the more likely the match.  
+                       Results are sorted by lowest rating first.  Uses Tiger data (edges,faces,addr), PostgreSQL fuzzy string matching (soundex,levenshtein) </para>
+
+               <para>Availability: 2.0.0</para>
+               
+         </refsection>
+
+
+         <refsection>
+               <title>Examples: Basic</title>
+               <para>The below examples timings are on a 3.0 GHZ single processor Windows 7 machine with 2GB ram running PostgreSQL 9.0/PostGIS 1.5 loaded with all of MA state Tiger data loaded.</para>
+               <para>Currently a bit slow (3000 ms)</para>
+               <programlisting>SELECT pprint_addy(addy), st_astext(geomout),rating 
+                       FROM geocode_intersection( 'Haverford St','Germania St', 'MA', 'Boston', '02130',1); 
+           pprint_addy            |         st_astext          | rating
+----------------------------------+----------------------------+--------
+98 Haverford St, Boston, MA 02130 | POINT(-71.101375 42.31376) |      0
+</programlisting>
+               <para>Even if zip is not passed in the geocoder can guess (took about 3500 ms)</para>
+               <programlisting>SELECT pprint_addy(addy), st_astext(geomout),rating 
+                               FROM geocode_intersection('Weld', 'School', 'MA', 'Boston');
+          pprint_addy          |        st_astext         | rating
+-------------------------------+--------------------------+--------
+ 98 Weld Ave, Boston, MA 02119 | POINT(-71.099 42.314234) |      3
+ 99 Weld Ave, Boston, MA 02119 | POINT(-71.099 42.314234) |      3
+</programlisting>     
+         </refsection>
+
+         <!-- Optionally add a "See Also" section -->
+         <refsection>
+               <title>See Also</title>
+               <para><xref linkend="Geocode" />,<xref linkend="Pprint_Addy" />,<xref linkend="ST_AsText"/></para>
+         </refsection>
+       </refentry>
+       
        <refentry id="Install_Missing_Indexes">
          <refnamediv>
                <refname>Install_Missing_Indexes</refname>
index 3ad5f09b17da0a0f56af085eaad4d64e35980ea7..e42b930e4b4c7c74c21c7d4b10f9d4d92e8bf48c 100644 (file)
@@ -73,3 +73,6 @@ T18b|26 Court St, Boston, MA 02108|POINT(-71.05885 42.35911)|1
 #1145d|4898 141st St W, Apple Valley, MN 55124|8512 141 St Ct Apple Valley MN 55124|POINT(-93.1625 44.74471)|24
 #1145e|103 E 36th St, Minneapolis, MN 55408|103 36th St W Minneapolis MN 55409|POINT(-93.2766 44.93774)|5
 #1145e|103 W 36th St, Minneapolis, MN 55408|103 36th St W Minneapolis MN 55409|POINT(-93.27979 44.93773)|5
+#1333a|98 Weld Ave, Boston, MA 02119|POINT(-71.099 42.314234)|3
+#1333a|99 Weld Ave, Boston, MA 02119|POINT(-71.099 42.314234)|3
+#1333b|98 Haverford St, Boston, MA 02130|POINT(-71.101375 42.31376)|0
index 6740f414b04e1f68642d3f7ada048228105edd48..249a2b56e1cd9853312cc1da0bb8d75b966660b2 100644 (file)
@@ -94,4 +94,8 @@ SELECT '#1145b' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(S
 SELECT '#1145c' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,2) As g, target FROM (SELECT '4057 10th Ave S Minneapolis MN 55406'::text As target) As f) As foo; 
 SELECT '#1145d' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,2) As g, target FROM (SELECT '8512 141 St Ct Apple Valley MN 55124'::text As target) As f) As foo; 
 SELECT '#1145e' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target) As g, target FROM (SELECT '103 36th St W Minneapolis MN 55409'::text As target) As f) As foo;
+
+SELECT '#1333a' AS ticket, pprint_addy(addy), st_astext(geomout),rating FROM geocode_intersection('Weld', 'School', 'MA', 'Boston');
+SELECT '#1333b' AS ticket, pprint_addy(addy), st_astext(geomout),rating FROM geocode_intersection('Haverford St','Germania St', 'MA', 'Boston', '02130',1);
+--
 \timing