Public Lab

Changing nearby nodes logic in API's .

We have this API for fetching nodes having specific tag :

https://github.com/publiclab/plots2/blob/ba053502ded9ec0163af90d3d7a4cb3eb2a4b74e/app/api/srch/search.rb#L224

This API takes latitude and longitude in the form : query=lat,lon AND them using these coordinates calculates NEAR-BY NODES using this logic :

https://github.com/publiclab/plots2/blob/ba053502ded9ec0163af90d3d7a4cb3eb2a4b74e/app/services/search_service.rb#L104-L108

What do we want ?

We need to take a pair of coordinates in the API URL in the form of :

nwlat=71.01&selat=4.39&nwlng=-172.79&selng=80.33

nwlat=71.01695975726373&selat=4.390228926463396&nwlng=-172.79296875&selng=80.33203125

where nwlat = NorthWest Latitude and selat = SouthEast Latitude and so on ...

Now using these pair of coordinates , calculate all the NODES within the Rectangle Boundary made by these diagonally opposite coordinates .

Task tags

  • api
  • geographical

Students who completed this task

okonek83

Task type

  • code Code
close

2018