Latest Register Log In

+ Advanced Search

Searching by Coordinates

Searching by Coordinates

Sometimes you may wish to construct a search (either as a link or as a form) which will show everything within x distance of a given set of latitude and longitude coordinates. You can achive this by passing the zipsource parameter as an array where element 0 is the latitude and element 1 is the longitude. In a URL, &zipsource[0]=37.316&zipsource[1]=-120.042 ... and in a form, <input type="hidden" name="zipsource[0]" value="37.316"><input type="hidden" name="zipsource[1]" value="-120.042">

A complete search link with a 50 mile range and no search term filtering for the coordinates 37.316,-120.042 would be yoursiteurl/search.php?condition=or&filled=1&search=&whichtype=links&zipmiles=50&zipsource[0]=37.316&zipsource[1]=-120.042

To construct a complete search form, just copy the simple or advanced search form and add the zipsource[0], zipsource[1] and zipmiles as hidden inputs. To construct a search link that filters in any desired way, simply run the desired search, copy the url from your browser address bar, and add the three paramaters &zipmiles=50&zipsource[0]=37.316&zipsource[1]=-120.042 to the end of the url.

If you just want to show stuff near the person who's reading the page, you can use zipsource=visitorlocation

Views 54 views. Averaging 0 views per day.