Start a new topic

Load only POI around me and not the entire file

Hello all


I have a local JSON file with more than 200 000 objects

I use this code to display the POI (using the radar also):


https://github.com/Wikitude/wikitude-sdk-samples/blob/master/09_ObtainPoiData_2_FromLocalResource/js/fromlocalresource.js 


But the app crashed, if I put 10 objects in my JSON file, it works.


What I would like to do is to limit the loading of the POIs around me, so it won't load the entire JSON file


How can I do that ? 


Have you a sample code ?


Thanks for your help


Hi,


Thx for reaching out. This questions sounds more like a question how to filter data. Did you check JSON forums to find further details? We only offer the sample code that is provided in the sample app together with the documentation.


Greetings

Nicola

You know I have more than 100 000 objects in JSON file, I want only to display the ones which are close to me.

Why in your sample app it loads all the data ? Do you have a partial code showing how to load only the data close to the user ?


Thanks 

Hi Patrick,


Creating all POIs at once causes (texture-) memory issues and is definitely not the way to go.

As you mentioned in your previous post, loading the POIs that are nearby a predefined geo-coordinate, is best practice.


I recommend you to setup a server endpoint that returns the POIs nearby a passed lat/long parameter pair. You may then request the server data on location update, wipe away existing POIs where needed, and create the new ones as described in the sample code.

As an alternative, you may host all data client-side and sort the POIs by distance to then only display the closest ones.
Either way, ensure to set-up a proper mechanism to destroy no longer used POIs and only create AR objects of the relevant POIs.


Unfortunately, there is no sample covering your use case, but sorting a list by its "distance To User" shouldn't be an issue. You may either use  AR.Location as a helper or calculate the distance manually.


Hope that helps,

Best regards,

Andreas Fötschl

Login or Signup to post a comment