opentripplanner / otp-ui

React component library, which can be used to build trip planner webapps.
http://www.opentripplanner.org/otp-ui/?path=/story/transitvehicleoverlay--real-time-rectangles
MIT License
56 stars 34 forks source link

Add ability to filter layers from geocoder result sets in LocationFieldComponent #99

Open PaulIvanov opened 4 years ago

PaulIvanov commented 4 years ago

@fpurcell has recently added the ability to get routes to be searchable from within the PELIAS geocoder and is very useful in general cases, but in some contexts we want to be able to prevent that "layer" from being a part of the search results. An example where this can cause buggy/unwanted behavior is when planning a trip. A user may unintentionally plan a trip using a "route" layer item and the trip planner will plan a confusing trip based on that.

We were thinking it would be good to have a generic way to pass the "layers" we want to filter out before being presented in the locationField results. We are open to talking more about this feature, but ultimately think it is necessary in order to fulfill our requirements on the trimet.org site

fpurcell commented 4 years ago

Hey Paul ... in the short term, it might be best to remove the routes from the geocoder. There isn't a good way to exclude a layer in Pelias atm. It's on the Pelias roadmap, but not quite yet available: https://github.com/pelias/pelias/issues/844

fpurcell commented 4 years ago

That said, we could / should add to otp-ui a prop to define the 'layers' param being sent down to geocoder (Pelias) requests. In terms of trimet.org, you'd set layers=-routes whenever you don't want any routes to show up in the results. But until Pelias is ready to accept the exclusive layers values, we'd have to filter sources as a param on the geocoder service, else we'd have problems, ala: https://ws-st.trimet.org/pelias/v1/autocomplete?text=20%20burnside%20stark&sources=-routes

PaulIvanov commented 4 years ago

Hey thanks for the information Frank. For a short term fix, until pelias has the feature available, would we be able to still pass in the layers we want so that the geocoder can filter after the pelias service comes back with results?