Skip to main content

Hello Community,

 

We are trying to implement a radius search on a map element.

We have a table with geocoordinates (Lon and Lat), which we can also convert into a geography::Point.

For the purpose of planning, I now want to know when I am on a dataset, which datasets from the same table are X kilometers away to do further planning.

On the MS-SQL Server side, we know what to do:

declare @point geography = geography::Point(<Latitude>, <Longitude>, 4326);

SELECT id, geo_point
FROM table]
WHERE @point.STDistance((geo_point]) <= 40000; -- input distance in meters

 

But in the Sofware Factory / Universal GUI we are currently unable to find a solution. Clearly a task with the distance as a parameter and the current geodata of the selected data set. And as a result we could get a list with IDs which data records are within the specified radius. But how do we filter this and how do we prevent everything from being recalculated immediately when the data set is changed? Or are we thinking in the wrong direction?

 

Thanks for your input.

Hi ​@Christian Schmidtchen,

The filter lat/long and radius should be temporarily stored in a table for the current user using tsf_user() or for the current session using SESSION_CONTEXT(N'guid').

The dataset used for the map should then be filtered or appended for the current user based on the provided circle.

This can be done using a prefilter with code similar to the code you provided, again using the current user or current session.

For instance (pseudo)

exists (select 1
from usr_map_filter f
where f.usr_id = dbo.tsf_user()
and f.geo_point.STDistance(t1.geo_point) <= f.filter_radius
)

 

One of the things currently being worked on is the ability to add markers and geometric types to a map:

This would allow end-users to draw a circle on the map, which would be sent to the back-end via a task. One of the mapped parameters will include the lat/long and the radius (in meter) of the circle created by the user. Keep an eye on this as it will greatly improve the user experience!


Hi Anne,

thank you, that helped me a lot and it works perfectly. I just need to cast at the point with the “geo_point” because I always got an error message from indicium when I used the data type “geogaphy”. Now I store the data in a varbinary field and use CONVERT or CAST when I calculate or evaluate it.


Reply