[postgis-users] Re: Proximity search by address

mark thomas javaguru at bellsouth.net
Wed Jul 5 06:23:01 PDT 2006


Hello Chris,

I have already done what you're attempting, minus driving instructions
as it wasn't a requirement, but I do have that separatele using Google
Maps - http://www.spatialguru.net/router/.  My solution uses the 2005fe
TIGER/line files, the Perl geocoder from geocoder.us, PL/PERL, and
custom PL/PGSQL functions.  The flow is like this:

1) PL/PERL function invokes geocoder with address
2) Geocoder returns EWKT
3) EWKT converted to Geometry via GeomFromEWKT
4) Geometry buffered by XXX miles
5) Spatial search for all results Intersects this ROI

You can check it out at http://www.demographicsguru.com.  Just click on
the "By Radius" button to do you search.  You must enter an address to
get a direct result; otherwise the following rules apply:

1) if zip code entered, return buffered zip centroid
2) if city and state entered, search for zip code(s) in city/state and
returned buffered zip centroid

When you get a result, click the "View Map" button to see an image of
the buffered area, generated using PHP MapScript.

If this is what you're looking for email me and I can explain it
further.  If you already have PostGIS and MapServer (or code for another
mapping solution, i.e. Google, Yahoo, MSN) set up you could literally
have this up and running in about half an hour or less.

Regards,

Mark Thomas

On Mon, 2006-07-03 at 12:00 -0700,
postgis-users-request at postgis.refractions.net wrote:

