]> granicus.if.org Git - postgis/commitdiff
provide table example for parse_address
authorRegina Obe <lr@pcorp.us>
Tue, 5 Jan 2016 23:48:39 +0000 (23:48 +0000)
committerRegina Obe <lr@pcorp.us>
Tue, 5 Jan 2016 23:48:39 +0000 (23:48 +0000)
closes #3417

git-svn-id: http://svn.osgeo.org/postgis/trunk@14552 b70326c6-7e19-0410-871a-916f4a2858ee

doc/extras_address_standardizer.xml

index 3fffec309642a94d079e7127dfe306ce2b98ecdf..0cebd21e557ffe9fee8bcdb0d5ce6d9106be1b3e 100644 (file)
@@ -597,12 +597,40 @@ into includes in the future for easier maintenance.</para></listitem>
                <refsection>
                        <title>Examples</title>
        
-                       <programlisting>SELECT num, street, city, zip, zipplus FROM parse_address('1 Devonshire Place, Boston, MA 02109-1234');
+                       <para>Single Addresss</para>
+                       <programlisting>SELECT num, street, city, zip, zipplus 
+       FROM parse_address('1 Devonshire Place, Boston, MA 02109-1234') AS a;</programlisting>
+<screen>       
  num |      street      |  city  |  zip  | zipplus
 -----+------------------+--------+-------+---------
- 1   | Devonshire Place | Boston | 02109 | 1234                        
-</programlisting>
+ 1   | Devonshire Place | Boston | 02109 | 1234                </screen>       
 
+                       <para>Table of addresses</para>
+                       <programlisting>-- basic table
+CREATE TABLE places(addid serial PRIMARY KEY, address text);
+
+INSERT INTO places(address)
+VALUES ('529 Main Street, Boston MA, 02129'),
+ ('77 Massachusetts Avenue, Cambridge, MA 02139'),
+ ('25 Wizard of Oz, Walaford, KS 99912323'),
+ ('26 Capen Street, Medford, MA'),
+ ('124 Mount Auburn St, Cambridge, Massachusetts 02138'),
+ ('950 Main Street, Worcester, MA 01610');
+
+ -- parse the addresses 
+ -- if you want all fields you can use (a).*
+SELECT addid, (a).num, (a).street, (a).city, (a).state, (a).zip, (a).zipplus
+FROM (SELECT addid, parse_address(address) As a
+ FROM places) AS p;</programlisting>
+<screen> addid | num |        street        |   city    | state |  zip  | zipplus
+-------+-----+----------------------+-----------+-------+-------+---------
+     1 | 529 | Main Street          | Boston    | MA    | 02129 |
+     2 | 77  | Massachusetts Avenue | Cambridge | MA    | 02139 |
+     3 | 25  | Wizard of Oz         | Walaford  | KS    | 99912 | 323
+     4 | 26  | Capen Street         | Medford   | MA    |       |
+     5 | 124 | Mount Auburn St      | Cambridge | MA    | 02138 |
+     6 | 950 | Main Street          | Worcester | MA    | 01610 |
+(6 rows)</screen>
                </refsection>
        
                <!-- Optionally add a "See Also" section -->