Geospatial Dealer Locator (Django)
The Geospatial Dealer Locator was developed to allow end customers to locate dealerships for a manufacturing company. The dealership territory boundaries did not naturally align on any particular existing political boundaries, such as cities, counties or zipcodes. Three sets of territories were required in order to support different divisions of products. It also had to support worldwide territories.
Django comes with an impressive open source geospatial stack, including the PostgreSQL database geospatial implementation, UI elements that allow geographical shape manipulation, and many libraries of code in between to make it all happen. The Django Geospatial UI was modified to allow the manufacturer’s marketing department to utilize existing political boundaries where it could, such as Country, State, County, City to define a dealership territory. Then, the territory shape may be arbitrarily modified and copy / pasted to create new territories in other divisions of products. Territories may overlap, causing more dealers to be returned for a specific area.
The customer interface simply accepts an address and then returns the list of dealers that service this address for the different product divisions. Underneath the hood, the address is geocoded by a third party service to provide the longitude and latitude coordinates. Then the Django geospatial stack uses the coordinates to perform the query which identifies which territories contain this point, and the list of the associated dealers.
To the right is a screenshot of a Django admin page. Note the administrator is able to configure regions that correspond to dealer territories. Chris added the ability to copy and paste between these maps, and maps for other dealers, along with the ability to add regions based on country, U.S. state, or U.S. county.