Telogis.GeoBase.GeoCoder |
Contains functions for sending forward- and reverse-geocoding requests to the GeoStream server. Note that you can enable the GeocodingLogging option to monitor GeoStream geocoding performance. For more information see web.config
Name | Description |
---|---|
GeoCoder.Address | Represents the physical address returned by reverse geocoding. |
GeoCoder.GeoCodeAddress | Represents a LatLon and a physical address, returned as the result of GeoCoding. |
GeoCoder.GeoCodeFull | A composite object that represents the result of a reverse geocoding call. |
GeoCoder.HMMGeoCodeAddress | Represents a LatLon and a physical address, returned as the result of GeoCoding. |
GeoCoder.UnknownGeoCodeAddress | Represents a generic (or 'unknown') LatLon and a physical address. It contains no more than a street address, city, zip code and region. |
GeoCoder.USGeoCodeAddress | Represents a LatLon and a physical address, returned as the result of GeoCoding in the United States. |
Name | Description |
---|---|
geoCode (String address, String country, Function callback, Function errorCallback, Object server) | Converts an address to a set of latlon co-ordinates. JavaScript var address = '20 Enterprise, Aliso Viejo, California'; var country = 'USA'; function myTestFunction() { GeoCoder.geoCode (address, country, function (callback) { // Callback function begins if (callback.length > 0) { var loc = callback[0].getLocation(); alert ('Found ' + callback[0] + ' at LatLon ' + loc); } else { alert ('No matching addresses were found.'); } }, errorCallback ('Geocode')); }; // A compact way of generating error callbacks. // Test by changing 'country' var to an uninstalled region. var errorCallback = function (context) { return function (error) { alert (context + ' failed (' + error.name + '): ' + error.message); }; };
|
geoCodeExtended (String address, String city, String region, Number postalCode, String country, Function callback, Function errorCallback, Object server) | Converts an [extended] address to a set of latlon co-ordinates. JavaScript var address = '20 Enterprise'; var city = 'Aliso Viejo'; var region = 'California'; // Also accepts 'CA' var postalcode = '92656'; var country = 'USA'; function myTestFunction() { GeoCoder.geoCodeExtended (address, city, region, postalcode, country, function (callback) { // Callback function begins if (callback.length > 0) { var loc = callback[0].getLocation(); alert ('Found ' + callback[0] + ' at LatLon ' + loc); } else { alert ('No matching addresses were found.'); } }, errorCallback('Geocode')); }; // A compact way of generating error callbacks. // Test by changing 'country' var to an uninstalled region. var errorCallback = function (context) { return function (error) { alert (context + ' failed (' + error.name + '): ' + error.message); }; };
|
geoCodeStructured (Number number, String prefix, String bf_type, String name, String af_type, String suffix, String city, String region, String postalCode, String country, Function callback, Function errorCallback, Object server) | Converts a [structured] address to a set of latlon co-ordinates. JavaScript var s_number = 17; var s_prefix = 'West'; var s_typebefore = ''; var s_name = 'Ryley'; var s_typeafter = 'Court'; var s_suffix = ''; var s_city = 'Aliso Viejo'; var s_region = 'California'; // Also accepts 'CA' var s_postalcode = '92656'; var s_country = 'USA'; function myTestFunction() { Telogis.GeoBase.GeoCoder.geoCodeStructured (s_number, s_prefix, s_typebefore, s_name, s_typeafter, s_suffix, s_city, s_region, s_postalcode, s_country, function (callback) { // Callback function begins if (callback.length > 0) { var loc = callback[0].getLocation(); alert ('Found ' + callback[0] + ' at LatLon ' + loc); } else { alert ('No matching addresses were found.'); } }, errorCallback('Geocode')); }; // A compact way of generating error callbacks. // Test by changing 'country' var to an uninstalled region. var errorCallback = function (context) { return function (error) { alert (context + ' operation failed (' + error.name + '): ' + error.message); }; };
|
reverseGeoCode (LatLon loc, Function callback, Function errorCallback, Object server) | Converts a set of latlon co-ordinates to a physical address. JavaScript // LatLon to reverse geocode var s_loc = new Telogis.GeoBase.LatLon(33.584444,-117.731874); function myTestFunction() { Telogis.GeoBase.GeoCoder.reverseGeoCode (s_loc, function (callback) { // Callback function begins if (callback) { alert ('Found ' + callback + ' at LatLon ' + s_loc); } else { alert ('No matching addresses were found at ' + s_loc); } }, errorCallback('Reverse Geocode')); }; // A compact way of generating error callbacks. var errorCallback = function (context) { return function (error) { alert (context + ' operation failed (' + error.name + '): ' + error.message); }; };
|
reverseGeoCodeFull (LatLon loc, Function callback, Function errorCallback, Object server) | Converts a latlon to a physical address and returns extended information. JavaScript // LatLon to reverse geocode var s_loc = new Telogis.GeoBase.LatLon(33.584444,-117.731874); function myTestFunction() { Telogis.GeoBase.GeoCoder.reverseGeoCodeFull (s_loc, function (callback) { // Callback function begins if (callback) { alert ('Found ' + callback + ' at LatLon ' + s_loc); } else { alert ('No matching addresses were found at ' + s_loc); } }, errorCallback('Full Reverse Geocode')); }; // A compact way of generating error callbacks. var errorCallback = function (context) { return function (error) { alert (context + ' operation failed (' + error.name + '): ' + error.message); }; };
|