Start a new topic

How to filter location data

How to filter location data


Hi,

I'm working on 5_BrowsingPois_3_LimitingRange, this example can show us filter by distance via slider. I can see the only way to do: This is setMaxDistance. Is that true?

For my project, i want to do more filter, by name, description,...

Could you please tell me how i can do that?

Thanks

Hi,

There are several ways to do that. When you want to filter an array of POIs, you can use the Array.filter function, and use it like this:

var a =

a.filter(

    function(val){

        return (val === "my");

    }

);

 

Then apply this function whenever you want to filter by a particular constraint. You can of course swap the function I provided with any custom function yu want.

Hope this helps.

Best,

Martin
Login or Signup to post a comment