<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.5296.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV dir=ltr align=left><SPAN class=654302116-27042006><FONT face=Arial
color=#0000ff size=2>A postgis database would be your best bet for
this. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=654302116-27042006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=654302116-27042006><FONT face=Arial
color=#0000ff size=2><A
href="http://pgfoundry.org/projects/pginstaller">http://pgfoundry.org/projects/pginstaller</A> has
a nice version of Postgis that works well with MS4W. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=654302116-27042006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=654302116-27042006><FONT face=Arial
color=#0000ff size=2>If you aren't familiar with Relational databases I'd
recommend looking at a quick SQL tutorial first <A
href="http://www.w3schools.com/sql/default.asp">http://www.w3schools.com/sql/default.asp</A>.
Then install Postgis. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=654302116-27042006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=654302116-27042006><FONT face=Arial
color=#0000ff size=2>You can easily turn a shapefile with points for your
locations (Coffee Shops, Wifi HotSports, Cell Sites, etc.) into a postgis
database by using the shp2pgsql application (command line application that comes
with PostGis). You can also use ogr2ogr and acheive the same
results. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=654302116-27042006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=654302116-27042006><FONT face=Arial
color=#0000ff size=2>shp2pgsql -d/-a -D will use a binary format to upload your
shapefile to the Database and is much faster and using just -d or -a. just
run the shp2pgsql command with no arguments and it will give you an explanation
of what each command does.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=654302116-27042006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=654302116-27042006><FONT face=Arial
color=#0000ff size=2>To speed up your query, I'd recommend making a spatial
index and doing all the necessary steps mentioned on the Postgis website (<A
href="http://postgis.refractions.net/docs/">http://postgis.refractions.net/docs/</A>).
</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=654302116-27042006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=654302116-27042006><FONT face=Arial
color=#0000ff size=2>Your query will look just like the SQL queries above but
with some added information. If you do a select distance_sphere
instead of a select distance you will get very accurate
results.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=654302116-27042006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=654302116-27042006><FONT face=Arial
color=#0000ff size=2>Your final query will look something like
this:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=654302116-27042006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=654302116-27042006><FONT face=Arial
color=#0000ff size=2>select distance_sphere(SetSRID(the_geom,4326),
GeomFromText( 'POINT($long $lat)', 4326)) as dist, * from on_air_sites order by
dist asc limit 5;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=654302116-27042006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=654302116-27042006><FONT face=Arial
color=#0000ff size=2>That query would return the five closets items to the $long
and $lat you have entered. You could incorporate this query into mapscript
plot a map of the closet Widget Factories, or you could just use a display of
the data of the closest locations. The 4326 is the projection you are
using for your data. This is pulled from the PROJ installation and as long
as proj knows the projection you can query with postgis in that
projection.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=654302116-27042006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=654302116-27042006><FONT face=Arial
color=#0000ff size=2>Postgis is a very powerful analysis tool. For other
questions, I'd refer you to the postgis mailing lists.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=654302116-27042006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV><FONT face=Tahoma>Adam Taylor </FONT></DIV>
<DIV><FONT face=Tahoma>iPCS Wireless Inc
</FONT></DIV>
<DIV><FONT face=Arial color=#808080 size=1>(616) 656-2970</FONT><SPAN
lang=en-us> <FONT face=Wingdings color=#808080 size=2>(</FONT><FONT face=Arial
color=#808080 size=1> | (616) 706-7393</FONT> <FONT face=Webdings
color=#808080 size=4>È</FONT></SPAN></DIV>
<DIV> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> ms4w-users-bounces@lists.maptools.org
[mailto:ms4w-users-bounces@lists.maptools.org] <B>On Behalf Of </B>Mark
Ford<BR><B>Sent:</B> Thursday, April 27, 2006 12:15 PM<BR><B>To:</B>
ms4w-users@lists.maptools.org<BR><B>Subject:</B> [ms4w-users] find my
nearest?<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I have been asked to implement a GIS enabled system
with "find my nearest" functionality. Can MapServer achieve this or (as I
suspect) is it more of a postcode address finder type problem. if you know what
i mean.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I am thinking i may have to use PAF to do the find
my nearest thing and then plot the results on a map using map
server?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Any andvice at all greatly
appreciated,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Mark</FONT></DIV></BODY></HTML>