Display features on the map based on a diameter

hello everyone, I would like to know if it is possible to display the entities on the map according to a radius around the collector.

example display all entities that are 10 meters from the collector.

If it is possible how to do it?

Hello @steeve_kevin ,

not in an easy way. I tried something that woks on grids but it is really not clean nor efficient :

  • It requires to create a geopoint to filter the place to print on the screen
  • It isn't based on the real distance between the enumerator and the places to show on the map but on the precision of the coordinates (considering that close places share the sames coordinates at a certain decimal level. The distance in meters that correspond to 0,0001 degree vary from one place one the earth to another...

So I calculate the longitude and latitude of the geopoint and I filter the places to show on their own long / lat values...

In a secondary version I compare the actual position and the boundings coordinates of the select objects.

Tell me if it is not that clear...

We agree that such a capability, to filter features with the actual location, in a transparent (no geopoint needed), efficient (indexed) way would be great :wink:

Thanks @mathieubossaert please I can see your solution I would like to test it and if possible make an improvement

of course !

Here it is, compliant with the extraordinary xlsform tamplate :star_struck:

  • The form ask you for a tolerance in meter (here I consider one meter correspond to 0.00001 degree)
  • We use a ten meters square grid (geojson attached)
  • The map shows you all the cells close to you that were not selected earlier in the form
  • If you do not find the cell you want close to your location, the form shows you the whole layer...

filter_on_location.zip (366,6 Ko)

Please share any trick or improvement :slight_smile:

This is likely not performant enough for your needs, especially given @steeve_kevin's 180,000 points (!), but have either of you tried a choice filter of distance(geometry, ${current_location}) < 10 where current_location would be a geopoint question?

1 Like

Thanks @ln!

No... And I don't know why :face_with_raised_eyebrow:
I''ll try it in a few jours !

I just tried but I can't make it run @LN.

Distance asks for one parameter.
I tried to concatenate both points as shown in the documentation : https://docs.getodk.org/form-operators-functions/#id22

distance(concat(geometry,’ ; ‘,${point})) < ${tolerance}

But now get an error saying the function distance requires a field as a parameter.

Now I remember I fried before I used coordinates calculation.
But your optimism with the distance function make me think it is possible :slight_smile: and I am misusing the function.

Sadly my optimism was misplaced. I did not realize that the geo functions only accept nodeset arguments. I've filed an issue to explore changing that: https://github.com/getodk/javarosa/issues/740

1 Like

Is there no possibility to "cast" a string to a node-set? (Something like a make_instance function :innocent:). This could help in other contexts too.