Click or drag to resize

DrillDownGeoCoder Class

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release
The DrillDownGeoCoder is a class that performs a GeoCode by progressively selecting a smaller set of regions, narrowing down the search. It has the ability to query the location of a street, street address, postcode, region, city, state or country.
Inheritance Hierarchy
SystemObject
  Telogis.GeoBaseDrillDownGeoCoder

Namespace:  Telogis.GeoBase
Assembly:  geobase.net (in geobase.net.dll) Version: 4.99.0.0
Syntax
public class DrillDownGeoCoder : IDisposable, 
	IRegionSearcher

The DrillDownGeoCoder type exposes the following members.

Constructors
  NameDescription
Public methodDrillDownGeoCoder
Creates a new DrillDownGeoCoder in the specified country.
Top
Properties
  NameDescription
Public propertyCountry
The country this DrillDownGeocoder was initialized to.
Public propertyMixSuburbsAndCities
Determines whether cities and suburbs are treated as members of the same region level.
Public propertyNumRegionLevels
The maximum number of levels in the country's region hierarchy. The hierarchy is determined by the subdivision of administrative regions in the country. In the U.S. there are 3 levels: State, County and City.
Public propertySearchNeighbouringRegions
Switch to turn on or off the search for neighboring regions.
Top
Methods
  NameDescription
Public methodAbortGetRegions
Ends or cancels an asynchronous region search operation.
Public methodAbortGetStreets
Ends or cancels an asynchronous street search operation.
Public methodBeginGetRegions
Begins an asynchronous region search operation.
Public methodCode exampleBeginGetStreets
Begins an asynchronous street search operation.
Public methodCanGetStreet
Determines whether the DrillDownGeoCoder can retrieve streets.
Public methodDispose
Use this method to free the resources allocated to the drilldown geocoder when it is no longer used.
Public methodEndGetRegions
Waits until the search has finished, then returns the search results.
Public methodEndGetStreets
Waits until the search has finished, then returns the search results.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetCurrentPostcode
Returns the postcode that the DrillDownGeocoder is currently working with.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetLargestUnsetLevel
Gets the level of the largest unset region. For example, in the U.S., if you have already set the state (level 0) this will return 1, which corresponds to the county level.
Public methodGetPostCodeLocation
Get the general location of the currently set postcode. See SetPostcode() to set the postcode.
Public methodGetRegions(Int32)
Get the regions that are available in a certain level.
Public methodGetRegions(Int32, Int32)
Get the regions that are available in a certain level. For example, having set the state to California (level 0), calling GetRegions(1) will return regions like Los Angeles county, San Francisco county, San Bernardino county etc.
Public methodGetRegions(Int32, String)
Gets all the regions beginning with the specified search term at the given level.
Public methodGetRegions(Int32, String, Int32)
Searches a specified region level for a region beginning with the given search string.
Public methodGetRegionSearcher
Returns a DDGCRegionSearcher object that performs asynchronous region searches. This object is unique to the DrillDownGeoCoder instance, will cease to function correctly if the DrillDownGeoCoder is disposed.
Public methodGetStreets(String)
Get the streets in the smallest set region that begin with the given search string.
Public methodGetStreets(String, Int32)
Get the streets in the smallest set region that begin with the given search string.
Public methodGetStreetSearcher
Returns a DDGCStreetSearcher object that performs asynchronous street searches. This object is unique to the DrillDownGeoCoder instance, will cease to function correctly if the DrillDownGeoCoder is disposed.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberHasDrillDownGeoCoder
Used to determine whether the information required to perform a drill-down geocode in the specified country is present in the repository.
Public methodIsSet
Determine whether the specified level has been set to a particular region.
Public methodListSetRegions
Returns a list of regions corresponding to each level in the country.
Public methodReset
Reset all the regions, allowing a clean start.
Public methodReset(Int32)
Reset a specified level.
Public methodSetPostcode
Set a postcode for the DrillDownGeocoder to work with.
Public methodSetRegion
Set the DrillDownGeocoder region.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Remarks
The DrillDownGeoCoder class implements IDisposable, and should be either explicitly disposed using Dispose or placed within "using" statements to allow resources to be freed when the object is no longer required.

Related articles: Drill-down Geocoder Tutorial.

Examples
C#
// 
// First, we'll check that we can create a DrillDownGeoCoder in the USA.
// If we can create one, we'll do so. If not, the code will silently exit.
// 
if (!DrillDownGeoCoder.HasDrillDownGeoCoder(Country.USA)) return 0;
DrillDownGeoCoder ddgc = new DrillDownGeoCoder(Country.USA);
Console.WriteLine("DDGC Created");

// 
// Next, we'll find out how many region levels (state, country etc) we need to set
// 
int numRegionLevels = ddgc.NumRegionLevels;

// 
// Get the all possible regions in the first (zeroth) region level...
// Often, you'll want to start a loop here:
// for (each region level) {
//      while (not yet made a selection) {
//          display list of options;
//          ask user to make a selection;
//      }
//      set this region level;
//      move on to the next region level;
// }
RegionSearchResult rsr = ddgc.GetRegions(0);
RegionData[] regionData = rsr.Results;

// 
// You could output them for the user to make a selection
// - this could also be done using a combo/list box
// 
for (int i = 0; i < regionData.Length; i++)
    Console.WriteLine(regionData[i].ToString());

// 
// If you know the start of the region name, you can get a list of
// possible regions with a filter applied:
// 
rsr = ddgc.GetRegions(levelNumber, startOfName);
regionData = rsr.Results;

// 
// Suppose that the second region (element 1) in the regions[] array is the desired
// region for this level, you should set this region in the DrillDownGeoCoder:
// 
ddgc.SetRegion(regionData[1]);

// 
// Repeat the process for the remaining region levels.
// Then, a similar procedure should be made using the ddgc.GetStreets() method.
// This will give a list of appropriate streets. If implemented well,
// a DrillDownGeoCoder provides a fast and effective way of locating a street.
// 
// if (all region levels set) {
//      get the first letter of the street name;
//      display list of matching streets to user;
//      let the user make a selection;
//      display streetData information (location/name of street etc);
// }

// Once you've found a street you can use the StreetData.GetAddressLocation
// method to find the exact location of an address (specified by street number)
See Also