Alight, I guess I misunderstood the issue. So, the problem is not the location, but the fact that the POIs are stuck on the screen and do not move when you turn, right? That sounds like there is a problem with the compass. Did you calibrate the compass? Are you close to any materials that could influence the compass? Does the compass work properly in the maps application? Did you test the application on a different iOS device?
L
Lukasz Tomaszewski
said
almost 8 years ago
The location is about 5 m from my real location, so its not bad. But even with bad location, the accelerometer is working in any condition, so if I change the position of the phone the pois should move. i.e. I have iPhone pointed in north direction and then if I change it to south the pois should move, right now they do not. The issue I described above also happens in official samples, so there is definitely something wrong.
C
Christian Ebner
said
almost 8 years ago
I mentioned the functionality to inject the location to point out that you could control the location update from your native code, independent if you use a fake location or a real location.
Log the location values and compare them with your current location. What is your position and how far is the distance when you change youre position? Keep in mind that you will not receive accurate values if you move indoors.
Christian
L
Lukasz Tomaszewski
said
almost 8 years ago
I added an alert in location change and the allert appears on location or device position change, but still all of my pois stays in the same positon on device position change. How I can fix it ?
P.S I do not want to fake my location. On my iOS device the SDK complitly does not work for geo location base AR.
My js // implementation of AR-Experience (aka "World") var World = { // you may request new data from server periodically, however: in this sample data is only requested once isRequestingData: false, // true once data was fetched initiallyLoadedData: false, // different POI-Marker assets markerDrawable_idle: null, markerDrawable_selected: null, markerDrawable_directionIndicator: null, // list of AR.GeoObjects that are currently shown in the scene / World markerList: , // The last selected marker currentMarker: null, // called to inject new POI data loadPoisFromJsonData: function loadPoisFromJsonDataFn(poiData) { // empty list of visible markers World.markerList = ; // Start loading marker assets: // Create an AR.ImageResource for the marker idle-image World.markerDrawable_idle = new AR.ImageResource("assets/marker_idle.png"); // Create an AR.ImageResource for the marker selected-image World.markerDrawable_selected = new AR.ImageResource("assets/marker_selected.png"); // Create an AR.ImageResource referencing the image that should be displayed for a direction indicator. World.markerDrawable_directionIndicator = new AR.ImageResource("assets/indi.png"); // loop through POI-information and create an AR.GeoObject (=Marker) per POI for (var currentPlaceNr = 0; currentPlaceNr < poiData.length; currentPlaceNr++) { var singlePoi = { "id": poiData.id, "latitude": parseFloat(poiData.latitude), "longitude": parseFloat(poiData.longitude), "altitude": parseFloat(poiData.altitude), "title": poiData.name, "description": poiData.description }; /* To be able to deselect a marker while the user taps on the empty screen, the World object holds an array that contains each marker. */
World.markerList.push(new Marker(singlePoi)); } World.updateStatusMessage(currentPlaceNr + ' places loaded'); }, // updates status message shon in small "i"-button aligned bottom center updateStatusMessage: function updateStatusMessageFn(message, isWarning) { var themeToUse = isWarning ? "e" : "c"; var iconToUse = isWarning ? "alert" : "info"; $("#status-message").html(message); $("#popupInfoButton").buttonMarkup({ theme: themeToUse }); $("#popupInfoButton").buttonMarkup({ icon: iconToUse }); }, // location updates, fired every time you call architectView.setLocation() in native environment locationChanged: function locationChangedFn(lat, lon, alt, acc) { alert('Location received'); /* The custom function World.onLocationChanged checks with the flag World.initiallyLoadedData if the function was already called. With the first call of World.onLocationChanged an object that contains geo information will be created which will be later used to create a marker using the World.loadPoisFromJsonData function. */
if (!World.initiallyLoadedData) { /* requestDataFromLocal with the geo information as parameters (latitude, longitude) creates different poi data to a random location in the user's vicinity. */ World.requestDataFromLocal(lat, lon); World.initiallyLoadedData = true; } }, // fired when user pressed maker in cam onMarkerSelected: function onMarkerSelectedFn(marker) { // deselect previous marker if (World.currentMarker) { if (World.currentMarker.poiData.id == marker.poiData.id) { return; } World.currentMarker.setDeselected(World.currentMarker); } // highlight current one marker.setSelected(marker); World.currentMarker = marker; }, // screen was clicked but no geo-object was hit onScreenClick: function onScreenClickFn() { if (World.currentMarker) { World.currentMarker.setDeselected(World.currentMarker); } }, // request POI data requestDataFromLocal: function requestDataFromLocalFn(centerPointLatitude, centerPointLongitude) { var poisToCreate = 20; var poiData = ; for (var i = 0; i < poisToCreate; i++) { poiData.push({ "id": (i + 1), "longitude": (centerPointLongitude + (Math.random() / 5 - 0.1)), "latitude": (centerPointLatitude + (Math.random() / 5 - 0.1)), "description": ("This is the description of POI#" + (i + 1)), // use this value to ignore altitude information in general - marker will always be on user-level "altitude": AR.CONST.UNKNOWN_ALTITUDE, "name": ("POI#" + (i + 1)) }); } World.loadPoisFromJsonData(poiData); } }; /* Set a custom function where location changes are forwarded to. There is also a possibility to set AR.context.onLocationChanged to null. In this case the function will not be called anymore and no further location updates will be received. */ AR.context.onLocationChanged = World.locationChanged; /* To detect clicks where no drawable was hit set a custom function on AR.context.onScreenClick where the currently selected marker is deselected. */ AR.context.onScreenClick = World.onScreenClick;
C
Christian Ebner
said
almost 8 years ago
You can implement the onLocationChanged in JavaScript to check if you received a location update:
AR.context.onLocationChanged = function(latitude, longitude, altitude, accuracy){ //now, add custom functionality to build the AR scene based on the location }
On iOS, you can inject the location by setting the setUseInjectedLocation function to true and inject it with the function injectLocationWithLatitude. Don't forget that you really have to walk some meters that you notice a location change.
Hope that helps, Christian
PS. please do not ask the same quetion in multiple forums next time.
L
Lukasz Tomaszewski
said
almost 8 years ago
I am trying to integrate AR poi view with Wikitude in my app. As html I used a file from the example `4_PointOfInterest_4_SelectingPois`. It should render a few point around my location. It does it, but all points stay in the same position all the time, although I changed my phone position. I do not have any errors in the console. How can I fix it ?
On the attached photo you can see current result. The pois positon stays the same on phone position change.
Lukasz Tomaszewski