Start a new topic

Why can't I see my POIs with real geolocations?

Why can't I see my POIs with real geolocations?


Hi...

 

I'm testing Architect´s examples... I'm trying to change random geolocation for an real location near to me. I searched the coordenates (latitude and longitude) in Google Earth. So, when I put the real coordenates in an code example, I can't see any geoObject in my App... It is my code:

 



<script>

 

function enterFOV() {

document.getElementById("statusElement").innerHTML = "I can see you!";


}

 

//Called if the GeoObject exits the field of vision

function exitFOV() {

document.getElementById("statusElement").innerHTML = "Look around!";


}

 

AR.context.onLocationChanged = locationChanged;

 

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

// the current location's latitude, longitude, altitude and accuracy are passed in by the ARchitect

 

// Create a new GeoLocation with the calculated latitude and longitude

// A GeoLocation defines a geo refernece location using latitude and longitude.  

var usco = new AR.GeoLocation(2.941369, -75.299100);

var cocaCola = new AR.GeoLocation(2.953819, -75.298061);

 

var myCircle = new AR.ImageDrawable(Sun-icon.png, 5);


 

// Create the GeoObject that puts it all together.

// The GeoObject will be placed at the previously created GeoLocation and an orange Circle

// will appear at that location. By creating the object it will be immediately visible.

var uscoObject = new AR.GeoObject(usco, {drawables: {cam: myCircle}, triggers: { onEnterFieldOfVision: enterFOV, onExitFieldOfVision: exitFOV}});

var cocaColaObject = new AR.GeoObject(cocaCola, {drawables: {cam: myCircle}, triggers: { onEnterFieldOfVision: enterFOV, onExitFieldOfVision: exitFOV}});

 

// We are only interested in the first location, let's set the onLocationChanged trigger to null which

// will deactivate it.

AR.context.onLocationChanged = null;

 

// Hide loading message

document.getElementById("messageElement").style.display="none";




 

</script>

 

<div id="statusElement" class="status"></div>

 

<div id="messageElement" class="message">

Loading ...

</div>

</body>

</html>

 


 

 

I don't know what happen. thx for help me..

Hi,
if the code you posted is the one you are using then you forgot to put the ImageDrawable source into quotation marks: Sun-icon.png

If you add the ade.js to your html then it's much easier to find syntax-errors. Just add those lines within your head-tag (more): <script type="text/javascript" src="ade.js"></script>

Then open your html with chrome for example, right-click on your browser-window and select "inspect element". In your console-tab you can check if you have any errors.

Hope this helps,
Chris

thx for help me, My code is:

...

 

var sunImg = new AR.ImageResource("Sun-icon.png");

var sunSize =  5;

 

// Create an orange circle with a radius of 5

var myCircle = new AR.ImageDrawable(sunImg, sunSize);

....

 

I think the problem isn't image because I used AR.circle too and happened the same.

Did you check if you really receive a location? If you don't receive a location then the function locationChanged(lat, lon, alt, acc) will never be executed. You can check it by adding an alert for example: alert('locationChanged - lat: ' + lat + " lon: " + lon);

or by displaying it in a div: document.getElementById("statusElement").innerHTML = 'locationChanged - lat: ' + lat + " lon: " + lon;









If you don't need GeoLocations you can also have a look at RelativeLocations.

Cheers,

Chris

 

 

Thx, I cheked locationChanged and the coordenates are wrong. My location is in Colombia (lat:2.9499  lon:-75.2995 ) but locationChanged get wrong coordenates (lat: 47.773200 lon: 13.069700). It coordenates are always the same. How do I fix it?

regards.

Sorry, I found the mistake... In the code example SimepleArBrowser.java there are TEST_LATITUDE, TEST_LONGITUD... I think locationChanged took GPS coordenates. Now I try to take my GPS coordenates correctly.
Login or Signup to post a comment