gbif / geocode

Geocode webservice and client
Apache License 2.0
4 stars 4 forks source link

Distance order is not preserved #17

Closed timrobertson100 closed 1 year ago

timrobertson100 commented 3 years ago

The geocode service is not preserving the ordering by distance.

This shows the problem.

SELECT layer, id, distance FROM query_layers(4.02, 50.02, 0.05, ARRAY['IHO', 'EEZ', 'Political', 'GADM1', 'GADM2', 'GADM3', 'Centroids', 'WGSRPD']);
   layer   │      id       │      distance
───────────┼───────────────┼────────────────────
 Political │ FR            │                  0
 GADM3     │ FRA.7.2.1_1   │                  0
 GADM2     │ FRA.7.2_1     │                  0
 GADM1     │ FRA.7_1       │                  0
 GADM3     │ FRA.7.1.5_1   │ 0.0261643707422069
 GADM2     │ FRA.7.1_1     │ 0.0261643707422069
 WGSRPD    │ WGSRPD:FRA-FR │                  0

We need to add ORDER BY distance to the Mapper SQL here and all the references to Collection should be replaced by List in the code relating to this (the service API, implementation, and WS resource)

MattBlissett commented 1 year ago

Collections replaced by Lists