reverse: not working on custom layers
Describe the bug Custom layers are incompatible with layer filters in reverse queries.
Steps to Reproduce
- Import custom data into Pelias from CSV using custom sources and layers.
- Perform a reverse query filtered on those layers.
- No results.
Pastebin/Screenshots
Pelias request : .../v1/reverse?point.lat=43.538662&point.lon=1.460511&boundary.circle.radius=0.0001&size=10&layers=stop_area&sources=custom
CSV looks like :
id,source,name,layer,housenumber,street,postcode,lon,lat,addendum_json_custom,category,parent_json
SA_1,custom,Montjoie,stop_area,,,31520,1.4605112727420955,43.5386624143594,"{""network"": ""Tisséo"", ""physical_mode"": ""3""}",network:Tisséo,"{""locality"": [{""id"": ""64"", ""name"": ""RAMONVILLE-SAIN
SA_10,custom,Le Lac Reynerie,stop_area,,,31000,1.4040756476682126,43.56748734995478,"{""network"": ""Tisséo"", ""physical_mode"": ""10""}",network:Tisséo,"{""locality"": [{""id"": ""79"", ""name"": ""TOULO
SA_100,custom,Borde Haute,stop_area,,,31850,1.5314279793318943,43.64370947141033,"{""network"": ""Tisséo"", ""physical_mode"": ""3""}",network:Tisséo,"{""locality"": [{""id"": ""51"", ""name"": ""MONTRABE"
SA_1000,custom,Phidias,stop_area,,,31000,1.374173329972152,43.580869083701046,"{""network"": ""Tisséo"", ""physical_mode"": ""3""}",network:Tisséo,"{""locality"": [{""id"": ""79"", ""name"": ""TOULOUSE""}]
SA_1002,custom,Amidonniers,stop_area,,,31000,1.4281847885171595,43.60631516569829,"{""network"": ""Tisséo"", ""physical_mode"": ""10, 3""}",network:Tisséo,"{""locality"": [{""id"": ""79"", ""name"": ""TOUL
SA_1004,custom,Lauragais,stop_area,,,31130,1.53423130511658,43.586655062927974,"{""network"": ""Tisséo"", ""physical_mode"": ""3""}",network:Tisséo,"{""locality"": [{""id"": ""63"", ""name"": ""QUINT-FONSE
SA_1007,custom,Mayer,stop_area,,,31000,1.3954042541911866,43.54397616546114,"{""network"": ""Tisséo"", ""physical_mode"": ""3""}",network:Tisséo,"{""locality"": [{""id"": ""79"", ""name"": ""TOULOUSE""}],
SA_1008,custom,Françoise Dolto,stop_area,,,31000,1.3781796945667264,43.55555972591757,"{""network"": ""Tisséo"", ""physical_mode"": ""3""}",network:Tisséo,"{""locality"": [{""id"": ""79"", ""name"": ""TOUL
SA_1009,custom,Secteur A,stop_area,,,31700,1.3309088208015807,43.640006650717964,"{""network"": ""Tisséo"", ""physical_mode"": ""9""}",network:Tisséo,"{""locality"": [{""id"": ""20"", ""name"": ""CORNEBARR
SA_1010,custom,Cimetière Villeneuve,stop_area,,,31270,1.3692281473639352,43.52470437081928,"{""network"": ""Tisséo"", ""physical_mode"": ""3""}",network:Tisséo,"{""locality"": [{""id"": ""85"", ""name"": "
SA_1011,custom,Bellefontaine,stop_area,,,31000,1.3995556944383656,43.56633323874598,"{""network"": ""Tisséo"", ""physical_mode"": ""1, 10""}",network:Tisséo,"{""locality"": [{""id"": ""79"", ""name"": ""TO
Additional context
Autocomplete and search requests are fine. We investigated and found that isCoarseReverse.js and isOnlyNonAdminLayers.js are experiencing some issues. The list of non-coarse layers is hardcoded. Addition of our stop_area layer to the hardcoded list solved the issue.
We are novices to Pelias projects and require assistance in resolving it effectively. What is the approach to solving it in a generic manner?
Interesting, it seems that code is quite old and has a hard-coded list of layers which is causing this issue.
What happens if you change your query to include one of those layers?
ie. layers=stop_area,venue?
All we get is the venue. I'm sorry, my description of the problem was incomplete.
- We changed those lines as well (intersection):
https://github.com/pelias/api/blob/b3262b5060a18ed38d167d342c162cb71f18f3ff/query/reverse.js#L41-L45
- And this one:
https://github.com/pelias/api/blob/b3262b5060a18ed38d167d342c162cb71f18f3ff/query/reverse_defaults.js#L8
Then it works !
This looks like one of the cases mentioned in https://github.com/pelias/api/issues/1161. We had https://github.com/pelias/api/pull/1631 which I think mostly resolves it but that PR stalled for some reason.
While it would require a bit of mental refresh of the code and some testing, I don't think it's a significant change and something we really should fix.
Thank you for your answers. We have made some code changes and will soon be able to submit a more complete PR than #1631