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

Configurable Default Coordinates for Location Bias #569

Closed
fpurcell opened this Issue May 4, 2017 · 1 comment

Comments

Projects
None yet
3 participants
@fpurcell

fpurcell commented May 4, 2017

We'd like to define a focus lat & lon in pelias.json, and have the Pelias API use that coordinate as the default value for sorting results (e.g., default values for focus.point.lat & focus.point.lon).

If a call to the Pelias API also sends the focus.point.lat=46.5&focus.point.lon=-122.6 URL parameters, then the Pelias API will override the default values for that request.

Even with the smaller regional dataset that the TriMet instance of Pelias will operate with, we still have ambiguous street addresses between towns ... and we want the results a customer sees to be sorted by towns closest to Portland (e.g., the value of our default focus coordinate):
https://search.mapzen.com/v1/autocomplete?text=710%20main%20st&focus.point.lat=46.5&focus.point.lon=-122.6&api_key=search-nHajqWA

@dianashk dianashk added this to the MOD Sandbox milestone May 4, 2017

@dianashk

This comment has been minimized.

Show comment
Hide comment
@dianashk

dianashk May 8, 2017

Contributor

This is probably best accomplished via a new middleware similar to our existing sizeCalculator in API.

You can add the new middleware component to the list in the router code after calcSize and pass peliasConfig.api down into the setup function.

The parameters of interest would be found in req.clean.focus.point.lat and req.clean.focus.point.lon.

When adding to pelias-config, the new values should go under the api object and perhaps be further grouped under another object, like api.defaultQueryParams.

Let us know if you need any help. Looking forward to the PR!

Contributor

dianashk commented May 8, 2017

This is probably best accomplished via a new middleware similar to our existing sizeCalculator in API.

You can add the new middleware component to the list in the router code after calcSize and pass peliasConfig.api down into the setup function.

The parameters of interest would be found in req.clean.focus.point.lat and req.clean.focus.point.lon.

When adding to pelias-config, the new values should go under the api object and perhaps be further grouped under another object, like api.defaultQueryParams.

Let us know if you need any help. Looking forward to the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment