Table of Contents

Class SearchNearbyRequest

Namespace
GoogleMapsApi.Entities.PlacesNew.Request
Assembly
GoogleMapsApi.dll

Request for the Places API (New) Nearby Search endpoint (POST https://places.googleapis.com/v1/places:searchNearby). Modern replacement for the legacy Places Nearby Search.

public sealed class SearchNearbyRequest : MapsBaseRequest
Inheritance
SearchNearbyRequest
Inherited Members

Remarks

Requires a field mask (places.-prefixed) and a LocationRestriction with a circle. See https://developers.google.com/maps/documentation/places/web-service/nearby-search.

Fields

DefaultFieldMask

Default FieldMask covering a commonly useful set of place fields.

public const string DefaultFieldMask = "places.id,places.displayName,places.formattedAddress,places.location,places.rating,places.types,places.googleMapsUri"

Field Value

string

Properties

ExcludedTypes

Exclude results matching these place types.

public List<string>? ExcludedTypes { get; set; }

Property Value

List<string>

FieldMask

Comma-separated response field mask using places.-prefixed paths. Required by the Places API (New). Passed in the URL as $fields.

public string FieldMask { get; set; }

Property Value

string

IncludedTypes

Restrict results to one or more place types.

public List<string>? IncludedTypes { get; set; }

Property Value

List<string>

LocationRestriction

Region to search within. Required — must contain a Circle.

public LocationRestriction LocationRestriction { get; set; }

Property Value

LocationRestriction

MaxResultCount

Maximum number of results to return (1–20).

public int? MaxResultCount { get; set; }

Property Value

int?

RankPreference

How results should be ranked.

public RankPreference? RankPreference { get; set; }

Property Value

RankPreference?

Methods

GetRequestBody()

Builds the body to send with this request, or null for endpoints that use GET with query-string parameters only. Derived requests that target POST-based endpoints (for example, Address Validation) override this to return a JSON HttpContent; when the engine sees a non-null body it issues a POST instead of a GET.

protected override HttpContent? GetRequestBody()

Returns

HttpContent

The HTTP content to send, or null for a GET request.

GetUri()

Builds the absolute request URI, including scheme, base URL, and serialized query-string parameters.

public override Uri GetUri()

Returns

Uri

The fully composed URI to send to the Google Maps API.