Very cool, jQuery is showing up everywhere!

Unfortunately, the Store Locator does not locate any stores for me, no
matter what I ask it.  Regardless...

Rick, the way to create a store locator from Google Maps is a pretty
easy process, once you learn how to leverage the powerful API.  I
created a store locator with GMaps (before I was jQuery enlightened)
at http://www.pave-eze.com/distributors.php .  The GMaps API works
best with lat/long coordinates, and can find a latitude and longitude
for you with the geocoder method.  However, the geocoder will return
an approximate lat/long if it can't find the address, so I ran my
store addresses through the geocoder, doublechecked the lat/long, and
then committed the lat/long into the database along with the addresses
& phone numbers.  Once you have the store lat/long coords in your db,
the code is similar to the following:

Run the geocoder on the user's address input:
geocoder method is async, and requires an anonymous callback function
(just like jQuery) to which it passes a point object (GLatLng object).

var address = document.getElementById('address').value;
if (geocoder) {
     geocoder.getLatLng(address,
          function(point) {
               findDistanceFrom(point);
    });
}

Have your callback function call your distance calculating function.
GMaps will find a distance (in meters) from any point object to
another point object with the distanceFrom method:

distance = point.distanceFrom(store);

(I had to then convert meter distance to miles for us
estadounidenses.)

In my case, I have an array of stores loaded from the DB, and I create
a new sorted stores array in order of distance, and then I redraw the
page with stores in order of distance.  I am assuming you are a)
familiar with JS and b) familiar with the GMaps API.  The source code
is viewable (but not always pretty) at http://www.pave-eze.com/distributors.php
and http://www.pave-eze.com/d_searcher.php .

Hope this helps!  Let me know if this doesn't make sense / you have
further questions.

Charles
doublerebel.com

On Sep 19, 7:11 am, "Rick Faircloth" <[EMAIL PROTECTED]> wrote:
> I'm very interested in how you did the "Store Locator" part
> with the Google Maps API... you didn't happen to write up
> how you did this on a blog somewhere, did you?
>
> Rick
>
> -----Original Message-----
> From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
>
> Behalf Of Giant Jam Sandwich
> Sent: Wednesday, September 19, 2007 9:40 AM
> To: jQuery (English)
> Subject: [jQuery] Re: ANNOUNCE: Meijer.com launches -- using jQuery
>
> * The dropdown menu and refinements dropdown menu (uses Endeca for
> refinements).
> * The slider on the homepage and section pages.
> * The recently viewed items slider (you need to view a couple product
> pages first).
> * The product preview off the subcategory page.
> * All the add to cart and persistent shopping cart layer functionality
> (add 5-6 items).
> * Email this (product) page functionality.
> * Much of the Store Locator (plus Google Maps API).
>
> That is all I can think of for now :)
>
> On Sep 19, 8:27 am, "Andy Matthews" <[EMAIL PROTECTED]> wrote:
> > That's cool. It's a very clean, well done site. What specifically is
> > jQuery-fied?
>
> > -----Original Message-----
> > From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
>
> > Behalf Of Giant Jam Sandwich
> > Sent: Wednesday, September 19, 2007 7:03 AM
> > To: jQuery (English)
> > Subject: [jQuery] ANNOUNCE: Meijer.com launches -- using jQuery
>
> > I am no longer with the agency that built Meijer.com, but I am proud to
> > announce the launch, and the fact that jQuery is doing 98% of the heavy
> > lifting. Take a peek at the persistent cart, product previews, and the
> > slider on the homepage. Just about everything you experience here is a
> > precursor to the plugins I built, and that is only what you can see. There
> > is lots going on behind the scenes.
>
> > This was an intense effort, but as always, there are numerous changes I
> > would make to the implementation. You know how it goes -- one of those
> "what
> > exactly was I thinking when I did that" moments. Still, if you want to
> know
> > how to use jQuery for some intense functionality, check out the
> > "/js/utility_javascript.jsp", and then view the source.
> > If you experience technical difficulties, please do not contact me -- get
> in
> > touch with CS at Meijer :)
>
> > Brian Reindel
> > d'bug @ blog.reindel.com

Reply via email to