Territories allow your locations to be returned as search results when they are possibly not physically present in a given searched area. This is useful for creating sales territories, defining service areas or delivery boundaries for your locations.
You can create territories from:
- Lists of Countries (as US,CA no spaces)
- Lists of States (as ST,ST no spaces)
- Lists of Cities (as City,ST no space)
- Lists of Counties (US only, as FIPS codes)
- Lists of Postal codes
- Lists of Postal code prefixes (E.g. 532)
- Polygon bounded areas
- Service Radius
- All areas (global territory)
When a geographic search is performed, and a location includes a territory that coincides with that search, it is included with the search results regardless of the location's latitude and longitude.
To create a territory-based search interface, the first step is to create a field to store the territory data. Go to Fields, then click New in the toolbar.
Note the available options within the Territories option group. In this example, we'll create a State List Territory called StateTerritories.
Next, increase the "Field Length" to a length that will contain your list of territories. For very large lists, use the "BLOB/TEXT" (binary large object) size.
Save the field you have created. The next step is to add locations with territory data to your database. This can be done by importing your data in bulk or by editting your locations one by one. In this example, we'll import the data in bulk. We've prepared a CSV file with state territories as shown here:
Download the sample file for an example import file.
We can now import that file by going to Data then Import. Click the Choose File... button and allow the import to proceed. Observe that our individual locations now have lists of state abbreviations in our StateTerritories field. You can see this list by editing a location, and scrolling to the bottom of the Edit Location screen to see the contents of the StateTerritories field as shown here:
Be sure your Territory values are formatted according to this table, taking care not to add spaces between values.
Cities (These values are newline separated and have no spaces between the comma and state)
Counties: 01007,08017,29151 (Do not include an underscore or tract-level FIPS codes. We expect 5 digit codes, US only)
Postal Codes: 80205,90210,80201
Postal Code Prefix: 802,902,801 (See below for additional required settings)
Since our data already has latitude and longitude, we can skip the geocoding process normally required as part of the import process. If your data needs to be geocoded, do that now. That process is covered in various other articles on this site including the Getting Started guide.
Now that data are imported, we are ready to create our Interface. Do this by clicking Interfaces, then New. Choose Locator Layout and provide a Title for the new Interface.
Click over to the Settings tab of the new interface and set the following options:
Data Settings > Enable Territories? : Yes
Save your Interface and click Preview to see the results. The default layout provides a postal code search. Let's try searching for 53202, a Wisconsin postal code. Recall that none of our locations are actually present in Wisconsin, yet we do have a single location that includes WI as a territory. That is the basic Territorial assignment setup.
When creating territories, you can designate how the search system should handle the territory results. Under your Interface Territory Settings you will find a number of options, described here:
- Promote Territories: This option sorts results that are matched by territory higher in the result list versus locations that matched based on distance or other criteria.
- Exclusive Territories: This option ensures that if a location includes a given search area as a territory, then only territory results are returned. This allows locations to exclusively "own" territories. No distance-based search results are included in this case. However, if a search does not include a territory result, then the usual distance-based results are returned.This video shows how Exclusive Territories work:
- Empty Territories. This option disables territory results unless no geographic search results are found. If a search does not return geographic results, then territory results will be included. If a search does return geographic results, then territory results will not be included.
- Include Territories In Drop-downs: Normally the drop-down lists are built from the location values. In this setting, drop-down lists, such as State, are build using both the location's State value and the value of any Territory State fields.
- Include Only Territory Values In Drop-downs: Normally the drop-down lists are built from the location values. In this setting, drop-down lists, such as State, are build using only value of any Territory State fields. The values in the location's State field are ignored.
- Include Only Territory Results in Search: Ignore the location's physical location and return results based only on territory values.
- Default Record ID: When a search is performed, and no results are returned, this location should be returned as the sole result.
- Get County and Neighborhood: Required when creating county (FIPS)-based territories. Be sure your location data is bulk geocoded with the same option enabled, labelled "Include county and neighborhood data".
Postal Code Prefixes
When allowing users to match based on the postal code prefix, MetaLocator uses a two settings found under Advanced settings to enable and configure the prefix match. Shown below, the "Allow Partial Match Keyword" must be enabled to support partial matches. Additionally, the system will look for postal code territories with the length found in the "Partial Match Keyword Length" setting shown below.
Polygon territories allow you to specify a bounded polygon as a territory for a given location. As of this writing, they can not be imported in bulk, only specified in the Control Panel. To create a polygon territory for a location, first create a field under Fields.
Once created, open the location to which a polygon territory will be assigned. The new polygon territory field will be found under Custom Fields and will be displayed as an interactive map.
Pan and zoom the map to the desired area for the territory. Then click points on the map to set the boundaries in a clockwise manner, clicking the first marker as the last step to close the polygon.
Once the polygon has a shaded, filled area, save the location. To re-draw the polygon, click "clear" below the map. Only one polygon per territory field can be specified. For locations with multiple polygon territories, create additional polygon territory fields as needed.
Presuming the Interface has Data Settings > Enable Territories? : Yes enabled, any search that resolves to a latitude/longitude contained within the boundaries of the drawn polygon (or polygons) this location will be returned as a result.
Radius territories allow you to specify a circular range around which the location will be returned as a search result. The field should contain the numerical value of miles or kilometers for the radius. The units (KM or Miles) are determined by the Interface's settings. If it is set to use Miles, the values will be interpreted as miles.
Global territories are useful when a single result should be returned for all search geographies. A global headquarters is an example where this might be useful.