mapbox-android-demo icon indicating copy to clipboard operation
mapbox-android-demo copied to clipboard

Place Plugin proximity and bbox issues

Open leocarona opened this issue 6 years ago • 1 comments

I'm trying to add Proximity on Mapbox Location search example, but it doesn't seem to work. I'm using coordinates of a small town called Raul Soares, and when the map loads, the map camera gets positioned where I requested, and I see a small shop called "Mercearia Dois Irmãos".

Screenshot_20200202-161638

If I try to search for that place, that shop isn't found.

Screenshot_20200202-162227

The first item on the results list is a place with the same name, but if I click it it sends me to a location in another city.

I tried to add a bindingbox through .bbox() to limit the results to places here in town, but then I face a message saying that I'm offline and therefore can't do the search.

Screenshot_20200202-161625

I have double checked my internet connection, and it is stable. I remove the bbox and such message disappears.

Below I'm posting my changes on the Location search code.

public static Point COORDENADAS_CIDADE_RAUL_SOARES = Point.fromLngLat(-42.4525, -20.1019); public static final String MAPS_SEARCH_BOUNDING_BOX_STRING ="N:-19.970316192373716; E:-42.35392318805566; S:-20.202220397289068; W:-42.49933047310827";

@Override public void onMapReady(@NonNull final MapboxMap mapboxMap) { this.mapboxMap = mapboxMap; //..... this.mapboxMap.easeCamera( CameraUpdateFactory.newLatLngZoom( new LatLng(COORDENADAS_CIDADE_RAUL_SOARES.latitude(), COORDENADAS_CIDADE_RAUL_SOARES.longitude()), MAPS_CLOSE_ZOOM_LEVEL));

}

private void initSearchFab() { FloatingActionButton searchFab = findViewById(R.id.fab_location_search); searchFab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new PlaceAutocomplete.IntentBuilder() .accessToken(Mapbox.getAccessToken()) .placeOptions(PlaceOptions.builder() .backgroundColor(Color.parseColor("#EEEEEE")) .limit(10) .proximity(COORDENADAS_CIDADE_RAUL_SOARES) .bbox(MAPS_SEARCH_BOUNDING_BOX_STRING) //.addInjectedFeature(home) //.addInjectedFeature(work) .build(PlaceOptions.MODE_CARDS)) .build(PlacesPluginActivity.this); startActivityForResult(intent, REQUEST_CODE_AUTOCOMPLETE); } }); }

leocarona avatar Feb 02 '20 19:02 leocarona

Hey, thanks for using Mapbox.

Although it's visible on the map, I think the issue is that Mapbox just doesn't have that particular shop in our geocoding database. Therefore, the Geocoding API won't be returning that particular shop in the search results that you posted above.

https://docs.mapbox.com/search-playground/#{%22url%22:%22%22,%22index%22:%22mapbox.places%22,%22approx%22:true,%22staging%22:false,%22onCountry%22:false,%22onType%22:false,%22onProximity%22:false,%22onBBOX%22:false,%22onLimit%22:false,%22onLanguage%22:false,%22countries%22:[],%22proximity%22:%22%22,%22typeToggle%22:{%22country%22:false,%22region%22:false,%22district%22:false,%22postcode%22:false,%22locality%22:false,%22place%22:false,%22neighborhood%22:false,%22address%22:false,%22poi%22:false},%22types%22:[],%22bbox%22:%22%22,%22limit%22:%22%22,%22autocomplete%22:false,%22languages%22:[],%22languageStrict%22:false,%22onDebug%22:false,%22selectedLayer%22:%22%22,%22debugClick%22:{},%22localsearch%22:false,%22query%22:%22-42.4541417,%20-20.1020731%22} is a great place to explore the Mapbox Geocoding API

Screen Shot 2020-02-14 at 2 27 31 PM

langsmith avatar Feb 14 '20 22:02 langsmith