Start a new topic
Solved

Cannot display GeoObject

Hi there,


I'm using Wikitude SDK 6.1 (Android using Javascript API) with the code below. Location is retrieved (checked inside onLocationChanged) but I cannot see the marker. Is there something wrong with my code?


Snippet

var World = {
 pois: null,
 
 init: function initFn() {
 AR.hardware.sensors.enabled = true;
 AR.context.onLocationChanged = this.onLocationChanged;
 },
 
 createPOI: function (location) {
 World.pois.push(new Marker(location));
 },
 
 onLocationChanged: function onLocationChangedFn(latitude, longitude, altitude, accuracy) {
 if (World.pois == null) {
 World.pois = 1;
 World.markerDrawable_idle = new AR.ImageResource("assets/marker_idle.png");
 
 var markerLocation = new AR.GeoLocation(latitude, longitude, AR.CONST.UNKNOWN_ALTITUDE);
 var markerImageDrawable_idle = new AR.ImageDrawable(World.markerDrawable_idle, 2.5, {
 zOrder: 0,
 opacity: 1.0
 });
 
 var htmlDrawable = new AR.HtmlDrawable({ html: "<div style='font-size: 5em'>POI</div>" }, 1, {
 horizontalAnchor: AR.CONST.HORIZONTAL_ANCHOR.CENTER,
 verticalAnchor: AR.CONST.VERTICAL_ANCHOR.MIDDLE
 });
 
 var markerObject = new AR.GeoObject(markerLocation, {
 drawables: {
 cam: [markerImageDrawable_idle, htmlDrawable]
 }
 });
 }

 $("#message").text("Lat: " + latitude + ", Lon: " + longitude);
 },
};
World.init();




Hello Lance,

Did you try with one of our samples to see if this is working for you?

Thanks
Eva

 

Hi Eva,


I tried all 4 samples of 06_PointOfInterest but none of them worked. The icon (at the end of screen) said that "place(s) loaded" but I cannot see any marker.


Regards,

Lance

For more details, I'm using Xamarin to develop Android with Wikitude Javascript SDK. 


Regards,

Hello Lance,

I tested our samples again and I was able to see the POIs. I also tested the code you sent and I get the message 'Trying to find out where you are' but I can also see the POI you loaded. May I suggest the following:
  • Run our samples and modify your code based on the code we provide
  • Test outside
  • Make sure that your GPS provider is accurate enough and also make sure to calibrate your phone before start testing

Thanks

Eva

 

Hi Eva,


I'm able to see the POI now. It seems that my phone is not calibrated yet.


Anyway, thanks for your help!


Regards,

Hi I'm having the same problem as yours. Can i know what phone did you use to run the code? I'm using android phone that does not have built in compass. Correct me if i'm wrong, is that how you calibrate your phone? Using compass?

I'm using Samsung Galaxy A3. Calibrating the phone is to get location more accuracy via location provider. If your POIs are in a large range, you can see it without calibrating (my app just have a few POIs nearby).

Does that mean that you improvised the Location provider provided by wikitude? If you don't mind, can you share with me the code? Thank you in advance, Lance :)

Btw I'm testing my apps using Samsung Galaxy J1. It is supposed to work but I encounter the same problem even with wikitude examples. The places only loaded but didn't displayed. If you think you know the reason why, please let me know :)

I'm using FusedLocationApi, not Location provider. To use it, you must add Google Play Services to your application. I attached the code I used for sample. It's in C# because I'm using Xamarin.


One more issue you may consider is the position of markers. You should look around and/or overtun the phone to see if the marers appear. One more thing that the ArchitectView display markers in range 50km only.

cs

Hi Lance, 

Thank you so much for the suggestion. You have been so supportive so far. However, after using Fused Location Api as you suggested, the problem still occurs. I attached my codes along with this reply. I load the native detail screen example provided by wikitude and only changed the web server. I uploaded a few POIs around me onto a web server as dummies. They are loaded but can't be displayed. I also attached the picture of my apps. Finally, I have tried the Wikitude's other examples as well. But this happened again. If you, or Wikitude support team knows why this is still happening, please help me. I really need it.


Regards, 

Sungra

js
java
(7.08 KB)

Hi Lance,

I have tried the codes that I attached previously again on a different device. It is finally working. Turns out, the device that I used was the problem. Thank you so much for you cooperation and kind replies :)

You're welcome! So glad to hear that you can make it works.

Login or Signup to post a comment