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