-1

I am trying to do geocoding with MapBox geocoding. I have a problem with searching cyrillic (Serbian) street names. When I search for city name (which are displayed latin), I can find them. Also, there is no option for MapBox to display map in Serbian language (only English, France, Germany, Spanish). However, I tried to do it with setting language to Serbian, but it doesn't help.

Here is my code, but I think there is no problem with code, it is just problem with MapBox, not offering support for Serbia.

private void getCoordinatesFromAddress(String address) {
    progressDialog.setCancelable(false);
    progressDialog.setMessage("Pronalazenje lokacije...");
    progressDialog.show();


    MapboxGeocoding mapboxGeocoding = MapboxGeocoding.builder()
            .accessToken(getString(R.string.mapbox_access_token))
            .query(address)
            .mode(GeocodingCriteria.MODE_PLACES)
            .geocodingTypes(GeocodingCriteria.TYPE_ADDRESS, GeocodingCriteria.TYPE_PLACE)
            .proximity(Point.fromLngLat(21.895759,43.320902))
            .country("RS")
            .languages("sr")
            .build();

    mapboxGeocoding.enqueueCall(new Callback<GeocodingResponse>() {
        @Override
        public void onResponse(Call<GeocodingResponse> call, Response<GeocodingResponse> response) {

            List<CarmenFeature> results = response.body().features();

            if (results.size() > 0) {

                progressDialog.dismiss();

                Point firstResultPoint = results.get(0).center();
                publicFunctions.displayToast("Lokacija " + address + " pronadjena");
                move(firstResultPoint.latitude(),firstResultPoint.longitude());
            } else {
                publicFunctions.displayToast("Lokacija " + address + " nije pronadjena");
                progressDialog.dismiss();
            }
        }

        @Override
        public void onFailure(Call<GeocodingResponse> call, Throwable throwable) {
            throwable.printStackTrace();
            progressDialog.dismiss();
        }
    });
}

1 Answers1

1

Serbian is mentioned at https://docs.mapbox.com/api/search/#local-coverage

You can use the Mapbox Geocoding Playground to explore. Here's a URL that will load the playground with settings to match your geocoding query code above. Make sure you type Serbian language queries in the playground because the Serbian language filter is being applied.

langsmith
  • 2,529
  • 1
  • 11
  • 13
  • Hello! I've already done that, and searched around Mapbox. When I was out of sources, I contacted mapbox support, asked some questions on their repos, and got the answer. There is no support for Serbian street names. At least for now. However, thank you for your response! – Andrija Randjelovic Mar 18 '20 at 20:33
  • Got it, ok. Thanks for the follow-up. – langsmith Mar 18 '20 at 23:11