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

Add Open Location Codes support to search box. #3047

Merged
merged 2 commits into from Jun 4, 2020
Merged

Add Open Location Codes support to search box. #3047

merged 2 commits into from Jun 4, 2020

Conversation

dracos
Copy link
Member

@dracos dracos commented May 29, 2020

No description provided.

@codecov
Copy link

codecov bot commented May 29, 2020

Codecov Report

Merging #3047 into master will decrease coverage by 22.93%.
The diff coverage is 6.25%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master    #3047       +/-   ##
===========================================
- Coverage   83.14%   60.21%   -22.94%     
===========================================
  Files         246      245        -1     
  Lines       15430    15426        -4     
  Branches     2879     2881        +2     
===========================================
- Hits        12830     9289     -3541     
- Misses       1689     5108     +3419     
- Partials      911     1029      +118     
Impacted Files Coverage Δ
perllib/FixMyStreet/App/Controller/Location.pm 39.62% <6.25%> (-42.60%) ⬇️
perllib/FixMyStreet/DB/Result/AdminLog.pm 8.16% <0.00%> (-87.76%) ⬇️
perllib/FixMyStreet/App/Controller/Admin/Roles.pm 16.36% <0.00%> (-81.82%) ⬇️
...ib/FixMyStreet/DB/Result/ModerationOriginalData.pm 10.38% <0.00%> (-81.82%) ⬇️
.../FixMyStreet/App/Controller/Admin/ManifestTheme.pm 18.18% <0.00%> (-81.82%) ⬇️
perllib/FixMyStreet/App/Controller/Auth/Profile.pm 16.94% <0.00%> (-81.36%) ⬇️
...erllib/FixMyStreet/App/Controller/Questionnaire.pm 11.45% <0.00%> (-80.92%) ⬇️
perllib/FixMyStreet/App/Controller/Admin/States.pm 13.72% <0.00%> (-78.44%) ⬇️
perllib/FixMyStreet/App/Controller/Auth/Phone.pm 14.58% <0.00%> (-77.09%) ⬇️
...ib/FixMyStreet/App/Controller/Admin/DefectTypes.pm 15.09% <0.00%> (-75.48%) ⬇️
... and 102 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1c8f7ef...abc63a8. Read the comment docs.

Copy link
Member

@chrismytton chrismytton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nifty! Didn't realise adding support for plus codes would be so straightforward 🙂

I tried testing this with a random plus code from Google Maps, but it seems to mostly show short plus codes which don't work with this? For Waverley it's XR26+Q2 Edinburgh. Would be nice if those worked as well. But I don't think that should block this from being merged!

image

image

@dracos
Copy link
Member Author

dracos commented Jun 4, 2020

Bit annoying they don't show you the full plus code as well (which for that one is 9C7RXR26+Q2).

To make it simpler to share, one can provide a plus code relative to another base and then only give the string for the base rather than its code. Then to reverse you geocode the string and take the nearest "XR26+Q2" to that. So in this case "Edinburgh" is "9C7RXR36+" and so you then get the full code from that. It means if geocoders give different results for the same string, you could conceivably get different results, so they recommend using smaller neighbourhoods that are less likely to be different (but presumably also less likely to be found at all?!). https://github.com/google/open-location-code/wiki/Guidance-for-shortening-codes has a bit more.

The library I've added does also handle shortening/expanding, apart from the actual geocoding part. When I have a mo, I'll look at adding that, I guess it'll have to call the external geocoder, take the first result and hope that it's right.

@dracos
Copy link
Member Author

dracos commented Jun 4, 2020

Actually having written that down, it seemed quite straightforward, so have done that now too, in a new commit :)

@dracos dracos requested a review from chrismytton June 4, 2020 12:58
Copy link
Member

@chrismytton chrismytton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧭

@dracos dracos merged commit abc63a8 into master Jun 4, 2020
@github-pages github-pages bot temporarily deployed to github-pages June 4, 2020 21:12 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants