AR-js-org / AR.js

Image tracking, Location Based AR, Marker tracking. All on the Web.
MIT License
5.3k stars 909 forks source link

new-location-based osm-ways exapmple can't show ways #527

Closed zmc1212 closed 1 year ago

zmc1212 commented 1 year ago

Do you want to request a feature or report a bug? bug

What is the current behavior? new-location-based osm-ways exapmple can't show ways If the current behavior is a bug, please provide the steps to reproduce. in aframe/examples/new-location-based/osm-ways/ this exapmple cant't see osmways

aframe/examples/new-location-based/osm-ways/index.html I fixed the coordinates 51.049,-0.723

    init: function() {
        this.downloaded = false;
        this.camera = document.querySelector("[gps-new-camera]");
        this.camera.addEventListener("gps-camera-update-position", e=> {
            if(!this.downloaded) {
                // this._readOsm(e.detail.position.latitude, e.detail.position.longitude);
                this._readOsm( 51.049,-0.723);
                this.downloaded = true;
            }
        });
    },

    update: function() {
        if (this.data.latitude >= -90 && this.data.latitude <= 90 && this.data.longitude >= -180 && this.data.longitude <= 180) {
            // this._readOsm(this.data.latitude, this.data.longitude);
            this._readOsm( 51.049,-0.723);

        }
    },

Please mention other relevant information such as the browser version, Operating System and Device Name It happened on Android browsers What is the expected behavior? can see osmways If this is a feature request, what is motivation or use case for changing the behavior?

nickw1 commented 1 year ago

As you say, this example uses a fixed location, lat 51.049, lon -0.723, so will not show ways at your current position but at that fixed location instead. It's intended as a code example rather than a useful app, however it won't be hard to change it to see the ways at your current location. Are you seeing anything at all?

It works for me, though admittedly this is on a desktop browser (as it's just a fixed-location demo). I will test it on Android and see if it still works - I can't see why it wouldn't.

zmc1212 commented 1 year ago

Thank you,I found the reason In this example, I must use the OSM data near me to see it on Android. If you directly use the OMS data in the example, you won't be able to see it. This example is different from location based, and it can be seen using the example OSM data on Android. I guess it's because of the differences between gps-new-camera and gps-projected-camera

nickw1 commented 1 year ago

It's just a shortcoming of the example, really. It can easily be adapted to use your current GPS location, will try to do that when I have a moment.