Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TilequeryActivity.java cannot resolve methods .tilesetIds in Builder #1402

Open
inferstudio opened this issue Feb 27, 2021 · 0 comments
Open

Comments

@inferstudio
Copy link

I'm trying to integrate the TilequeryActivity.java from the demo into a navigation app - but am having trouble with the .tilesetIds method when building a new class of the MapboxTilequery object.
I get the error " cannot find symbol method .tilesetIds(string)"

Has this method been replaced with something else?

Aside from changing the string of access_token, the code is unchanged from the demo. Here it is:

/**
* Use the Java SDK's MapboxTilequery class to build a API request and use the API response
*
* @param point the center point that the the tilequery will originate from.
*/
private void makeTilequeryApiCall(@nonnull LatLng point) {
MapboxTilequery tilequery = MapboxTilequery.builder()
.accessToken(getString(R.string.mapbox_access_token))
//.tilesetIds("mapbox.bethanyjane.10puvo6w")
.tilesetIDS("mapbox.mapbox-streets-v7")
.query(Point.fromLngLat(point.getLongitude(), point.getLatitude()))
.radius(50)
.limit(10)
.geometry("polygon")
.dedupe(true)
.layers("building")
.build();

    tilequery.enqueueCall(new Callback<FeatureCollection>() {
        @Override
        public void onResponse(Call<FeatureCollection> call, Response<FeatureCollection> response) {
            if (response.body() != null) {
                FeatureCollection responseFeatureCollection = response.body();
                tilequeryResponseTextView.setText(responseFeatureCollection.toJson());
                mapboxMap.getStyle(new Style.OnStyleLoaded() {
                    @Override
                    public void onStyleLoaded(@NonNull Style style) {
                        GeoJsonSource resultSource = style.getSourceAs(RESULT_GEOJSON_SOURCE_ID);
                        if (resultSource != null && responseFeatureCollection.features() != null) {
                            List<Feature> featureList = responseFeatureCollection.features();
                            if (featureList.isEmpty()) {
                                Toast.makeText(TilequeryActivity.this,
                                        getString(R.string.no_tilequery_response_features_toast), Toast.LENGTH_SHORT).show();
                            } else {
                                resultSource.setGeoJson(FeatureCollection.fromFeatures(featureList));
                            }
                        }
                    }
                });
            }
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant