Answer the question
In order to leave comments, you need to log in
How can I get a photo of a city by name or its coordinates?
Tried using google api, but it doesn't return photo reference for cities, it returns only for places (restaurants, museums, etc.). I tried using flickr and panoramio, but random photos are returned according to geodata, not the best ones. How to find photos that are on google maps
or that are given in the search
Answer the question
In order to leave comments, you need to log in
Do not reinvent the wheel, and do not try to parse something - this is a disastrous business. Use the API
As part of Android development, I would still recommend that you use the official API. I don't quite understand what you don't like about it. Pay attention to the following code:
1. Initialize ApiClient:
GoogleApiClient googleApiClient = new GoogleApiClient.Builder(service).addApi(Places.GEO_DATA_API).build();
googleApiClient.connect();
AutocompleteFilter filter = new AutocompleteFilter.Builder()
.setTypeFilter(AutocompleteFilter.TYPE_FILTER_CITIES)
.build();
PendingResult<AutocompletePredictionBuffer> result = Places.GeoDataApi
.getAutocompletePredictions(googleApiClient, externalQuery, null, filter);
AutocompletePredictionBuffer autocompletePredictions = result.await(60, TimeUnit.SECONDS);
ArrayList<AutocompletePrediction> predictions = DataBufferUtils.freezeAndClose(autocompletePredictions);
autocompletePredictions.release();
PendingResult<PlaceBuffer> placeResult = Places.GeoDataApi.getPlaceById(googleApiClient, prediction.getPlaceId());
Places.GeoDataApi.getPlacePhotos(googleApiClient, prediction.getPlaceId());
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question