Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reverse: not working on custom layers #1678

Open
enrikomic opened this issue Oct 11, 2024 · 4 comments
Open

reverse: not working on custom layers #1678

enrikomic opened this issue Oct 11, 2024 · 4 comments
Labels

Comments

@enrikomic
Copy link

enrikomic commented Oct 11, 2024

Describe the bug
Custom layers are incompatible with layer filters in reverse queries.

Steps to Reproduce

  1. Import custom data into Pelias from CSV using custom sources and layers.
  2. Perform a reverse query filtered on those layers.
  3. 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?

@enrikomic enrikomic added the bug label Oct 11, 2024
@missinglink
Copy link
Member

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?

@enrikomic
Copy link
Author

enrikomic commented Oct 11, 2024

All we get is the venue. I'm sorry, my description of the problem was incomplete.

  1. We changed those lines as well (intersection):

api/query/reverse.js

Lines 41 to 45 in b3262b5

if( _.isArray(clean.layers) && !_.isEmpty(clean.layers) ) {
// only include non-coarse layers
vs.var( 'layers', _.intersection(clean.layers, ['address', 'street', 'venue']));
}

  1. And this one:

'layers': ['venue', 'address', 'street'],

Then it works !

@orangejulius
Copy link
Member

This looks like one of the cases mentioned in #1161. We had #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.

@enrikomic
Copy link
Author

enrikomic commented Oct 14, 2024

Thank you for your answers. We have made some code changes and will soon be able to submit a more complete PR than #1631

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants