Start a new topic

How to draw marker at different heights above the horizon

How to draw marker at different heights above the horizon

I can draw many items with "new AR.GeoLocation(lon,lat)" but you will see all on the same line, at horizon.

I need to draw them at different heights relatives to horizon, to fill the screen vertically. No matter the vertical order.

the altitude information is only available if the location accuracy is good enough. You can check that altitude information is available with the onLocationChanged trigger.


AR.context.onLocationChanged = function(latitude, longitude, altitude, accuracy){

 // check altitude value, if it is not AR.CONST.UNKNOWN_ALTITUDE, altitude information will be used for drawing pois.



If you always want the POIs to be drawn according to their altitude, you must provide a valid altitude information via injecting your custom location. This is done in the native part of the SDK (see injectLocation in Wikitude SDK's Xcode doc or javadoc) by always supplying an altitude.

Like that?


Altitute always return -32768, not 0. What's wrong?

The goal is to fix the altitude to the sea level. Longitude and latitude still geolocalized

You need to supply an accuracy that indicates that the altitude received is accuracte enough so the SDK trusts the provided altitude. e.g. giving a accuracy of 5.0 meters should work.

I've tried with

cordova.exec(this.onWikitudeOK, this.onWikitudeError, "WikitudePlugin", "setLocation", );

and with

cordova.exec(this.onWikitudeOK, this.onWikitudeError, "WikitudePlugin", "setLocation", );

But it returns in the app always this: lat 41.911691 lon 12.460212 alt -32768 acc 2

I've missed something?


Is one of the callbacks (this.onWikitudeOK, this.onWikitudeError) executed? Is there any javascript error while executing this?

Are you using the latest phonegap plugin version and what platform are you using?

If the above does not yield an answer and you are running this on Android, please try the following:

In around line 605, comment the body of this method

public void onLocationChanged( final Location location ) {
// ...
// ...
// ...


Let me know if anything worked or if you have additional questions.

Is one of the callbacks (this.onWikitudeOK, this.onWikitudeError) executed?



Is there any javascript error while executing this?



Commenting out the contents of onLocationChanged i can't see any gps coordinate anymore (but i guess it's normal: who could tell the gps coordinate to the app if we remove the contents of onLocationChanged?).

If i set onLocationChanged with this content it works flawless


if (location!=null) {

WikitudePlugin.this.lastKnownLocaton = location;

if ( WikitudePlugin.this.architectView != null ) {

WikitudePlugin.this.architectView.setLocation( location.getLatitude(), location.getLongitude(), 23.0, location.getAccuracy() );




But i can't use this code on iOS obviously.

Have you got any other tips?

We just fixed the problem in the android plugin. See my fork here:

This will also make it into the wikitude master soon.

Is iOS causing you the same problem? My understanding is that this was just a problem on Android. Let me know if I'm wrong.

It sounds good.

The issue is only on Android.

Thanks man
Login or Signup to post a comment