Download: Drupal Distance Search Module (605 kb)
Description
The Distance Search module enables location based relationships between nodes by using the Great Circle Formula to calculate the distance between zip codes. Any content type containing a CCK field containing a US zip code can be used. This module also supports CCK address fields.
This module makes use of zip code data freely available at populardata.com. Although suitable for most applications, the data is a few years old and may not include information for the latest zip codes. If your application requires the most up-to-date information there are settings to use any MySQL table containing zip codes with longitude and latitude coordinates. Many companies sell up-to-date zip code data.
After installation and configuration a new block named 'Distance Search' is available that displays nodes within a user configurable radius of a viewed node. For example, let’s say your application has a Store content type that includes a CCK address field. When a user views a store node, the distance search block automatically lists other stores nearby.
This module also creates a new search page that allows users to enter any zip code to find nodes within a set mile radius. For example, all nodes within 20 miles of 90210. The results are sorted by distance.
Directions:
Installing the module for the first time may take a few minutes as the zip table is populated with the required information.
After installation load the Distance Search Settings page in the Drupal Admin section. This page contains configurations for module defaults, node types, database information, and cache settings.
Default Settings:
This section contains default settings for the module. There are two options:
Node Types:
In this section you can choose which content types to enable Distance Search for. You must check the content type and choose the CCK field containing the zip code or a CCK address field.
Database:
If you would like to use a 3rd party table containing zip code information enter the table name along with the appropriate column names for zip code, longitude, and latitude. Otherwise, leave the default settings to use the included zip code data.
Cache:
Enable or disable the cache. To enable the cache an index of all the zip codes in your content types must be created. This is triggered by running the default cron job, much like the site search index is created. The cache will significantly improve the time it takes to return results, although it may take many hours to create the index.
If you have any questions or suggestions to improve the module please email info@databasepublish.com.
Contact DPCI to
learn more about our Web
content management systems,
digital asset management solutions,
online collaboration software,
custom development,
multi-channel publishing systems, and
workflow management solutions.