With AEM 6.4 we want to build a component that reacts to the current visitor's country. We get the GPS coordinates via HTML (if visitor confirms). In AEM 5.6 we had a 'compute Address' function which returned the country and more details (it was based on Google Maps). This function was removed in 6.2 and up.
As it is possible to use the ContextHub to design localized experience, I figured that AEM must still have a way to determine the visitors' geographic location.
(How) Can I access this information in my component? The alternative is to get a license for Google Maps etc. but it would be overhead if AEM does have its own API.
I could not find a definitive answer in how far current AEM is equipped for this. Any explanation is very much appreciated, thank you!
Thank you for the quick response.
I had looked into this and worked with the ContextHub. But what we saw looking into the corresponding ContextHub JS object is that on Author the values will be correctly filled according to the manual selection in the preview (Beijing, Paris etc.), but on Publisher the object is empty. All geographic information is missing and not initialized. It should be possible to access the geogrpahic information if ContextHub was working properly, right?
HIdawei.hdtv, even I am facing similar issue, where the publish instance is not having address and addressDetailsOf items using ContextHub. I noticed that since the contextHub UI is not visible in Publish instance, the location items will not be displayed in the local storage. Wondering how can we fetching the address for Geo location on Publish instance? Can someone please help here?
Per my knowledge, you should use API (free/paid) to get updated info or use open source json/xml data for this use case. There is open source data available on web, just host it anywhere and utilize it per your use case.
You need to implement you own geolocation store if you want to get this information. Geolocation store from context hub will only do reverse geocoding when context hub ui is enabled (authoring edit/preview) and not in publish mode. I'm guessing this is due to licensing issues. If you check the jcr node of the geolocation store you may see the key they are using to do the reverse geolocation, but I'm guessing thats not for public usage.
This geolocation store can then only persist the latitude and longitude of the user which is fetched using the HTML5 geolocation api.
I'm all for a more clear documentation of the actual OOB capabilities of the context hub this and stop the annoying propaganda of the toy store example which is conveniently setup to hide all this shortcomings.