Start a new topic

Can't load POI data with message of "0 data loaded".

Hi. I'm using Wikitude SDK for create my GEO location app on Android.

Then I'm testing with modification of sample app of 09_ObtainPoiData_3_FromWebservice's "fromwebservice.js".

However, looks like I can't load POI data with message of "0 data loaded".

Please advise why I can't load and how I solve it.

 

I changed sample webservice URL to MyWebserviceURL like,  

var jqxhr = $.getJSON({"MyWebserviceURL", function(data) {
                World.loadPoisFromJsonData(data);
            })

 

and MyWebserviceURL returns JSON like

{"@odata.context":"MyWebserviceURL","value":
[{"altitude": "0.0", "longitude": "139.769525", "latitude": "35.67743", "id": 26}, 
 {"altitude": "0.0", "longitude": "139.763503", "latitude": "35.676947", "id": 27}
]}

 

Please note the above is OData format and also I just created simplified WebService with

returning just 3 properties of 1.altitude, 2.longitude, 3.latitude.

 

Also I changed the looping section like

 

 /* Loop through POI-information and create an AR.GeoObject (=Marker) per POI. */
        for (var currentPlaceNr = 0; currentPlaceNr < poiData.length; currentPlaceNr++) {
            var singlePoi = {
                "id": poiData[currentPlaceNr].id,
             "altitude": parseFloat(poiData[currentPlaceNr].altitude),
                "latitude": parseFloat(poiData[currentPlaceNr].latitude),
                "longitude": parseFloat(poiData[currentPlaceNr].longitude),
            };

 

My questions are,

- Returning JSON should be completely same format as myjason.js ?

- Can add/delete propaties of current schema of id, latitude, longitude, altitude, title, description for loading POI data ?

- Is any reference/documentation available for "World.loadPoisFromJsonData(data)" - I want to know the specification.


Hi,


So you get valid data back from the server and didn't change anything else in the SDK sample app? This would be the first thing to check and start with step-by-step --> 1. just change the url and make sure that the json is valid and that the POIs are actually in the vicinty of the testlocation. You're not bound to the json format we're using in our sample - as long as it's valid and you make sure that you parse it correctly it should work.


For the last question, please have a look at the implementation on World.loadPoisFromJsonData(data) in the SDK sample app --> this is the only reference as it's a method solely used in the sample app.


Thx and greetings

Nicola



Hi Nicola,

Thanks for advice.


> the POIs are actually in the vicinty of the testlocation


No, I can't make sure because no POIs are available with "0 places loaded" message.

In other word, my question is how I can ensure my JSON from MyWebsercie is valid.


Also, another question is , how the app can check the vicinty of the testlocation?

How the app get the testlocation info from where in the codes ?


Please advise, and thanks. 

Nakai

Hi Nakai,


There are json validitors available online to check if the json is valid (e.g. https://jsonformatter.curiousconcept.com/). As mentioned if you change the format you'll need to ensure that once you parse the json that the changes in the structure are reflected in the parsing step.


You'd need to know the latitude / longitude values of your location and then set the location of the POIs in your surrounding. If the POIs are e.g. on the other side of the world, then these won't be loaded and could also be an indicator why 0 POIs are loaded.


Please also make sure to debug your code to see where the problem might be and check the different steps --> does the service actually return something in the vicitiy of your test? Do you parse the correct data?...


Thx and greetings

Nicola

Login or Signup to post a comment