{"id":15107757,"url":"https://github.com/simonfranz/smalltalk-geohash","last_synced_at":"2026-02-05T14:09:00.462Z","repository":{"id":145081118,"uuid":"144406397","full_name":"simonfranz/smalltalk-geohash","owner":"simonfranz","description":"Pharo package to decode/encode Geohashes to/from latitude and longitude (geolocation). See http://en.wikipedia.org/wiki/Geohash","archived":false,"fork":false,"pushed_at":"2019-03-19T18:18:14.000Z","size":157,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-10T23:10:31.437Z","etag":null,"topics":["geohash","geolocation","geolocation-bundle","gps","pharo","pharo-smalltalk","smalltalk"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simonfranz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-11T17:47:24.000Z","updated_at":"2019-03-19T18:12:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"aa7ad0ff-3d5d-43c4-a6fa-df95019125cf","html_url":"https://github.com/simonfranz/smalltalk-geohash","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/simonfranz/smalltalk-geohash","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonfranz%2Fsmalltalk-geohash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonfranz%2Fsmalltalk-geohash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonfranz%2Fsmalltalk-geohash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonfranz%2Fsmalltalk-geohash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonfranz","download_url":"https://codeload.github.com/simonfranz/smalltalk-geohash/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonfranz%2Fsmalltalk-geohash/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29123630,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T14:05:12.718Z","status":"ssl_error","status_checked_at":"2026-02-05T14:03:53.078Z","response_time":65,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geohash","geolocation","geolocation-bundle","gps","pharo","pharo-smalltalk","smalltalk"],"created_at":"2024-09-25T21:41:26.742Z","updated_at":"2026-02-05T14:09:00.441Z","avatar_url":"https://github.com/simonfranz.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# smalltalk-geohash\nPharo package to decode/encode Geohashes to/from latitude and longitude (geolocation). See http://en.wikipedia.org/wiki/Geohash\nGeohash can be used for a nerby search when working with thousands of locations.\n\n## Simple\nConvert a given geolocation (latitude, longitude) to a geohash. \n```\ntheGeolocation := SimGeolocation longitude: 7.853801 latitude: 48.013854.\ntheGeohash := theGeolocation asGeohash.\n```\n## Precision\nThe longer the hash is, the more precisely it describes a rectangle on a map. The precision can be selected just as easily.\nJust search for the distance you want to get the locations (in meter). Then you will receive a Geohash with the needed precision.\n```\ntheGeolocation := SimGeolocation longitude: 7.853801 latitude: 48.013854.\nthePrecisionDigits := SimGeohash precisionForMeter: 2000.\ntheGeohash := theGeolocation asGeohashWithPrecision: thePrecisionDigits.\n```\n## Neighbours\nGeohash is calculated on the base of ```0123456789bcdefghjkmnpqrstuvwxyz```. Because of the hashing algorithm not always e.g. Geohash \"9q8yd\" is not the neightbour of \"89q8yc\".\nThe geohash describes a rectangle where the given location is somewhere in between. So for the search of the nearby locations we need to get the neighbour hashes\n\n```\n(SimGeohash new: 'u0t94') neighbours.\n```\nAfter that you receive all the neighbour hashes\n\n```\nu0t93\tu0t96\tu0t97\nu0t91\tu0t94\tu0t95\nu0t8c\tu0t8f\tu0t8g\n```\n\n## Bounds\nTo receive the bounding coordinates of the current geohash you easyly can get those bound.\nYou will need to also receive the center of the bound, so you can easily get the center of the geohash. Indeed this will be performed if you decode a heohash to get a geolocation\n```\ntheGeobound := (SimGeohash new: 'u0t94') bound.\ntheGeolocation := theGeobound center\n(SimGeohash new: 'u0t94') asGeolocation = theGeolocation\n```\nThis will result into  ```48.01, 7.844```\n\n## Representations\nThe geohash is quite complex to understand, but each letter is the 5 bit result of a calculation. To get the binary representation you can get this representation.\n```(SimGeohash new: 'u0t94') asBinaryNumberString = '1101000000110010100100100'```\nIf you will do the math you can see that\n```11010 =\u003e u\n00000 =\u003e 0\n11001 =\u003e t\n01001 =\u003e 9\n00100 =\u003e 4\n```\n\n## Geohash-ranges\nIts useful to get all ranges between 2 geohases.  \n```\nSimGeohash  geohashesBetween: (SimGeohash new: 'u0t92')  and: (SimGeohash new: 'u0t94') \n=\u003e Results in Geohashes: u0t92, u0t93, u0t94\n```\n## Searchranges.\nTo find the nearest locations to a given geolocation, you first get the geohash for the specific location; afterwards all neighbour geohashes.\nBecause of the reason that nearby characters are not always the neighbour geohash in the worst case you have to do 9 queries against the database.\nThis can be improved by searching for ranges.\nInstead of having to make 9 requests, we can reduce the number of requests to normally 3-5 with searchranges.\nTO stay in the example of the neighbours on the neighbour-section\n```\ntheSearchRanges := (SimGeohash new: 'u0t94') searchRanges.\n(SimGeohash new: 'u0t94') searchRanges\nu0t8c -\u003e u0t8d\nu0t8f -\u003e u0t8h\nu0t91 -\u003e u0t98\n```\nYou will end up having some more geohashes in the resultSet, but therefore you have decreased the query-count by 66%.\nAfter that you have to calculate the distance between the given location and the locations in the resultset\n\n## Distance of two geolocations\nTo get the distance between two geolocation you can also use the geolocation in the package. Therefore the [Haversine formula](https://en.wikipedia.org/wiki/Haversine_formula) is used.\n```\ntheStartGeolocation := SimGeolocation fromString: '48.01473,7.8519233'.\ntheEndGeolocation := SimGeolocation fromString: '48.008112,7.8481903'.\ntheStartGeolocation distanceTo: theEndGeolocation \n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonfranz%2Fsmalltalk-geohash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonfranz%2Fsmalltalk-geohash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonfranz%2Fsmalltalk-geohash/lists"}