{"id":22,"date":"2022-01-28T01:33:08","date_gmt":"2022-01-28T01:33:08","guid":{"rendered":"https:\/\/blogs.oregonstate.edu\/yensh\/?p=22"},"modified":"2022-01-28T01:37:53","modified_gmt":"2022-01-28T01:37:53","slug":"blog-4-geohashing","status":"publish","type":"post","link":"https:\/\/blogs.oregonstate.edu\/yensh\/2022\/01\/28\/blog-4-geohashing\/","title":{"rendered":"Blog #4: Geohashing"},"content":{"rendered":"\n<p>In our project, we are trying to store the location of each farm in a database, and when a worker searches for farms in a certain location, we need to query the table and return farms near that area.<\/p>\n\n\n\n<p>While trying to find out how to do this, we found the concept of &#8216;Geohashing&#8217;. This essentially splits the earth into a bunch of labelled squares. Each of these squares are split into smaller and smaller squares, adding an extra character to the hash code during each layer. <\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.movable-type.co.uk\/scripts\/geohash.jpg\" alt=\"https:\/\/www.movable-type.co.uk\/scripts\/geohash.jpg\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>All the squares in the g block start with g. If you were to zoom in on g5, it would also be split into squares, 3 characters long, that all start with g5. Let&#8217;s say one of these 3 character squares is g5p, for example. g5p would be split into squares 4 characters long that all start with g5p, and so on. The longer the string, the more precise the location.<\/p>\n\n\n\n<p>So for our project, we can pinpoint the location of the farm with a longer geohash (say 8 characters long) and store that value in the table. A user looking for work could search using a vague location term like a zip code, and we would convert that into a geohash that&#8217;s 5 characters long . We could then query the table for any farms who have a geohash whose first 5 characters match the user search geohash.<\/p>\n\n\n\n<p>I thought this was a pretty cool way to search for specific locations in a certain area!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In our project, we are trying to store the location of each farm in a database, and when a worker searches for farms in a certain location, we need to query the table and return farms near that area. While trying to find out how to do this, we found the concept of &#8216;Geohashing&#8217;. This &hellip; <a href=\"https:\/\/blogs.oregonstate.edu\/yensh\/2022\/01\/28\/blog-4-geohashing\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Blog #4: Geohashing&#8221;<\/span><\/a><\/p>\n","protected":false},"author":11938,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-22","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.oregonstate.edu\/yensh\/wp-json\/wp\/v2\/posts\/22","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.oregonstate.edu\/yensh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.oregonstate.edu\/yensh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/yensh\/wp-json\/wp\/v2\/users\/11938"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/yensh\/wp-json\/wp\/v2\/comments?post=22"}],"version-history":[{"count":5,"href":"https:\/\/blogs.oregonstate.edu\/yensh\/wp-json\/wp\/v2\/posts\/22\/revisions"}],"predecessor-version":[{"id":28,"href":"https:\/\/blogs.oregonstate.edu\/yensh\/wp-json\/wp\/v2\/posts\/22\/revisions\/28"}],"wp:attachment":[{"href":"https:\/\/blogs.oregonstate.edu\/yensh\/wp-json\/wp\/v2\/media?parent=22"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/yensh\/wp-json\/wp\/v2\/categories?post=22"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/yensh\/wp-json\/wp\/v2\/tags?post=22"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}