> Send postgis-users mailing list submissions to
> 	postgis-users at postgis.refractions.net
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://postgis.refractions.net/mailman/listinfo/postgis-users
> or, via email, send a message with subject or body 'help' to
> 	postgis-users-request at postgis.refractions.net
> 
> You can reach the person managing the list at
> 	postgis-users-owner at postgis.refractions.net
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of postgis-users digest..."
> 
> 
> Today's Topics:
> 
>    1. 1.1.3 compilation problem (Stefano B.)
>    2. AW: [postgis-users] Linear Referencing: Create Measure
>       (D?ster Horst)
>    3. RE: 1.1.3 compilation problem (Mark Cave-Ayland)
>    4. Raster images (Warren Noll)
>    5. Re: Raster images (Stephen Woodbridge)
>    6. bring PostGIS into the raster world (Warren Noll)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Mon, 3 Jul 2006 09:09:29 +0200
> From: "Stefano B." <stefano.bonnin at comai.to>
> Subject: [postgis-users] 1.1.3 compilation problem
> To: "PostGIS Users Discussion" <postgis-users at postgis.refractions.net>
> Message-ID: <095b01c69e6f$a0a56470$0501a8c0 at comai04>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Hi, when I compile postgis 1.1.3 on my freebsd 5.3 os I get the following:
> 
> checking for gcc... gcc
> checking for C compiler default output file name... a.out
> checking whether the C compiler works... yes
> checking whether we are cross compiling... no
> checking for suffix of executables...
> checking for suffix of object files... o
> checking whether we are using the GNU C compiler... yes
> checking whether gcc accepts -g... yes
> checking for gcc option to accept ANSI C... none needed
> checking for g++... g++
> checking whether we are using the GNU C++ compiler... yes
> checking whether g++ accepts -g... yes
> checking whether ln -s works... yes
> checking for iconv_open in -liconv... no
> checking for libiconv_open in -liconv... no
> checking for iconv_open in -lc... no
> checking how to run the C preprocessor... gcc -E
> checking for egrep... grep -E
> checking for ANSI C header files... yes
> checking for sys/types.h... yes
> checking for sys/stat.h... yes
> checking for stdlib.h... yes
> checking for string.h... yes
> checking for memory.h... yes
> checking for strings.h... yes
> checking for inttypes.h... yes
> checking for stdint.h... yes
> checking for unistd.h... yes
> checking iconv.h usability... no
> checking iconv.h presence... no
> checking for iconv.h... no
> checking build system type... i386-unknown-freebsd5.3
> checking host system type... i386-unknown-freebsd5.3
> checking for geos-config... /usr/local/bin/geos-config
> checking for proj... /usr/local/bin/proj
> checking for flex... /usr/bin/flex
> checking for dllwrap... no
> checking for dlltool... no
> checking for bison... bison -y
> checking for perl... /usr/bin/perl
> checking for xsltproc... no
> checking for pdfxmltex... no
> checking for db2pdf... no
> checking for jw... no
> checking which template to use... freebsd
> configure: creating ./config.status
> config.status: creating Makefile.config
> config.status: creating config.h
> config.status: config.h is unchanged
> 
>  SUMMARY
>  -------------------------------------------------------
> 
>  HOST_OS: freebsd5.3
> 
>    PGSQL: /usr/local/pgsql8.1/bin/pg_config
>     GEOS: /usr/local/bin/geos-config (with C-API)
>           (ldflags: -L/usr/local/lib)
>     PROJ: prefix=/usr/local libdir=/usr/local/lib
>    ICONV: 0
> 
>  PORTNAME: freebsd
>    PREFIX: /usr/local/pgsql8.1
>   EPREFIX: ${prefix}
>       DOC: /usr/local/pgsql8.1/doc/contrib
>      DATA: /usr/local/pgsql8.1/share/contrib
>       MAN: /usr/local/pgsql8.1/man
>       BIN: /usr/local/pgsql8.1/bin
>       EXT: /usr/local/pgsql8.1/lib (\$$libdir)
>  -------------------------------------------------------
> 
> gmake -C lwgeom
> gmake[1]: Entering directory `/usr/src/smit/postgis-1.1.3/lwgeom'
> bison -y -vd -p lwg_parse_yy wktparse.y
> wktparse.y:40.14: parse error, unexpected ":", expecting ";" or "|"
> wktparse.y:58.20-32: $3 of `geometry' has no declared type
> wktparse.y:61.6-19: $1 of `geometry' has no declared type
> wktparse.y:145.17: parse error, unexpected ":", expecting ";" or "|"
> wktparse.y:232.14-31: $1 of `geom_multilinestring' has no declared type
> wktparse.y:232.14-34: $2 of `geom_multilinestring' has no declared type
> wktparse.y:235.20-37: $1 of `geom_multilinestring' has no declared type
> wktparse.y:235.20-40: $2 of `geom_multilinestring' has no declared type
> wktparse.y:235.20-43: $3 of `geom_multilinestring' has no declared type
> wktparse.y:238.26-43: $1 of `geom_multilinestring' has no declared type
> wktparse.y:238.26-46: $2 of `geom_multilinestring' has no declared type
> wktparse.y:238.26-49: $3 of `geom_multilinestring' has no declared type
> wktparse.y:238.26-52: $4 of `geom_multilinestring' has no declared type
> gmake[1]: *** [wktparse.tab.c] Error 1
> gmake[1]: Leaving directory `/usr/src/smit/postgis-1.1.3/lwgeom'
> gmake: *** [liblwgeom] Error 2
> gmake -C lwgeom
> gmake[1]: Entering directory `/usr/src/smit/postgis-1.1.3/lwgeom'
> bison -y -vd -p lwg_parse_yy wktparse.y
> wktparse.y:40.14: parse error, unexpected ":", expecting ";" or "|"
> wktparse.y:58.20-32: $3 of `geometry' has no declared type
> wktparse.y:61.6-19: $1 of `geometry' has no declared type
> wktparse.y:145.17: parse error, unexpected ":", expecting ";" or "|"
> wktparse.y:232.14-31: $1 of `geom_multilinestring' has no declared type
> wktparse.y:232.14-34: $2 of `geom_multilinestring' has no declared type
> wktparse.y:235.20-37: $1 of `geom_multilinestring' has no declared type
> wktparse.y:235.20-40: $2 of `geom_multilinestring' has no declared type
> wktparse.y:235.20-43: $3 of `geom_multilinestring' has no declared type
> wktparse.y:238.26-43: $1 of `geom_multilinestring' has no declared type
> wktparse.y:238.26-46: $2 of `geom_multilinestring' has no declared type
> wktparse.y:238.26-49: $3 of `geom_multilinestring' has no declared type
> wktparse.y:238.26-52: $4 of `geom_multilinestring' has no declared type
> gmake[1]: *** [wktparse.tab.c] Error 1
> gmake[1]: Leaving directory `/usr/src/smit/postgis-1.1.3/lwgeom'
> gmake: *** [liblwgeom] Error 2
> 
> 
> I have compiled with:
> ./configure --with-pgsql=/usr/local/pgsql8.1/bin/pg_config --with-geos --with-proj
> gmake
> 
> thanks in advance
> Stefano
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://lists.refractions.net/pipermail/postgis-users/attachments/20060703/5fb0a4d1/attachment-0001.html
> 
> ------------------------------
> 
> Message: 2
> Date: Mon, 3 Jul 2006 10:24:52 +0100 
> From: D?ster Horst <Horst.Duester at bd.so.ch>
> Subject: AW: [postgis-users] Linear Referencing: Create Measure
> To: 'PostGIS Users Discussion' <postgis-users at postgis.refractions.net>
> Message-ID:
> 	<5B025B1F39D6D4119F5700508BEEEC6603DE417B at srsofaioi4546.ktso.ch>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Hallo strk
> 
> Thak you very much for your response. The required function should measure
> lines or multilines. For instance I need to measure a river network. The
> measures of the rivers are implicit predefined during the creation process
> of the river networkdata and don't represent the real world in all cases.
> The predefinition bases on the two attributes "from" and "to" measure. The
> "from" value represents the lowest measure value and the "to" value highest
> measure value of any linestring in case of our rivernetwork. The units of
> our predefined measures is km and the datatype is float8.  
> The work to do is to interpolate the measure of every vertex point of any
> linestring/multilinestring with respect to "from" and "to". With this
> approach it is also possible to create measures in percent of linelength.
> You have to set from=0 and to=100.
> 
> A second case could be to calculate the measures based on the length of the
> relevant linestring from zero to length. Therefore you don't need to
> predefine from and to.
> 
> In both cases you have to differ between linestrings and multilinestrings.
> In case of continuous linestrings you can interpolate over the whole line.
> In case of multilinestrings you have to consider possible gaps in the
> multilinestring. I'll attach the code of a former version of Christoph
> Spoerri's lrs_create_measure. Unfortunately the lrs_create_measures
> functions don't work correct yet.  
> 
> I think the function call could be:
> line_create_measure(geometry,[float8],[float8])
> 
> line_create_measure(wkb_geometry,from,to) or
> line_create_measure(wkb_geometry,0,1) would solve the first case
> line_create_measure(wkb_geometry) would solve the second case.
> 
> I hope this will be a base for a further discussion.
> 
> With best regards
> 
> Dr. Horst Dster 
> GIS-Koordinator, Stv. Amtschef
> 
> Kanton Solothurn
> Amt fr Geoinformation
> Abteilung SO!GIS Koordination
> Rtistrasse 4
> CH-4501 Solothurn 
> 
> Tel.: ++41 (0)32 627 25 32 
> Fax: ++41 (0)32 627 22 14
> 
> horst.duester at bd.so.ch 
> www.sogis.so.ch
> 
> 
> 
> > -----Ursprngliche Nachricht-----
> > Von: strk at refractions.net [mailto:strk at refractions.net]
> > Gesendet am: Donnerstag, 29. Juni 2006 23:57
> > An: 'postgis-users at postgis.refractions.net'
> > Betreff: Re: [postgis-users] Linear Referencing: Create Measure
> > 
> > Maybe we can add such a function, but semantics must be exactly
> > defined. How are 'from' and 'to' defined ? How are they applied
> > to different types of geometries ?
> > 
> > --strk;
> > 
> > On Thu, Jun 29, 2006 at 11:43:44AM +0100, Dster Horst wrote:
> > > I'm faced with the problem to create MGeometries for using 
> > with the "Linear
> > > Referencing" functions of PostGIS. I like to create the 
> > measures defined by
> > > two table attributes meas_from and meas_to. In further 
> > versions of Christoph
> > > Spoerri's LRS functions there exists a function
> > > lrs_create_measure(geometry,from,to). As the result the 
> > M-Values were
> > > interpolated based on a start and a stop value of each line. The new
> > > functions don't offer such a functionality. I would be 
> > greatful for any hint
> > > how to create measures along a line referenced by a from 
> > and a to value of
> > > this line.
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> > 
> 
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: lwgeom_functions_lrs.c
> Type: application/octet-stream
> Size: 45935 bytes
> Desc: not available
> Url : http://lists.refractions.net/pipermail/postgis-users/attachments/20060703/fb4580f2/lwgeom_functions_lrs.obj
> 
> ------------------------------
> 
> Message: 3
> Date: Mon, 3 Jul 2006 11:47:37 +0100
> From: "Mark Cave-Ayland" <m.cave-ayland at webbased.co.uk>
> Subject: RE: [postgis-users] 1.1.3 compilation problem
> To: "'PostGIS Users Discussion'"
> 	<postgis-users at postgis.refractions.net>
> Message-ID: <200607031047.k63AlgQ05980 at webbased16.localdomain>
> Content-Type: text/plain;	charset="iso-8859-1"
> 
> > From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-
> bounces at postgis.refractions.net] On Behalf Of Stefano B.
> > Sent: 03 July 2006 08:09
> > To: PostGIS Users Discussion
> > Subject: [postgis-users] 1.1.3 compilation problem
> >
> > Hi, when I compile postgis 1.1.3 on my freebsd 5.3 os I get the following:
> 
> (cut)
> 
> > gmake -C lwgeom
> > gmake[1]: Entering directory `/usr/src/smit/postgis-1.1.3/lwgeom'
> > bison -y -vd -p lwg_parse_yy wktparse.y
> > wktparse.y:40.14: parse error, unexpected ":", expecting ";" or "|"
> > wktparse.y:58.20-32: $3 of `geometry' has no declared type
> > wktparse.y:61.6-19: $1 of `geometry' has no declared type
> > wktparse.y:145.17: parse error, unexpected ":", expecting ";" or "|"
> > wktparse.y:232.14-31: $1 of `geom_multilinestring' has no declared type
> > wktparse.y:232.14-34: $2 of `geom_multilinestring' has no declared type
> > wktparse.y:235.20-37: $1 of `geom_multilinestring' has no declared type
> > wktparse.y:235.20-40: $2 of `geom_multilinestring' has no declared type
> > wktparse.y:235.20-43: $3 of `geom_multilinestring' has no declared type
> > wktparse.y:238.26-43: $1 of `geom_multilinestring' has no declared type
> > wktparse.y:238.26-46: $2 of `geom_multilinestring' has no declared type
> > wktparse.y:238.26-49: $3 of `geom_multilinestring' has no declared type
> > wktparse.y:238.26-52: $4 of `geom_multilinestring' has no declared type
> > gmake[1]: *** [wktparse.tab.c] Error 1
> > gmake[1]: Leaving directory `/usr/src/smit/postgis-1.1.3/lwgeom'
> > gmake: *** [liblwgeom] Error 2
> > gmake -C lwgeom
> > gmake[1]: Entering directory `/usr/src/smit/postgis-1.1.3/lwgeom'
> > bison -y -vd -p lwg_parse_yy wktparse.y
> > wktparse.y:40.14: parse error, unexpected ":", expecting ";" or "|"
> > wktparse.y:58.20-32: $3 of `geometry' has no declared type
> > wktparse.y:61.6-19: $1 of `geometry' has no declared type
> > wktparse.y:145.17: parse error, unexpected ":", expecting ";" or "|"
> > wktparse.y:232.14-31: $1 of `geom_multilinestring' has no declared type
> > wktparse.y:232.14-34: $2 of `geom_multilinestring' has no declared type
> > wktparse.y:235.20-37: $1 of `geom_multilinestring' has no declared type
> > wktparse.y:235.20-40: $2 of `geom_multilinestring' has no declared type
> > wktparse.y:235.20-43: $3 of `geom_multilinestring' has no declared type
> > wktparse.y:238.26-43: $1 of `geom_multilinestring' has no declared type
> > wktparse.y:238.26-46: $2 of `geom_multilinestring' has no declared type
> > wktparse.y:238.26-49: $3 of `geom_multilinestring' has no declared type
> > wktparse.y:238.26-52: $4 of `geom_multilinestring' has no declared type
> > gmake[1]: *** [wktparse.tab.c] Error 1
> > gmake[1]: Leaving directory `/usr/src/smit/postgis-1.1.3/lwgeom'
> > gmake: *** [liblwgeom] Error 2
> 
> 
> Hi Stefano,
> 
> If you haven't altered any of the bison grammar files, then it could be that
> you're using a broken version of Bison - I know the PostgreSQL team often
> experience problems with Bison versions > 1.875, which is the version I'm
> using here without any issues.
> 
> What is more interesting is that even though we include
> lex.yy.c/wktparse.tab.c in the release tarballs, under Win32 it seems to
> want to always rebuild these files from the .yy source files if flex/bison
> are found during the configure phase, instead of noticing that the supplied
> files haven't been changed and using them as they are. Does anyone else see
> this behaviour?
> 
> 
> Kind regards,
> 
> Mark.
> 
> ------------------------
> WebBased Ltd
> 17 Research Way
> Plymouth
> PL6 8BT
> 
> T: +44 (0)1752 797131
> F: +44 (0)1752 791023
> 
> http://www.webbased.co.uk   
> http://www.infomapper.com
> http://www.swtc.co.uk  
> 
> This email and any attachments are confidential to the intended recipient
> and may also be privileged. If you are not the intended recipient please
> delete it from your system and notify the sender. You should not copy it or
> use it for any purpose nor disclose or distribute its contents to any other
> person.
> 
> 
> 
> 
> ------------------------------
> 
> Message: 4
> Date: Mon, 3 Jul 2006 09:23:45 -0500
> From: "Warren Noll" <warren.noll at 21csi.com>
> Subject: [postgis-users] Raster images
> To: <postgis-users at postgis.refractions.net>
> Message-ID: <004701c69eac$4b652080$9000a8c0 at 21CSILaptop23>
> Content-Type: text/plain; charset="us-ascii"
> 
> Skipped content of type multipart/alternative-------------- next part --------------
> A non-text attachment was scrubbed...
> Name: not available
> Type: image/jpeg
> Size: 5934 bytes
> Desc: not available
> Url : http://lists.refractions.net/pipermail/postgis-users/attachments/20060703/44631fcc/attachment-0001.jpe
> 
> ------------------------------
> 
> Message: 5
> Date: Mon, 03 Jul 2006 11:09:43 -0400
> From: Stephen Woodbridge <woodbri at swoodbridge.com>
> Subject: Re: [postgis-users] Raster images
> To: Warren.Noll at 21csi.com,	PostGIS Users Discussion
> 	<postgis-users at postgis.refractions.net>
> Message-ID: <44A93337.9060600 at swoodbridge.com>
> Content-Type: text/plain; charset=windows-1252; format=flowed
> 
> Hi Warren,
> 
> There has been a lot of discussion about rasters on the list and the 
> dev-list so you might want to read some of that. But I will summarize in 
> really short form and leave it to others that chime in if I have it 
> wrong ot there are other options.
> 
> Today, I think your best bet it to keep the raster data as files but to 
> use postgres/postgis to the manage you raster colection. So you might 
> include metadata, transform info, size, path to the file on disk, you 
> might also want to create polygon or bbox representations of each raster 
> file so you can use spatial search against these and other data you have 
> in postgis.
> 
> If you are working with mapserver, I would read the mapserver archive 
> for posts by Ed McNierney on rasters. He runs Topozone.com and they have 
> nearly a million rasters online that require ablut 20TB of disk space.
> 
> Hope that helps,
>    -Steve W
> 
> Warren Noll wrote:
> > Im new to PostGIS.  We are using it to access our GIS data, but dont 
> > know for sure the best way to handle raster images.  Any suggestions?
> > 
> >  
> > 
> > Warren Noll
> > 
> > **/21st Century Systems, Inc./**
> > 
> > //199 East 4th Street////, Suite B//
> > 
> > //University of Missouri Technology Park, Building 2081//
> > 
> > //Fort//// Leonard Wood, MO 65473//
> > 
> > //573-329-8526 ext. 2165//
> > 
> > //573-329-8509 (Fax)//
> > 
> > WARREN.NOLL at 21CSI.COM <mailto:WARREN.NOLL at 21CSI.COM>  WWW.21CSI.COM 
> > <http://www.21CSI.COM>
> > 
> >  
> > 
> >  
> > 
> >  
> > 
> > ********************************************************************
> > 
> >   This electronic mail transmission contains confidential
> > 
> >   information intended only for the person(s) named.
> > 
> >   Any use, distribution, copying or disclosure by another
> > 
> >   person is strictly prohibited.
> > 
> > ********************************************************************
> > 
> >  
> > 
> >  
> > 
> > 
> > 
> > 
> > ------------------------------------------------------------------------
> > 
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> 
> 
> 
> ------------------------------
> 
> Message: 6
> Date: Mon, 3 Jul 2006 10:11:50 -0500
> From: "Warren Noll" <warren.noll at 21csi.com>
> Subject: [postgis-users] bring PostGIS into the raster world
> To: <postgis-users at postgis.refractions.net>
> Message-ID: <004d01c69eb3$031e9bb0$9000a8c0 at 21CSILaptop23>
> Content-Type: text/plain; charset="us-ascii"
> 
> Skipped content of type multipart/alternative-------------- next part --------------
> A non-text attachment was scrubbed...
> Name: not available
> Type: image/jpeg
> Size: 5934 bytes
> Desc: not available
> Url : http://lists.refractions.net/pipermail/postgis-users/attachments/20060703/94f23fc3/attachment-0001.jpe
> 
> ------------------------------
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 
> 
> End of postgis-users Digest, Vol 45, Issue 3
> ********************************************

Mark Thomas
Senior Software Engineer
Awarix Corporation
mthomas at awarix.com
http://www.awarix.com

"Commit to the Lord whatever you do, 
    and your plans will succeed." - Proverbs 16:3


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20060705/04bd4944/attachment.html>


More information about the postgis-users mailing list