Skip to main content
APIs 5 min read

Finding timezones of places, addresses and coordinates with HERE Geocoding & Search API

hero image timezone geocoding

In today's interconnected world, precise location data is more valuable than ever. With the HERE Geocoding and Search API, you can not only search for Points of Interest (POIs), perform forward and reverse geocoding, but also access crucial timezone information. In this blog post, we will delve into how to enhance the responses from the HERE Geocoding and Search API by incorporating timezone data.

Response Enrichment: Timezone (show=tz)

HERE Geocoding and Search allows developers to get richer response item attributes through the addition of the request query parameter show. By adding the show=tz query parameter to your API requests, you can retrieve IANA TZ time zone information, including the timezone name and UTC offset. It is supported in all endpoints except /autocomplete. For more details on supported values, please refer to the documentation

Use Case 1 - Reverse Geocode: Finding the timezone of a given coordinate

Imagine you need to find the nearest address, including the timezone, for a specific set of map geo-coordinates. In this scenario, you can use the following request:

Copied
        GET https://revgeocode.search.hereapi.com/v1/
    revgeocode
    ?at=48.2181679%2C16.3899064
    &lang=en-US
    &show=tz
    &apiKey={YOUR_API_KEY}
  

The response will include the timezone information, such as the timezone name and UTC offset, making it a valuable resource for scheduling and more.

Copied
        {
    "items": [
        {
            "title": "Heinestraße 42, 1020 Vienna, Austria",
            "id": "here:af:streetsection:fTFtKIITOM8ubVf3cmHMIB:CgcIBCD6iaNNEAEaAjQy",
            "resultType": "houseNumber",
            "houseNumberType": "PA",
            "address": {
                "label": "Heinestraße 42, 1020 Vienna, Austria",
                "countryCode": "AUT",
                "countryName": "Austria",
                "stateCode": "W",
                "state": "Vienna",
                "countyCode": "W",
                "county": "Vienna",
                "city": "Vienna",
                "district": "2. Bezirk-Leopoldstadt",
                "street": "Heinestraße",
                "postalCode": "1020",
                "houseNumber": "42"
            },
            "position": {
                "lat": 48.21809,
                "lng": 16.38988
            },
            "access": [
                {
                    "lat": 48.21815,
                    "lng": 16.38995
                }
            ],
            "distance": 4,
            "mapView": {
                "west": 16.38234,
                "south": 48.21842,
                "east": 16.38969,
                "north": 48.2224
            },
            "timeZone": {
                "name": "Europe/Vienna",
                "utcOffset": "+02:00"
            }
        }
    ]
}
  

Use Case 2 - Geocoding: Finding the timezone of a given address

If you have an address and want to determine its geographical coordinates and associated timezone, you can send a request like this:

Copied
        GET https://geocode.search.hereapi.com/v1/
    geocode
    ?q=5+Rue+Daunou%2C+75000+Paris%2C+France
    &show=tz
    &apiKey={YOUR_API_KEY}
  

The response will not only provide the geo-coordinates but also the timezone information, giving you a complete picture of the location.

Copied
        {
    "items": [
        {
            "title": "5 Rue Daunou, 75002 Paris, France",
            "id": "here:af:streetsection:NQHc13Wvqj0xq9jew7-8sC:CggIBCCi-9SPARABGgE1",
            "resultType": "houseNumber",
            "houseNumberType": "PA",
            "address": {
                "label": "5 Rue Daunou, 75002 Paris, France",
                "countryCode": "FRA",
                "countryName": "France",
                "stateCode": "IDF",
                "state": "Île-de-France",
                "county": "Paris",
                "city": "Paris",
                "district": "2e Arrondissement",
                "street": "Rue Daunou",
                "postalCode": "75002",
                "houseNumber": "5"
            },
            "position": {
                "lat": 48.86926,
                "lng": 2.3321
            },
            "access": [
                {
                    "lat": 48.86931,
                    "lng": 2.33215
                }
            ],
            "mapView": {
                "west": 2.33073,
                "south": 48.86836,
                "east": 2.33347,
                "north": 48.87016
            },
            "timeZone": {
                "name": "Europe/Paris",
                "utcOffset": "+02:00"
            },
            "scoring": {
                "queryScore": 0.97,
                "fieldScore": {
                    "country": 1,
                    "city": 1,
                    "streets": [
                        1
                    ],
                    "houseNumber": 1,
                    "postalCode": 0.82
                }
            }
        }
    ]
}
  

Use Case 3 - Lookup: Finding the timezone of a given place

For instances where you already have the HERE ID for a place, you can obtain extensive details, including timezone information, by sending a request like this:

Copied
        GET https://lookup.search.hereapi.com/v1/
    lookup
    ?id=here:pds:place:276u0vhj-b0bace6448ae4b0fbc1d5e323998a7d2
    &show=tz
    &apiKey={YOUR_API_KEY}
  

The response will contain valuable data about the place, including its timezone details.

Copied
        {
    "title": "Flughafen Frankfurt-Hahn",
    "id": "here:pds:place:276u0vhj-b0bace6448ae4b0fbc1d5e323998a7d2",
    "language": "de",
    "resultType": "place",
    "address": {
        "label": "Flughafen Frankfurt-Hahn, 55483 Lautzenhausen, Deutschland",
        "countryCode": "DEU",
        "countryName": "Deutschland",
        "stateCode": "RP",
        "state": "Rheinland-Pfalz",
        "countyCode": "SIM",
        "county": "Rhein-Hunsrück-Kreis",
        "city": "Lautzenhausen",
        "postalCode": "55483"
    },
    "position": {
        "lat": 49.94802,
        "lng": 7.27153
    },
    "access": [
        {
            "lat": 49.94571,
            "lng": 7.26985
        }
    ],
    "categories": [
        {
            "id": "400-4000-4581",
            "name": "Flughafen",
            "primary": true
        }
    ],
    "references": [
        {
            "supplier": {
                "id": "core"
            },
            "id": "50481441"
        }
    ],
    "contacts": [
        {
            "phone": [
                {
                    "value": "+496543509200"
                }
            ],
            "www": [
                {
                    "value": "http://www.hahn-airport.de"
                }
            ],
            "email": [
                {
                    "value": "info@hahn-airport.de"
                }
            ]
        }
    ],
    "timeZone": {
        "name": "Europe/Berlin",
        "utcOffset": "+02:00"
    }
}
  

Closing Thought

In an era where time and location are intricately linked, the HERE Geocoding and Search API empowers developers and businesses to create applications that provide not only precise location data but also critical timezone information. This integration adds a new dimension to user experiences, enabling better scheduling, global business operations, and more. It's not just about knowing where; it's about understanding when.

Resources

Erwin Soekianto

Erwin Soekianto

Developer Evangelist

Have your say

Sign up for our newsletter

Why sign up:

  • Latest offers and discounts
  • Tailored content delivered weekly
  • Exclusive events
  • One click to unsubscribe