Start a new topic

septum geolocation but I can not see the point!

septum geolocation but I can not see the point!


Hi there!

Did you already checked distance to user as posted in my first reply?

 

"Keep in mind that by default POIs with distance >50.000m are not rendered.
You can adjust this via JS using e.g.

AR.context.scene.cullingDistance = 50500;

"

Also check that you only set "AR.context.onLocationChanged" once. In the provided snipped you overwrote the first event with a maybe invalid assignment to World.locationChanged.
 

Please also check if you have GPS and WiFi positioning enabled.
Also try including "ade.js"  in SDK's tool folder (instead of architect://... include) to test your experience in your dektop browser.

Kind regards,
Andreas

 

Hi,

Today i started with geolocations im my application. Starting with the basics i encountered the same issue's. 

 

My basic code:

 

<script>

//var userLocation = null; 

 

AR.context.onLocationChanged = function(lat, lon, alt, acc) {

        // the current location's latitude, longitude, altitude and accuracy

        // are passed in by the ARchitect

        //userlocation = {"lat": lat, "lon":lon, "alt":alt, "acc":acc};

        alert('onLocationChanged lat: '+lat+' lon: '+lon);

    }

var myGeoLocation  = new AR.GeoLocation(51.16136, 4.96358);

var myCircle = new AR.Circle(5, {style: {fillColor: '#FFC100'}});

var myGeoObject = new AR.GeoObject(myGeoLocation , {enabled : true, drawables: {cam: myCircle}});

AR.context.onLocationChanged = World.locationChanged;

</script>

 

It is not an issue when using relative points but the gelocated points refuse to work.

Is this an issue with the static test variables in the native java code?

 

Greetings Tim 

Hi Vincenzo

 

 

AR.context.onLocationChanged = function(lat, lon, alt, acc)

 

should be declared outside the messageClicked function. I recommend you to define a userlocation var that holds the current location of the user

 

 

var userLocation = null;

AR.context.onLocationChanged = function(lat, lon, alt, acc) {
// the current location's latitude, longitude, altitude and accuracy
// are passed in by the ARchitect
userlocation = {"lat": lat, "lon":lon, "alt":alt, "acc":acc};
// alert('onLocationChanged lat: '+lat+' lon: '+lon);
}



 

Also ensure POI data is only loaded when you already know where user is situated, e.g. request POI-data from server frequently in onLocationChanged function .
For easy testing just increment the userLocation's lat and lon values by 0.1, so you can see a sample POI nearby.
Do not use AR.RelativeLocation when you want to show POIs at fixed location, only use them for AR.GeoObjects that should move together with an object or the user.

Kind regards,
Andreas

hi,

risucire are to have the coordinates but it takes a bit of time to get the alert but now I do not know how to point out a geo-located .... how could I do?

 

my function final:

 


 

function messageClicked() {
// set the message DIV text
document.getElementById("messageElement").innerHTML = "Loading...";

AR.context.onLocationChanged = function(lat, lon, alt, acc) {
// the current location's latitude, longitude, altitude and accuracy
// are passed in by the ARchitect
alert('onLocationChanged lat: '+lat+' lon: '+lon);
}

//AR.context.onLocationChanged = World.locationChanged;

var myGeoLocation1 = new AR.RelativeLocation(null, 5, 0, 0);
var myGeoLocation = new AR.GeoLocation(40.8219573, 14.187214100000006, 320.);//BMT mostra d.m.
var myGeoLocation2 = new AR.RelativeLocation(myGeoLocation1, 10, 0, 0);

var myCircle = new AR.Circle(1,
{ onClick : function() {
alert('Cliccato');
},
style: {fillColor: '#00ABEF'}
});

var myGeoObject = new AR.GeoObject(myGeoLocation2, {
enabled : false,
drawables: {cam: myCircle}});

myGeoObject.enabled = true;

//AR.context.onLocationChanged = null;

// Hide loading message
document.getElementById("messageElement").style.display="none";
}


 

Hi Andreas,

I'll explain better what I would do.

I let out a circle with the precise coordinates and the sequent function can not:

 

function messageClicked() {
// set the message DIV text
document.getElementById("messageElement").innerHTML = "Loading...";

var World = {

locationChanged: function locationChangedFn(lat, lon, alt, acc) {

alert("received new location");

}

}

AR.context.onLocationChanged = World.locationChanged;

var myGeoLocation1 = new AR.RelativeLocation(null, 5, 0, 0);
var myGeoLocation = new AR.GeoLocation(40.8219573, 14.187214100000006, 320.);//BMT mostra d.m.
var myGeoLocation2 = new AR.RelativeLocation(myGeoLocation1, 10, 0, 0);

var myCircle = new AR.Circle(1,
{ onClick : function() {
alert('Cliccato');
},
style: {fillColor: '#00ABEF'}
});

var myGeoObject = new AR.GeoObject(myGeoLocation2, {
enabled : false,
drawables: {cam: myCircle}});

myGeoObject.enabled = true;

//AR.context.onLocationChanged = null;

// Hide loading message
document.getElementById("messageElement").style.display="none";
}


 

 

and I can not even squeeze out the alert in LocationChanged.

how could I do?

Hi Vincenzo,

The location of the user is injected by phoneGap frequently.
The phoneGap module updates the AR-view's / user's location using phoneGaps geoLocation.

To check that everything works as expected you can add the following snippet in your ARchitect World html/JS file

var World = {

locationChanged: function locationChangedFn(lat, lon, alt, acc) {

alert("received new location");

}

}

AR.context.onLocationChanged = World.locationChanged;

 

 

Keep in mind that by default POIs with distance >50.000m are not rendered.
You can adjust this via JS using e.g.

AR.context.scene.cullingDistance = 50500;

 

Hope that helps.

Kind regards,
Andreas

 

hi,

I need help could not understand why setting the geolocation (also known as) I can not see the point geo-located.

the code is as follows:

 

function messageClicked() {
// set the message DIV text
document.getElementById("messageElement").innerHTML = "Loading...";

//var myGeoLocation = new AR.RelativeLocation(null, 5, 0, 0);
var myGeoLocation = new AR.GeoLocation(40.8219573, 14.187214100000006, 320.);//BMT mostra d.m.
var myGeoLocation2 = new AR.RelativeLocation(myGeoLocation, 10, 0, 0);

var myCircle = new AR.Circle(1,
{ onClick : function() {
alert('Cliccato');
},
style: {fillColor: '#00ABEF'}
});

var myGeoObject = new AR.GeoObject(myGeoLocation2, {
enabled : false,
drawables: {cam: myCircle}});

myGeoObject.enabled = true;

//AR.context.onLocationChanged = null;

// Hide loading message
document.getElementById("messageElement").style.display="none";
}


 

 

while, if I enter the relative position, the point goes smoothly and everything works .... something wrong?

 

i use phonegap/cordova 2.6.0 on android project
Login or Signup to post a comment