Saltar al contenido

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
  }

preguntada hace un año142 visualizaciones

3 Respuestas
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 hace un año

  • 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
EXPERTO

respondido hace un año

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.