Class GeocodeServiceClient
GeocodeService client wrapper, for convenient use.
Namespace: Google.Maps.Geocode.V4
Assembly: Google.Maps.Geocode.V4.dll
Syntax
public abstract class GeocodeServiceClient
Remarks
A service for performing geocoding.
Properties
DefaultEndpoint
The default endpoint for the GeocodeService service, which is a host of "geocoding-backend.googleapis.com" and a port of 443.
Declaration
public static string DefaultEndpoint { get; }
Property Value
| Type | Description |
|---|---|
| string |
DefaultScopes
The default GeocodeService scopes.
Declaration
public static IReadOnlyList<string> DefaultScopes { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<string> |
Remarks
The default GeocodeService scopes are:
- https://www.googleapis.com/auth/cloud-platform
- https://www.googleapis.com/auth/maps-platform.geocode
- https://www.googleapis.com/auth/maps-platform.geocode.address
- https://www.googleapis.com/auth/maps-platform.geocode.location
- https://www.googleapis.com/auth/maps-platform.geocode.place
GrpcClient
The underlying gRPC GeocodeService client
Declaration
public virtual GeocodeService.GeocodeServiceClient GrpcClient { get; }
Property Value
| Type | Description |
|---|---|
| GeocodeService.GeocodeServiceClient |
ServiceMetadata
The service metadata associated with this client type.
Declaration
public static ServiceMetadata ServiceMetadata { get; }
Property Value
| Type | Description |
|---|---|
| ServiceMetadata |
Methods
Create()
Synchronously creates a GeocodeServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use GeocodeServiceClientBuilder.
Declaration
public static GeocodeServiceClient Create()
Returns
| Type | Description |
|---|---|
| GeocodeServiceClient | The created GeocodeServiceClient. |
CreateAsync(CancellationToken)
Asynchronously creates a GeocodeServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use GeocodeServiceClientBuilder.
Declaration
public static Task<GeocodeServiceClient> CreateAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | The CancellationToken to use while creating the client. |
Returns
| Type | Description |
|---|---|
| Task<GeocodeServiceClient> | The task representing the created GeocodeServiceClient. |
GeocodeAddress(GeocodeAddressRequest, CallSettings)
This method performs an address geocode, which maps an address to a LatLng. It also provides structured information about the address.
Declaration
public virtual GeocodeAddressResponse GeocodeAddress(GeocodeAddressRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| GeocodeAddressRequest | request | The request object containing all of the parameters for the API call. |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| GeocodeAddressResponse | The RPC response. |
Sample code
// Create client
GeocodeServiceClient geocodeServiceClient = GeocodeServiceClient.Create();
// Initialize request argument(s)
GeocodeAddressRequest request = new GeocodeAddressRequest
{
AddressQuery = "",
LocationBias = new GeocodeAddressRequest.Types.LocationBias(),
LanguageCode = "",
RegionCode = "",
};
// Make the request
GeocodeAddressResponse response = geocodeServiceClient.GeocodeAddress(request);
GeocodeAddressAsync(GeocodeAddressRequest, CallSettings)
This method performs an address geocode, which maps an address to a LatLng. It also provides structured information about the address.
Declaration
public virtual Task<GeocodeAddressResponse> GeocodeAddressAsync(GeocodeAddressRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| GeocodeAddressRequest | request | The request object containing all of the parameters for the API call. |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| Task<GeocodeAddressResponse> | A Task containing the RPC response. |
Sample code
// Create client
GeocodeServiceClient geocodeServiceClient = await GeocodeServiceClient.CreateAsync();
// Initialize request argument(s)
GeocodeAddressRequest request = new GeocodeAddressRequest
{
AddressQuery = "",
LocationBias = new GeocodeAddressRequest.Types.LocationBias(),
LanguageCode = "",
RegionCode = "",
};
// Make the request
GeocodeAddressResponse response = await geocodeServiceClient.GeocodeAddressAsync(request);
GeocodeAddressAsync(GeocodeAddressRequest, CancellationToken)
This method performs an address geocode, which maps an address to a LatLng. It also provides structured information about the address.
Declaration
public virtual Task<GeocodeAddressResponse> GeocodeAddressAsync(GeocodeAddressRequest request, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| GeocodeAddressRequest | request | The request object containing all of the parameters for the API call. |
| CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
| Type | Description |
|---|---|
| Task<GeocodeAddressResponse> | A Task containing the RPC response. |
Sample code
// Create client
GeocodeServiceClient geocodeServiceClient = await GeocodeServiceClient.CreateAsync();
// Initialize request argument(s)
GeocodeAddressRequest request = new GeocodeAddressRequest
{
AddressQuery = "",
LocationBias = new GeocodeAddressRequest.Types.LocationBias(),
LanguageCode = "",
RegionCode = "",
};
// Make the request
GeocodeAddressResponse response = await geocodeServiceClient.GeocodeAddressAsync(request);
GeocodeLocation(GeocodeLocationRequest, CallSettings)
This method performs a location geocode, which maps a LatLng to an address. It also provides structured information about the address.
Declaration
public virtual GeocodeLocationResponse GeocodeLocation(GeocodeLocationRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| GeocodeLocationRequest | request | The request object containing all of the parameters for the API call. |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| GeocodeLocationResponse | The RPC response. |
Sample code
// Create client
GeocodeServiceClient geocodeServiceClient = GeocodeServiceClient.Create();
// Initialize request argument(s)
GeocodeLocationRequest request = new GeocodeLocationRequest
{
LocationQuery = "",
LanguageCode = "",
RegionCode = "",
Types_ = { "", },
Granularity =
{
GeocodeResult.Types.Granularity.Unspecified,
},
};
// Make the request
GeocodeLocationResponse response = geocodeServiceClient.GeocodeLocation(request);
GeocodeLocationAsync(GeocodeLocationRequest, CallSettings)
This method performs a location geocode, which maps a LatLng to an address. It also provides structured information about the address.
Declaration
public virtual Task<GeocodeLocationResponse> GeocodeLocationAsync(GeocodeLocationRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| GeocodeLocationRequest | request | The request object containing all of the parameters for the API call. |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| Task<GeocodeLocationResponse> | A Task containing the RPC response. |
Sample code
// Create client
GeocodeServiceClient geocodeServiceClient = await GeocodeServiceClient.CreateAsync();
// Initialize request argument(s)
GeocodeLocationRequest request = new GeocodeLocationRequest
{
LocationQuery = "",
LanguageCode = "",
RegionCode = "",
Types_ = { "", },
Granularity =
{
GeocodeResult.Types.Granularity.Unspecified,
},
};
// Make the request
GeocodeLocationResponse response = await geocodeServiceClient.GeocodeLocationAsync(request);
GeocodeLocationAsync(GeocodeLocationRequest, CancellationToken)
This method performs a location geocode, which maps a LatLng to an address. It also provides structured information about the address.
Declaration
public virtual Task<GeocodeLocationResponse> GeocodeLocationAsync(GeocodeLocationRequest request, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| GeocodeLocationRequest | request | The request object containing all of the parameters for the API call. |
| CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
| Type | Description |
|---|---|
| Task<GeocodeLocationResponse> | A Task containing the RPC response. |
Sample code
// Create client
GeocodeServiceClient geocodeServiceClient = await GeocodeServiceClient.CreateAsync();
// Initialize request argument(s)
GeocodeLocationRequest request = new GeocodeLocationRequest
{
LocationQuery = "",
LanguageCode = "",
RegionCode = "",
Types_ = { "", },
Granularity =
{
GeocodeResult.Types.Granularity.Unspecified,
},
};
// Make the request
GeocodeLocationResponse response = await geocodeServiceClient.GeocodeLocationAsync(request);
GeocodePlace(GeocodePlaceRequest, CallSettings)
This method performs a geocode lookup using a place ID.
Declaration
public virtual GeocodeResult GeocodePlace(GeocodePlaceRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| GeocodePlaceRequest | request | The request object containing all of the parameters for the API call. |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| GeocodeResult | The RPC response. |
Sample code
// Create client
GeocodeServiceClient geocodeServiceClient = GeocodeServiceClient.Create();
// Initialize request argument(s)
GeocodePlaceRequest request = new GeocodePlaceRequest
{
Place = "",
LanguageCode = "",
RegionCode = "",
};
// Make the request
GeocodeResult response = geocodeServiceClient.GeocodePlace(request);
GeocodePlaceAsync(GeocodePlaceRequest, CallSettings)
This method performs a geocode lookup using a place ID.
Declaration
public virtual Task<GeocodeResult> GeocodePlaceAsync(GeocodePlaceRequest request, CallSettings callSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| GeocodePlaceRequest | request | The request object containing all of the parameters for the API call. |
| CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
| Type | Description |
|---|---|
| Task<GeocodeResult> | A Task containing the RPC response. |
Sample code
// Create client
GeocodeServiceClient geocodeServiceClient = await GeocodeServiceClient.CreateAsync();
// Initialize request argument(s)
GeocodePlaceRequest request = new GeocodePlaceRequest
{
Place = "",
LanguageCode = "",
RegionCode = "",
};
// Make the request
GeocodeResult response = await geocodeServiceClient.GeocodePlaceAsync(request);
GeocodePlaceAsync(GeocodePlaceRequest, CancellationToken)
This method performs a geocode lookup using a place ID.
Declaration
public virtual Task<GeocodeResult> GeocodePlaceAsync(GeocodePlaceRequest request, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| GeocodePlaceRequest | request | The request object containing all of the parameters for the API call. |
| CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
| Type | Description |
|---|---|
| Task<GeocodeResult> | A Task containing the RPC response. |
Sample code
// Create client
GeocodeServiceClient geocodeServiceClient = await GeocodeServiceClient.CreateAsync();
// Initialize request argument(s)
GeocodePlaceRequest request = new GeocodePlaceRequest
{
Place = "",
LanguageCode = "",
RegionCode = "",
};
// Make the request
GeocodeResult response = await geocodeServiceClient.GeocodePlaceAsync(request);
ShutdownDefaultChannelsAsync()
Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.
Declaration
public static Task ShutdownDefaultChannelsAsync()
Returns
| Type | Description |
|---|---|
| Task | A task representing the asynchronous shutdown operation. |
Remarks
After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.