Dear all, I am making an on-location panoramic tour with a couple of panoramic renders (around a place where once was an old castle). Now I want people to walk to that location, stand on the spots on the map, and look at the castle on their phone. Two things are missing: 1) is there a way to put the current location of the user/phone on that map, like you can in google maps itself, 2) and is there a way in which the panorama can automatically orient itself, aligning (in my case) North.
This is the current state: https://dataportal.nioz.nl/visualmodels/VR/
Any further suggestions are also welcome!
Thanks for any suggestion. Johan
Get current geolocation of phone in map, and automatically orient panorama
-
-
Hi,
you can use the browsers Geolocation API for this:
https://developer.mozilla.org/en-US/docs/Web…location-objektHere a quick example:
Code
Alles anzeigen<action name="get_geo_location" type="Javascript"><![CDATA[ krpano.actions.showlog(); if ("geolocation" in navigator) { navigator.geolocation.getCurrentPosition( function(position) { krpano.trace(1,"latitude=" + position.coords.latitude); krpano.trace(1,"longitude=" + position.coords.longitude); krpano.trace(1,"heading=" + position.coords.heading); }, function(err) { krpano.trace(1,"geolocation error: "+err.message); } ); } else { krpano.trace(1,"no geolocation support by the browser"); } ]]></action> <!-- a button for testing: --> <layer name="get_geo_location" keep="true" type="text" html="Get Geo Location" align="center" onclick="get_geo_location();" />
Best regards,
Klaus -
Thanks, the button surely works and gives data. But where to put the action and have a button attached to it? In tour.xml, or in the skin where the map is defined.
I must admit I am not really sure how to do that. Anybody?
Thanks in advance, Johan -
Hi,
you can use the browsers Geolocation API for this:
https://developer.mozilla.org/en-US/docs/Web…location-objektHere a quick example:
Code<layer name="get_geo_location" keep="true" type="text" html="Get Geo Location" align="center" onclick="get_geo_location();" />
Best regards,
KlausPlease help how to use this code to xml.
Regards
Jetzt mitmachen!
Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!