GeocoderResult
Namespace: Wisej.Web.Ext.GoogleMaps
Assembly: Wisej.Web.Ext.GoogleMaps (4.1.0.0)
Represents a single geocoding result.
- C#
- VB.NET
public class GeocoderResult
Public Class GeocoderResult
A geocode request may return multiple result objects. When the request fails, the GetGeocode and GetGeocodeAsync methods return a single result with IsError set to true and ResultCode set to the status returned by Google; all the other properties of that result are null.
Example:
Reading the results of a geocode request:
private async void buttonFind_Click(object sender, EventArgs e)
{
var results = await this.googleMap1.GetGeocodeAsync("Brandenburg Gate, Berlin");
if (results[0].IsError)
{
AlertBox.Show("Geocoding failed: " + results[0].ResultCode);
return;
}
foreach (var result in results)
{
this.listBoxResults.Items.Add($"{result.FormattedAddress} {result.GeocodeGeometry.Location}");
}
}
Properties
AddressComponents
AddressComponent[]: Returns an array of separate components applicable to this address.
Value: The array of separate components applicable to this address.
FormattedAddress
String: Returns the human-readable address of this location.
Value: The human-readable address of this location.
GeocodeGeometry
Geometry: Returns the geocode geometry information.
Value: The geocode geometry information.
IsError
Boolean: Returns whether this instance represents a failed geocode request.
Value: true if the request failed; otherwise, false.
When true, ResultCode contains the status returned by Google and all the other properties are null.
PartialMatch
Boolean: Returns a value indicating that the geocoder did not return an exact match for the original request, though it was able to match part of the requested address.
Value: true if the geocoder did not return an exact match; otherwise, false.
PlaceId
String: Returns the unique identifier of a place, which can be used with other Google APIs.
Value: The unique identifier of a place.
PostcodeLocalities
String[]: Returns an array denoting all the localities contained in a postal code.
Value: The array denoting all the localities contained in a postal code.
Is only present when the result is a postal code that contains multiple localities. This array can contain up to 10 localities.
ResultCode
String: Returns the status code of a failed geocode request.
Value: The status code returned by google.maps.Geocoder, i.e. "ZERO_RESULTS", "OVER_QUERY_LIMIT", "REQUEST_DENIED" or "INVALID_REQUEST"; null when the request succeeded.
Types
String[]: Returns an array indicating the address type of the returned result.
Value: The array indicating the address type of the returned result.
This array contains a set of zero or more tags identifying the type of feature returned in the result.