Start a new topic

Static POIs (phonegap)

Static POIs (phonegap)


Hi, i'm using the example as guide to generate static POIs, i'm already linking myJsonData with the javascript file. when i run the app with the random generated POIs all works fine but when i do it with my static POIs, nothing appears.

Here is the part of the code i think isn't working.

 


// request POI data

requestDataFromLocal: function requestDataFromLocalFn(lat, lon) {

 

//var poisNearby = Helper.bringPlacesToUser(myJsonData, lat, lon);

//World.loadPoisFromJsonData(poisNearby);

 

 

 

 

/*

For demo purpose they are relocated randomly around the user using a 'Helper'-function.

Comment out previous 2 lines and use the following line > instead < to use static values 1:1. 

*/

 

World.loadPoisFromJsonData(myJsonData);

}

 

};

 

 /*var Helper = {

 

/* 

For demo purpose only, this method takes poi data and a center point (latitude, longitude) to relocate the given places randomly around the user

*/

/*bringPlacesToUser: function bringPlacesToUserFn(poiData, latitude, longitude) {

 

 

for (var i = 0; i < poiData.length; i++) {

poiData.latitude = latitude;

poiData.longitude = longitude;

/* 

Note: setting altitude to '0'

will cause places being shown below / above user,

depending on the user 's GPS signal altitude. 

Using this contant will ignore any altitude information and always show the places on user-level altitude

*/

/*poiData.altitude = AR.CONST.UNKNOWN_ALTITUDE;

}

return poiData;

}

}

 

 

/* forward locationChanges to custom function */

AR.context.onLocationChanged = World.locationChanged;

 

/* forward clicks in empty area to World */

AR.context.onScreenClick = World.onScreenClick;

 

 

 

Thanks!

Hi Andrés,

You should use the ADE to debug the problem. Maybe you have an error in the Java execution, or the JSON data is in an invalid format.

Instructions how to use the ADE can be found here.

Best,

Martin

Hi Martin,

I used the ADE and everythign seems to be ok, when i use this function all the POIs use the same coordenates

World.loadPoisFromJsonData(myJsonData);

Best,

Andrés

 

 

Hi Andrés,

In this case, I assume that the coordinates of your POIs are not as you expect them to be.

I suggest to debug - step by step - your application and compare it with the data from the samples application. You need to submit your own data it in the exact same format the sample application does, you should only change the values (otherwise you'd have to rewrite the way the POIs are generated).

A step-by-step debugging (either with a proper debugger or with console.log calls) will help you diagnose the issue. There's nothing Wikitude does to prevent custom data of course.

Best,

Martin

Hi Martin,

I've already changed the data in the sample aplication, but the problem is that the sample aplication use random values to show the POIs and when i integrate data, my POIs are also randomized.

 

Best,

Andrés 

Hi Andres,

Please use a step-by-step debugger to understand where the coordinates of the POIs are randomized. Again, this will be done somewhere in the JavaScript, the SDK takes the coordinates as they are and does not randomize them.

I again suggest to use the ADE, for example in Chrome, and use the developer console to understand step by step what is happening to your data. If the POIs are randomized, you will see this at some point in the JavaScript.

A detailled explanation of how to debug JavaScript with Chrome can be found here.

Best,

Martin
Login or Signup to post a comment