Comment 3 for bug 1863252

Revision history for this message
Jason Etheridge (phasefx) wrote :

I've pushed a branch for this to collab/phasefx/geosort @ working/Evergreen.git

https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/collab/phasefx/geosort

You need to install the following perl modules (or run Makefile.install):
Geo::Coder::Free, Geo::Coder::Google, and Geo::Coder::OSM

With stock concerto, live_t/32-geosort.t does some basic tests.

To test by hand, you need to:
1) enable the opac.use_geolocation global flag under Administration -> Server Administration -> Global Flags
2) create a service under Administration -> Server Administration -> Geographic Location Service, with the Service Code set to OSM and the Active field checked. Naming the service OSM would make sense, and let it be owned by the top of the org tree.
3) under Administration -> Local Administration -> Library Settings, set the "Geographic Location Service to use for Addresses" setting to the service created in step 2, for the whole consortium.
4) In the same interface, set the "Enable Holdings Sort by Geographic Proximity" setting to True for the whole consortium.
5) Under Administration -> Server Administration -> Organizational Units, walk through the Addresses tab for each org unit, and click Get Coordinates for each one and then Save if the Latitude & Longitude fields get filled in. Unfortunately, the 3rd party OSM service works best with zip codes and not full addresses, so you may need to just make up some decimal values for Latitude & Longitude instead.
6) in the public OPAC (log out of the staff client first if using the same browser without private windows), pull up a record details page, such as the one for "Portrait of the artist Yehudi Menuhin". In the "Sort by distance from" textbox above the copies listing, enter a zip code and click Go or press enter. Depending on the latitude/longitude values for the org units, the copies should re-sort based on "as the crow flies" distances between the orgs and the entered address. Orgs without lat/long coordinates should fall to the end of the sorting. There's a library setting for changing the unit of measurement display from kilometers to miles.