When calculating the midpoint, get the longitudinal midpoint closest to the points, not closest to 0 degres
Put the search query in the url, and only have highlights in the url if a corresponding search query exists.

Update the state of the search box to match the url when it changes
remove the search query when hiding the search
Persist the text in the search box when hiding the search results