Search code examples
javascriptgisaugmented-realitygeoar.js

Issues with AR.js Location-Based Example from Documentation


I am trying to implement the location-based augmented reality functionality using AR.js library. I have been referring to the official AR.js documentation (https://ar-js-org.github.io/AR.js-Docs/) and specifically the location-based section.

I have copied the provided code into my HTML file and made the necessary changes by replacing the add-your-latitude and add-your-longitude placeholders with my actual latitude and longitude values. However, the AR object is not appearing at the specified GPS coordinates. I have also tried adding multiple markers with close positions to my location, but still no success.

I have checked the browser console for any error messages, but there are no relevant errors or warnings. I have also ensured that my browser has location permission granted to the web page (I tested on iOS - safari and Chrome both).

Is there anyone who has successfully implemented the AR.js location-based functionality? Could there be any specific steps or considerations that I might be missing? Is there a working example or additional resources available for implementing location-based AR using AR.js?

I would appreciate any guidance or insights to help resolve this issue. Thank you in advance for your assistance.


Solution

  • Sample code works! You can try to add a position to your assets, including multiple assets and their position. The position is elevation from sea level. You can try the following code.

    <a-box material="color: blue" gps-entity-place="latitude: <>; longitude: <>" position="0 165 0" scale="3.5 3.5 3.5" rotation="0 180 0"> </a-box>
    

    In the above example position tag gives 165m as elevation to the object on that GPS location.