{"action":"opened","number":164,"pull_request":{"url":"https://api.github.com/repos/komoot/photon/pulls/164","id":33941480,"html_url":"https://github.com/komoot/photon/pull/164","diff_url":"https://github.com/komoot/photon/pull/164.diff","patch_url":"https://github.com/komoot/photon/pull/164.patch","issue_url":"https://api.github.com/repos/komoot/photon/issues/164","number":164,"state":"open","locked":false,"title":"Added Reverse Geocoding API","user":{"login":"Svantulden","id":7554912,"avatar_url":"https://avatars.githubusercontent.com/u/7554912?v=3","gravatar_id":"","url":"https://api.github.com/users/Svantulden","html_url":"https://github.com/Svantulden","followers_url":"https://api.github.com/users/Svantulden/followers","following_url":"https://api.github.com/users/Svantulden/following{/other_user}","gists_url":"https://api.github.com/users/Svantulden/gists{/gist_id}","starred_url":"https://api.github.com/users/Svantulden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Svantulden/subscriptions","organizations_url":"https://api.github.com/users/Svantulden/orgs","repos_url":"https://api.github.com/users/Svantulden/repos","events_url":"https://api.github.com/users/Svantulden/events{/privacy}","received_events_url":"https://api.github.com/users/Svantulden/received_events","type":"User","site_admin":false},"body":"# Reverse Geocoding in Photon\r\n\r\nSo I finally had time to merge my old reverse geocode code for Photon with the newly refactored Photon. Sorry for the delay. This PR has basic reverse geocoding support, which lacks some features (described further on) and needs some heavy feedback, as this should be another prime feature of Photon. \r\n\r\n## Some info\r\n\r\nFirst some info about the way I implemented reverse geocoding into Photon. This code has the following features: \r\n\r\n- Give a coordinate and an optional language to Photon, and it returns the closest place in the Photon index. The data gets returned in the same trusted format as forward geocoding (a GeoJSON `FeatureCollection`). I kept this pretty simplistic. It returns an empty array when no result can be found. \r\n- The reverse geocode code has been written for the 'old' style and the new refactored style. The old way has a different API call format from the new way:\r\n  - Call `/api?reverse=true&lat=51.830866&lon=5.8388302&lang=nl` for a basic reverse query on the **old** way\r\n  - Call `/reverse?lat=51.830866&lon=5.8388302&lang=nl` for a basic reverse query on the **new** way\r\n- To switch between the new and the old way, uncomment/comment the corresponding handlers in `App.java`, just like it works in the current master\r\n- The **old** way works with a JSON query file (`query_reverse.json`) which is basically what @karussell made in #19 . The **new** way works with the ElasticSearch Java API, like the forward geocoding does. \r\n- The query is based on a limit of a `5km` radius that it searches around the given coordinate and returns the best (closest) result. \r\n- I've tried to adhere to the new code structure and style by using factories and kind of mirroring the forward geocoding code with specific changes for this functionality. Also need some feedback here, if this fits the refactored structure.\r\n\r\n## Production usage\r\n\r\nWe use this code in production a lot. So I can safely say that it is pretty stable. To give you an idea, we have on peak around 50 concurrent users on the geocoder (reverse and forward), with a small (5gb) index of The Netherlands, Belgium and Germany combined. This needs to be tested with a global dataset where performance/timings should be tested on also. \r\n\r\nI would appreciate it if someone other than me uses the global dataset to test this, because I am currently running out of storage on my small SSD to test it properly. \r\n\r\n## TO-DO/Missing features\r\n\r\n- [ ] The newly added `osm_tag` filtering is currently missing in this PR\r\n- [ ] Documentation on how to use the API\r\n- [ ] Decide if `5km` is a nice sweet-spot for the range Photon searches in, or optionally make it configurable\r\n- [ ] Unit tests for reverse geocoding are currently missing in this PR\r\n\r\nThanks in advance for reviewing this PR and like I said earlier, **all feedback is welcome**. ","created_at":"2015-04-23T10:15:41Z","updated_at":"2015-04-23T10:15:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7dae2a5c0b1e9d51915ef99352b0466f230c0555","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/komoot/photon/pulls/164/commits","review_comments_url":"https://api.github.com/repos/komoot/photon/pulls/164/comments","review_comment_url":"https://api.github.com/repos/komoot/photon/pulls/comments{/number}","comments_url":"https://api.github.com/repos/komoot/photon/issues/164/comments","statuses_url":"https://api.github.com/repos/komoot/photon/statuses/152d5e0339900782466d6f26c72069a2713485a0","head":{"label":"Svantulden:reverse_geocoding","ref":"reverse_geocoding","sha":"152d5e0339900782466d6f26c72069a2713485a0","user":{"login":"Svantulden","id":7554912,"avatar_url":"https://avatars.githubusercontent.com/u/7554912?v=3","gravatar_id":"","url":"https://api.github.com/users/Svantulden","html_url":"https://github.com/Svantulden","followers_url":"https://api.github.com/users/Svantulden/followers","following_url":"https://api.github.com/users/Svantulden/following{/other_user}","gists_url":"https://api.github.com/users/Svantulden/gists{/gist_id}","starred_url":"https://api.github.com/users/Svantulden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Svantulden/subscriptions","organizations_url":"https://api.github.com/users/Svantulden/orgs","repos_url":"https://api.github.com/users/Svantulden/repos","events_url":"https://api.github.com/users/Svantulden/events{/privacy}","received_events_url":"https://api.github.com/users/Svantulden/received_events","type":"User","site_admin":false},"repo":{"id":27482815,"name":"photon","full_name":"Svantulden/photon","owner":{"login":"Svantulden","id":7554912,"avatar_url":"https://avatars.githubusercontent.com/u/7554912?v=3","gravatar_id":"","url":"https://api.github.com/users/Svantulden","html_url":"https://github.com/Svantulden","followers_url":"https://api.github.com/users/Svantulden/followers","following_url":"https://api.github.com/users/Svantulden/following{/other_user}","gists_url":"https://api.github.com/users/Svantulden/gists{/gist_id}","starred_url":"https://api.github.com/users/Svantulden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Svantulden/subscriptions","organizations_url":"https://api.github.com/users/Svantulden/orgs","repos_url":"https://api.github.com/users/Svantulden/repos","events_url":"https://api.github.com/users/Svantulden/events{/privacy}","received_events_url":"https://api.github.com/users/Svantulden/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Svantulden/photon","description":"an open source geocoder for openstreetmap data","fork":true,"url":"https://api.github.com/repos/Svantulden/photon","forks_url":"https://api.github.com/repos/Svantulden/photon/forks","keys_url":"https://api.github.com/repos/Svantulden/photon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Svantulden/photon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Svantulden/photon/teams","hooks_url":"https://api.github.com/repos/Svantulden/photon/hooks","issue_events_url":"https://api.github.com/repos/Svantulden/photon/issues/events{/number}","events_url":"https://api.github.com/repos/Svantulden/photon/events","assignees_url":"https://api.github.com/repos/Svantulden/photon/assignees{/user}","branches_url":"https://api.github.com/repos/Svantulden/photon/branches{/branch}","tags_url":"https://api.github.com/repos/Svantulden/photon/tags","blobs_url":"https://api.github.com/repos/Svantulden/photon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Svantulden/photon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Svantulden/photon/git/refs{/sha}","trees_url":"https://api.github.com/repos/Svantulden/photon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Svantulden/photon/statuses/{sha}","languages_url":"https://api.github.com/repos/Svantulden/photon/languages","stargazers_url":"https://api.github.com/repos/Svantulden/photon/stargazers","contributors_url":"https://api.github.com/repos/Svantulden/photon/contributors","subscribers_url":"https://api.github.com/repos/Svantulden/photon/subscribers","subscription_url":"https://api.github.com/repos/Svantulden/photon/subscription","commits_url":"https://api.github.com/repos/Svantulden/photon/commits{/sha}","git_commits_url":"https://api.github.com/repos/Svantulden/photon/git/commits{/sha}","comments_url":"https://api.github.com/repos/Svantulden/photon/comments{/number}","issue_comment_url":"https://api.github.com/repos/Svantulden/photon/issues/comments{/number}","contents_url":"https://api.github.com/repos/Svantulden/photon/contents/{+path}","compare_url":"https://api.github.com/repos/Svantulden/photon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Svantulden/photon/merges","archive_url":"https://api.github.com/repos/Svantulden/photon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Svantulden/photon/downloads","issues_url":"https://api.github.com/repos/Svantulden/photon/issues{/number}","pulls_url":"https://api.github.com/repos/Svantulden/photon/pulls{/number}","milestones_url":"https://api.github.com/repos/Svantulden/photon/milestones{/number}","notifications_url":"https://api.github.com/repos/Svantulden/photon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Svantulden/photon/labels{/name}","releases_url":"https://api.github.com/repos/Svantulden/photon/releases{/id}","created_at":"2014-12-03T10:59:17Z","updated_at":"2015-04-13T13:15:38Z","pushed_at":"2015-04-23T09:25:35Z","git_url":"git://github.com/Svantulden/photon.git","ssh_url":"git@github.com:Svantulden/photon.git","clone_url":"https://github.com/Svantulden/photon.git","svn_url":"https://github.com/Svantulden/photon","homepage":"","size":4591,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"komoot:master","ref":"master","sha":"1abeb5231b713567317f2e66717f22c8db9bba85","user":{"login":"komoot","id":1555772,"avatar_url":"https://avatars.githubusercontent.com/u/1555772?v=3","gravatar_id":"","url":"https://api.github.com/users/komoot","html_url":"https://github.com/komoot","followers_url":"https://api.github.com/users/komoot/followers","following_url":"https://api.github.com/users/komoot/following{/other_user}","gists_url":"https://api.github.com/users/komoot/gists{/gist_id}","starred_url":"https://api.github.com/users/komoot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/komoot/subscriptions","organizations_url":"https://api.github.com/users/komoot/orgs","repos_url":"https://api.github.com/users/komoot/repos","events_url":"https://api.github.com/users/komoot/events{/privacy}","received_events_url":"https://api.github.com/users/komoot/received_events","type":"Organization","site_admin":false},"repo":{"id":12247534,"name":"photon","full_name":"komoot/photon","owner":{"login":"komoot","id":1555772,"avatar_url":"https://avatars.githubusercontent.com/u/1555772?v=3","gravatar_id":"","url":"https://api.github.com/users/komoot","html_url":"https://github.com/komoot","followers_url":"https://api.github.com/users/komoot/followers","following_url":"https://api.github.com/users/komoot/following{/other_user}","gists_url":"https://api.github.com/users/komoot/gists{/gist_id}","starred_url":"https://api.github.com/users/komoot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/komoot/subscriptions","organizations_url":"https://api.github.com/users/komoot/orgs","repos_url":"https://api.github.com/users/komoot/repos","events_url":"https://api.github.com/users/komoot/events{/privacy}","received_events_url":"https://api.github.com/users/komoot/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/komoot/photon","description":"an open source geocoder for openstreetmap data","fork":false,"url":"https://api.github.com/repos/komoot/photon","forks_url":"https://api.github.com/repos/komoot/photon/forks","keys_url":"https://api.github.com/repos/komoot/photon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/komoot/photon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/komoot/photon/teams","hooks_url":"https://api.github.com/repos/komoot/photon/hooks","issue_events_url":"https://api.github.com/repos/komoot/photon/issues/events{/number}","events_url":"https://api.github.com/repos/komoot/photon/events","assignees_url":"https://api.github.com/repos/komoot/photon/assignees{/user}","branches_url":"https://api.github.com/repos/komoot/photon/branches{/branch}","tags_url":"https://api.github.com/repos/komoot/photon/tags","blobs_url":"https://api.github.com/repos/komoot/photon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/komoot/photon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/komoot/photon/git/refs{/sha}","trees_url":"https://api.github.com/repos/komoot/photon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/komoot/photon/statuses/{sha}","languages_url":"https://api.github.com/repos/komoot/photon/languages","stargazers_url":"https://api.github.com/repos/komoot/photon/stargazers","contributors_url":"https://api.github.com/repos/komoot/photon/contributors","subscribers_url":"https://api.github.com/repos/komoot/photon/subscribers","subscription_url":"https://api.github.com/repos/komoot/photon/subscription","commits_url":"https://api.github.com/repos/komoot/photon/commits{/sha}","git_commits_url":"https://api.github.com/repos/komoot/photon/git/commits{/sha}","comments_url":"https://api.github.com/repos/komoot/photon/comments{/number}","issue_comment_url":"https://api.github.com/repos/komoot/photon/issues/comments{/number}","contents_url":"https://api.github.com/repos/komoot/photon/contents/{+path}","compare_url":"https://api.github.com/repos/komoot/photon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/komoot/photon/merges","archive_url":"https://api.github.com/repos/komoot/photon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/komoot/photon/downloads","issues_url":"https://api.github.com/repos/komoot/photon/issues{/number}","pulls_url":"https://api.github.com/repos/komoot/photon/pulls{/number}","milestones_url":"https://api.github.com/repos/komoot/photon/milestones{/number}","notifications_url":"https://api.github.com/repos/komoot/photon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/komoot/photon/labels{/name}","releases_url":"https://api.github.com/repos/komoot/photon/releases{/id}","created_at":"2013-08-20T16:06:16Z","updated_at":"2015-04-22T18:09:35Z","pushed_at":"2015-04-23T10:15:42Z","git_url":"git://github.com/komoot/photon.git","ssh_url":"git@github.com:komoot/photon.git","clone_url":"https://github.com/komoot/photon.git","svn_url":"https://github.com/komoot/photon","homepage":"","size":5902,"stargazers_count":208,"watchers_count":208,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":44,"mirror_url":null,"open_issues_count":33,"forks":44,"open_issues":33,"watchers":208,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/komoot/photon/pulls/164"},"html":{"href":"https://github.com/komoot/photon/pull/164"},"issue":{"href":"https://api.github.com/repos/komoot/photon/issues/164"},"comments":{"href":"https://api.github.com/repos/komoot/photon/issues/164/comments"},"review_comments":{"href":"https://api.github.com/repos/komoot/photon/pulls/164/comments"},"review_comment":{"href":"https://api.github.com/repos/komoot/photon/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/komoot/photon/pulls/164/commits"},"statuses":{"href":"https://api.github.com/repos/komoot/photon/statuses/152d5e0339900782466d6f26c72069a2713485a0"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":0,"review_comments":0,"commits":2,"additions":504,"deletions":51,"changed_files":21}}