JustinCanton / Geo.NET

A lightweight method for communicating with the multiple online geocoding APIs.
MIT License
13 stars 8 forks source link

Add support for Language in MapBox #75

Closed ollie10 closed 1 year ago

ollie10 commented 1 year ago

Hi, it seems that an important property, the Language is missing from the MapBox Geocoder. As from the documentation, a language can be passed to influence the results but, there is no configuration for this, except the readonly Languages property.

Do you plan to implement this in the close future? Many thanks

JustinCanton commented 1 year ago

Hi,

We already support this. You can see in the BaseParameter, which both the GeocodingParameters and ReverseGeocodingParameters inherit from, there is a Languages list.

The reason it is a list is because MapBox support sending multiple languages. In their documentation, they mention this:

More than one value can also be specified, separated by commas, for applications that need to display labels in multiple languages.

Thank you.

ollie10 commented 1 year ago

Hello @JustinCanton as you pointed this is exactly the problem, both Countries and Languages list have only getters not setters. The same happens with InCountry of Geo.Here.Models.Parameters.GeocodeParameters. How can you set these parameters if they are readonly?

Thanks again.

JustinCanton commented 1 year ago

Hello @ollie10,

The list isn't meant to be set. Its a get only list, but that is for the list itself. A consumer is still able to add/remove from the list, they are just not able to assign a new list to the Languages parameter.

For example, this code works as expected:

public GeocodingParameters BuildParameters()
{
    var parameters = new GeocodingParameters();
    parameters.Query = "123 Main Street";
    parameters.Languages.Add(new CultureInfo("fr-FR"));
    parameters.Languages.Add(CultureInfo.CurrentCulture);
    return parameters;
}

But you cannot assign to the list:

public GeocodingParameters BuildParameters()
{
    var parameters = new GeocodingParameters();
    parameters.Query = "123 Main Street";
    var languages = new List<CultureInfo>
    {
        new CultureInfo("fr-FR"),
        CultureInfo.CurrentCulture,
    };
    parameters.Languages = languages;    // Compiler error
    return parameters;
}

I hope this clears up the confusion.

ollie10 commented 1 year ago

Hello @JustinCanton, yes sorry, it makes it totally sense! Anyway I was trying the library as all in one solution for Here, Mapox, Arcgis and eventually Google, but I still see missing parameters that I'm using which are not covered, unfortunately. After a quick look I saw perhaps missing the show parameter of Here Maps (not connected with Mapbox here), but I suppose it won't be the only one missing, is this correct?

Many thanks!

JustinCanton commented 1 year ago

Hi @ollie10,

You are right, that parameter seems to be missing. I can definitely add that to the parameters for HERE. This was probably added somewhat recently, which is why I don't have support for it. I also notice there is a new field called politicalView in the HERE apis that I can add as well. Please make an issue and I can work on it.

As for any other services, it has been a while since I last combed through to make sure I have all the parameters. If you find anything missing, please feel free to make a ticket and I can add support for it.

Thank you.

ollie10 commented 1 year ago

Hi @JustinCanton, count on it, I will review and tell you what's missing to save you some research work Many thanks