XyloCode.ThirdPartyServices.Mapbox.SearchBox 1.1.3

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package XyloCode.ThirdPartyServices.Mapbox.SearchBox --version 1.1.3                
NuGet\Install-Package XyloCode.ThirdPartyServices.Mapbox.SearchBox -Version 1.1.3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="XyloCode.ThirdPartyServices.Mapbox.SearchBox" Version="1.1.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add XyloCode.ThirdPartyServices.Mapbox.SearchBox --version 1.1.3                
#r "nuget: XyloCode.ThirdPartyServices.Mapbox.SearchBox, 1.1.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install XyloCode.ThirdPartyServices.Mapbox.SearchBox as a Cake Addin
#addin nuget:?package=XyloCode.ThirdPartyServices.Mapbox.SearchBox&version=1.1.3

// Install XyloCode.ThirdPartyServices.Mapbox.SearchBox as a Cake Tool
#tool nuget:?package=XyloCode.ThirdPartyServices.Mapbox.SearchBox&version=1.1.3                

Search Box API Client

An unofficial client library for accessing the Mapbox Search Box API.

Support only /suggest and /retrieve endpoints are used together to build an Interactive Search for your app.

Mapbox

Mapbox is an American provider of custom online maps for websites and applications such as Foursquare, Lonely Planet, the Financial Times, The Weather Channel, Instacart Inc. and Snapchat. Since 2010, it has rapidly expanded the niche of custom maps, as a response to the limited choice offered by map providers such as Google Maps.

Official website:

Search millions of continuously updated locations, including addresses, places, and points of interest, with a single search box. The Search Box API serves 340 Million+ addresses and 170 Million+ POIs with ever-improving coverage and quality on a global scale.

Official website:

Session token generation

Pricing for the Mapbox Search Box API is based on which API endpoints are used. If you are using the /suggest or /retrieve endpoints, usage will be billed per search session.

The session_token is generated automatically based on the rules of the service.

A Search Session is a series of Search API calls bundled together for billing purposes. The session_token parameter is used to group a series of requests together into one session for billing purposes.

A session ends after the following actions:

  • A call is made to /suggest followed by a call to /retrieve with a common session_token.
  • 50 successive calls are made to /suggest with a common session_token but are not followed by a call to /retrieve.
  • A call is made to /suggest and 60 minutes pass without being followed by a call to /retrieve.

How to use

using XyloCode.ThirdPartyServices.Mapbox.SearchBox;

namespace SearchBoxConsoleApp
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string accessToken = "Default public token from https://account.mapbox.com/";
            string searchText = "671 Lincoln Ave";
            
            var searchBox = new SearchBoxClient(accessToken);
            var searchResult = searchBox.Search(searchText, country: "US");
            foreach (var suggestion in searchResult.Suggestions)
            {
                Console.WriteLine(suggestion.FullAddress);
                var retrive = searchBox.Retrieve(suggestion.MapboxId);
                foreach (var feature in retrive.Features)
                {
                    Console.WriteLine("{0} {1}", feature.Properties.Coordinates.Latitude, feature.Properties.Coordinates.Longitude);
                }
                Console.WriteLine("===*****===");

            }
            Console.Beep();
            Console.WriteLine("End!");
        }
    }
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Changing the mechanism for generating a session token.