You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mapbox-sdk/Core/mapbox-sdk-cs/Geocoding/ReverseGeocodeResource.cs

55 lines
1.5 KiB

6 months ago
//-----------------------------------------------------------------------
// <copyright file="ReverseGeocodeResource.cs" company="Mapbox">
// Copyright (c) 2016 Mapbox. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace Mapbox.Geocoding
{
using System.Collections.Generic;
using Mapbox.Utils;
/// <summary> A reverse geocode request. </summary>
public sealed class ReverseGeocodeResource : GeocodeResource<Vector2d>
{
// Required
private Vector2d query;
/// <summary> Initializes a new instance of the <see cref="ReverseGeocodeResource" /> class.</summary>
/// <param name="query"> Location to reverse geocode. </param>
public ReverseGeocodeResource(Vector2d query)
{
this.Query = query;
}
/// <summary> Gets or sets the location. </summary>
public override Vector2d Query {
get {
return this.query;
}
set {
this.query = value;
}
}
/// <summary> Builds a complete reverse geocode URL string. </summary>
/// <returns> A complete, valid reverse geocode URL string. </returns>
public override string GetUrl()
{
Dictionary<string, string> opts = new Dictionary<string, string>();
if (this.Types != null)
{
opts.Add("types", GetUrlQueryFromArray(this.Types));
}
return Constants.BaseAPI +
this.ApiEndpoint +
this.Mode +
this.Query.ToString() +
".json" +
EncodeQueryString(opts);
}
}
}