Ir para o conteúdo

Location service timezoneId

0

Hi, I am calling Location service with address longitude and latitude and time zoneId in response returns null. timeZone object is null. Could you please tell me if this is the correct api to use.

public String getTimeZoneId(double latitude, double longitude) throws Exception {
    String timeZoneId = null;
    SearchPlaceIndexForPositionRequest request = SearchPlaceIndexForPositionRequest.builder()
        .indexName("myPlacesIndex")
        .position(Arrays.asList(longitude, latitude)) // [longitude, latitude]
        .build();

    SearchPlaceIndexForPositionResponse response = locationClient.searchPlaceIndexForPosition(request);
    for (SearchForPositionResult result : response.results()) {
      if (result.place().timeZone() != null) {
        timeZoneId = result.place().timeZone().name();
        break;
      }
    }
return timeZoneId
  }

feita há um ano141 visualizações

3 Respostas
0
  • Just wondering if placesIndex required for this request?

0

Somehow I am getting error when using sdk java2 ReverseGeocodeRequest. Can not set indexName etc, and GeoPlacesClient is throwing endpoint provider error etc. I will stick with my original request, I changed from Esri to HERE and now able to get result. Was planning to use new api as suggested above but no lock.

respondido há um ano

  • Placeindex is not required with the new APIs. Can you post the code here for your new request?

0

Hello.

Most likely the reason is because you are using a PlaceIndex that is configured with Esri as the data provider.

However we have released a new version of the API with a new Reverse Geocode API: https://docs.aws.amazon.com/location/latest/APIReference/API_geoplaces_ReverseGeocode.html

We recommend using this as it has better performance and more information about a given location.

Thanks!

AWS
ESPECIALISTA

respondido há um ano

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.