{"action":"created","comment":{"url":"https://api.github.com/repos/azavea/cac-tripplanner/pulls/comments/23384176","id":23384176,"diff_hunk":"@@ -1,9 +1,74 @@\n+import json\n+\n+from django.views.generic import View\n+from django.http import HttpRequest, HttpResponse\n from django.shortcuts import render_to_response\n from django.template import RequestContext\n \n+from django.contrib.gis.geos import GEOSGeometry, MultiPolygon\n+from requests import get\n+\n+from destinations.models import Destination\n+\n def home(request):\n     print request.META['REMOTE_ADDR']\n     return render_to_response('home.html', context_instance=RequestContext(request))\n \n+\n def map(request):\n     return render_to_response('map.html', context_instance=RequestContext(request))\n+\n+\n+class Reachable(View):\n+    \"\"\"Class based view for finding destinations of interest within the calculated isochrone\"\"\"\n+    # TODO: make decisions on acceptable ranges of values that this endpoint will support\n+\n+    otp_router = 'default'\n+    otp_url = 'http://192.168.8.26:8080/otp/routers/{router}/isochrone'.format(router=otp_router)\n+    algorithm = 'accSampling'\n+\n+    def isochrone(self, lat, lng, mode, date, time, max_travel_time, max_walk_distance):\n+        \"\"\"Make request to Open Trip Planner for isochrone geometry - convert it to GDAL Polygon\"\"\"\n+        payload = {\n+            'routerId': self.otp_router,\n+            'fromPlace': lat + ',' + lng,\n+            'mode': (',').join(mode),\n+            'date': date,\n+            'time': time,\n+            'cutoffSec': max_travel_time,\n+            'maxWalkDistance': max_walk_distance,\n+            'algorithm': self.algorithm\n+        }\n+        isochrone_response = get(self.otp_url, params=payload)","path":"python/cac_tripplanner/cac_tripplanner/views.py","position":42,"original_position":42,"commit_id":"2f02ad52ed174b5ea91be860c230e2a1a63ac873","original_commit_id":"2f02ad52ed174b5ea91be860c230e2a1a63ac873","user":{"login":"ddohler","id":447977,"avatar_url":"https://avatars.githubusercontent.com/u/447977?v=3","gravatar_id":"","url":"https://api.github.com/users/ddohler","html_url":"https://github.com/ddohler","followers_url":"https://api.github.com/users/ddohler/followers","following_url":"https://api.github.com/users/ddohler/following{/other_user}","gists_url":"https://api.github.com/users/ddohler/gists{/gist_id}","starred_url":"https://api.github.com/users/ddohler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ddohler/subscriptions","organizations_url":"https://api.github.com/users/ddohler/orgs","repos_url":"https://api.github.com/users/ddohler/repos","events_url":"https://api.github.com/users/ddohler/events{/privacy}","received_events_url":"https://api.github.com/users/ddohler/received_events","type":"User","site_admin":false},"body":"It would be nice not to have this call to an outside service in the view although this is definitely simpler for the moment since I think the alternative is modifying OTP.","created_at":"2015-01-22T15:46:20Z","updated_at":"2015-01-22T15:46:20Z","html_url":"https://github.com/azavea/cac-tripplanner/pull/18#discussion_r23384176","pull_request_url":"https://api.github.com/repos/azavea/cac-tripplanner/pulls/18","_links":{"self":{"href":"https://api.github.com/repos/azavea/cac-tripplanner/pulls/comments/23384176"},"html":{"href":"https://github.com/azavea/cac-tripplanner/pull/18#discussion_r23384176"},"pull_request":{"href":"https://api.github.com/repos/azavea/cac-tripplanner/pulls/18"}}},"pull_request":{"url":"https://api.github.com/repos/azavea/cac-tripplanner/pulls/18","id":27846565,"html_url":"https://github.com/azavea/cac-tripplanner/pull/18","diff_url":"https://github.com/azavea/cac-tripplanner/pull/18.diff","patch_url":"https://github.com/azavea/cac-tripplanner/pull/18.patch","issue_url":"https://api.github.com/repos/azavea/cac-tripplanner/issues/18","number":18,"state":"open","locked":false,"title":"Calculate isochrone and find destinations within it","user":{"login":"moradology","id":1977405,"avatar_url":"https://avatars.githubusercontent.com/u/1977405?v=3","gravatar_id":"","url":"https://api.github.com/users/moradology","html_url":"https://github.com/moradology","followers_url":"https://api.github.com/users/moradology/followers","following_url":"https://api.github.com/users/moradology/following{/other_user}","gists_url":"https://api.github.com/users/moradology/gists{/gist_id}","starred_url":"https://api.github.com/users/moradology/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moradology/subscriptions","organizations_url":"https://api.github.com/users/moradology/orgs","repos_url":"https://api.github.com/users/moradology/repos","events_url":"https://api.github.com/users/moradology/events{/privacy}","received_events_url":"https://api.github.com/users/moradology/received_events","type":"User","site_admin":false},"body":"This PR includes code for isochrone calculation/filtering based on isochrone results and the front end component which will make the request.\r\n\r\nA potential weak spot is the JS component, which currently doesn't have robust safeguards against poorly formed requests.","created_at":"2015-01-22T14:38:07Z","updated_at":"2015-01-22T15:46:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"660b31e8be952c777373a4b6d5026e9bfcf27dfe","assignee":{"login":"sharph","id":539905,"avatar_url":"https://avatars.githubusercontent.com/u/539905?v=3","gravatar_id":"","url":"https://api.github.com/users/sharph","html_url":"https://github.com/sharph","followers_url":"https://api.github.com/users/sharph/followers","following_url":"https://api.github.com/users/sharph/following{/other_user}","gists_url":"https://api.github.com/users/sharph/gists{/gist_id}","starred_url":"https://api.github.com/users/sharph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharph/subscriptions","organizations_url":"https://api.github.com/users/sharph/orgs","repos_url":"https://api.github.com/users/sharph/repos","events_url":"https://api.github.com/users/sharph/events{/privacy}","received_events_url":"https://api.github.com/users/sharph/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/azavea/cac-tripplanner/pulls/18/commits","review_comments_url":"https://api.github.com/repos/azavea/cac-tripplanner/pulls/18/comments","review_comment_url":"https://api.github.com/repos/azavea/cac-tripplanner/pulls/comments/{number}","comments_url":"https://api.github.com/repos/azavea/cac-tripplanner/issues/18/comments","statuses_url":"https://api.github.com/repos/azavea/cac-tripplanner/statuses/2f02ad52ed174b5ea91be860c230e2a1a63ac873","head":{"label":"azavea:feature/isochrone","ref":"feature/isochrone","sha":"2f02ad52ed174b5ea91be860c230e2a1a63ac873","user":{"login":"azavea","id":595231,"avatar_url":"https://avatars.githubusercontent.com/u/595231?v=3","gravatar_id":"","url":"https://api.github.com/users/azavea","html_url":"https://github.com/azavea","followers_url":"https://api.github.com/users/azavea/followers","following_url":"https://api.github.com/users/azavea/following{/other_user}","gists_url":"https://api.github.com/users/azavea/gists{/gist_id}","starred_url":"https://api.github.com/users/azavea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azavea/subscriptions","organizations_url":"https://api.github.com/users/azavea/orgs","repos_url":"https://api.github.com/users/azavea/repos","events_url":"https://api.github.com/users/azavea/events{/privacy}","received_events_url":"https://api.github.com/users/azavea/received_events","type":"Organization","site_admin":false},"repo":{"id":27089530,"name":"cac-tripplanner","full_name":"azavea/cac-tripplanner","owner":{"login":"azavea","id":595231,"avatar_url":"https://avatars.githubusercontent.com/u/595231?v=3","gravatar_id":"","url":"https://api.github.com/users/azavea","html_url":"https://github.com/azavea","followers_url":"https://api.github.com/users/azavea/followers","following_url":"https://api.github.com/users/azavea/following{/other_user}","gists_url":"https://api.github.com/users/azavea/gists{/gist_id}","starred_url":"https://api.github.com/users/azavea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azavea/subscriptions","organizations_url":"https://api.github.com/users/azavea/orgs","repos_url":"https://api.github.com/users/azavea/repos","events_url":"https://api.github.com/users/azavea/events{/privacy}","received_events_url":"https://api.github.com/users/azavea/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/azavea/cac-tripplanner","description":"","fork":false,"url":"https://api.github.com/repos/azavea/cac-tripplanner","forks_url":"https://api.github.com/repos/azavea/cac-tripplanner/forks","keys_url":"https://api.github.com/repos/azavea/cac-tripplanner/keys{/key_id}","collaborators_url":"https://api.github.com/repos/azavea/cac-tripplanner/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/azavea/cac-tripplanner/teams","hooks_url":"https://api.github.com/repos/azavea/cac-tripplanner/hooks","issue_events_url":"https://api.github.com/repos/azavea/cac-tripplanner/issues/events{/number}","events_url":"https://api.github.com/repos/azavea/cac-tripplanner/events","assignees_url":"https://api.github.com/repos/azavea/cac-tripplanner/assignees{/user}","branches_url":"https://api.github.com/repos/azavea/cac-tripplanner/branches{/branch}","tags_url":"https://api.github.com/repos/azavea/cac-tripplanner/tags","blobs_url":"https://api.github.com/repos/azavea/cac-tripplanner/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/azavea/cac-tripplanner/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/azavea/cac-tripplanner/git/refs{/sha}","trees_url":"https://api.github.com/repos/azavea/cac-tripplanner/git/trees{/sha}","statuses_url":"https://api.github.com/repos/azavea/cac-tripplanner/statuses/{sha}","languages_url":"https://api.github.com/repos/azavea/cac-tripplanner/languages","stargazers_url":"https://api.github.com/repos/azavea/cac-tripplanner/stargazers","contributors_url":"https://api.github.com/repos/azavea/cac-tripplanner/contributors","subscribers_url":"https://api.github.com/repos/azavea/cac-tripplanner/subscribers","subscription_url":"https://api.github.com/repos/azavea/cac-tripplanner/subscription","commits_url":"https://api.github.com/repos/azavea/cac-tripplanner/commits{/sha}","git_commits_url":"https://api.github.com/repos/azavea/cac-tripplanner/git/commits{/sha}","comments_url":"https://api.github.com/repos/azavea/cac-tripplanner/comments{/number}","issue_comment_url":"https://api.github.com/repos/azavea/cac-tripplanner/issues/comments/{number}","contents_url":"https://api.github.com/repos/azavea/cac-tripplanner/contents/{+path}","compare_url":"https://api.github.com/repos/azavea/cac-tripplanner/compare/{base}...{head}","merges_url":"https://api.github.com/repos/azavea/cac-tripplanner/merges","archive_url":"https://api.github.com/repos/azavea/cac-tripplanner/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/azavea/cac-tripplanner/downloads","issues_url":"https://api.github.com/repos/azavea/cac-tripplanner/issues{/number}","pulls_url":"https://api.github.com/repos/azavea/cac-tripplanner/pulls{/number}","milestones_url":"https://api.github.com/repos/azavea/cac-tripplanner/milestones{/number}","notifications_url":"https://api.github.com/repos/azavea/cac-tripplanner/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/azavea/cac-tripplanner/labels{/name}","releases_url":"https://api.github.com/repos/azavea/cac-tripplanner/releases{/id}","created_at":"2014-11-24T18:46:16Z","updated_at":"2015-01-22T15:04:33Z","pushed_at":"2015-01-22T15:20:09Z","git_url":"git://github.com/azavea/cac-tripplanner.git","ssh_url":"git@github.com:azavea/cac-tripplanner.git","clone_url":"https://github.com/azavea/cac-tripplanner.git","svn_url":"https://github.com/azavea/cac-tripplanner","homepage":null,"size":749,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":4,"forks":1,"open_issues":4,"watchers":0,"default_branch":"develop"}},"base":{"label":"azavea:develop","ref":"develop","sha":"a1a22cbe9f040a443f8218285eb035bd0b8bb026","user":{"login":"azavea","id":595231,"avatar_url":"https://avatars.githubusercontent.com/u/595231?v=3","gravatar_id":"","url":"https://api.github.com/users/azavea","html_url":"https://github.com/azavea","followers_url":"https://api.github.com/users/azavea/followers","following_url":"https://api.github.com/users/azavea/following{/other_user}","gists_url":"https://api.github.com/users/azavea/gists{/gist_id}","starred_url":"https://api.github.com/users/azavea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azavea/subscriptions","organizations_url":"https://api.github.com/users/azavea/orgs","repos_url":"https://api.github.com/users/azavea/repos","events_url":"https://api.github.com/users/azavea/events{/privacy}","received_events_url":"https://api.github.com/users/azavea/received_events","type":"Organization","site_admin":false},"repo":{"id":27089530,"name":"cac-tripplanner","full_name":"azavea/cac-tripplanner","owner":{"login":"azavea","id":595231,"avatar_url":"https://avatars.githubusercontent.com/u/595231?v=3","gravatar_id":"","url":"https://api.github.com/users/azavea","html_url":"https://github.com/azavea","followers_url":"https://api.github.com/users/azavea/followers","following_url":"https://api.github.com/users/azavea/following{/other_user}","gists_url":"https://api.github.com/users/azavea/gists{/gist_id}","starred_url":"https://api.github.com/users/azavea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azavea/subscriptions","organizations_url":"https://api.github.com/users/azavea/orgs","repos_url":"https://api.github.com/users/azavea/repos","events_url":"https://api.github.com/users/azavea/events{/privacy}","received_events_url":"https://api.github.com/users/azavea/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/azavea/cac-tripplanner","description":"","fork":false,"url":"https://api.github.com/repos/azavea/cac-tripplanner","forks_url":"https://api.github.com/repos/azavea/cac-tripplanner/forks","keys_url":"https://api.github.com/repos/azavea/cac-tripplanner/keys{/key_id}","collaborators_url":"https://api.github.com/repos/azavea/cac-tripplanner/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/azavea/cac-tripplanner/teams","hooks_url":"https://api.github.com/repos/azavea/cac-tripplanner/hooks","issue_events_url":"https://api.github.com/repos/azavea/cac-tripplanner/issues/events{/number}","events_url":"https://api.github.com/repos/azavea/cac-tripplanner/events","assignees_url":"https://api.github.com/repos/azavea/cac-tripplanner/assignees{/user}","branches_url":"https://api.github.com/repos/azavea/cac-tripplanner/branches{/branch}","tags_url":"https://api.github.com/repos/azavea/cac-tripplanner/tags","blobs_url":"https://api.github.com/repos/azavea/cac-tripplanner/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/azavea/cac-tripplanner/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/azavea/cac-tripplanner/git/refs{/sha}","trees_url":"https://api.github.com/repos/azavea/cac-tripplanner/git/trees{/sha}","statuses_url":"https://api.github.com/repos/azavea/cac-tripplanner/statuses/{sha}","languages_url":"https://api.github.com/repos/azavea/cac-tripplanner/languages","stargazers_url":"https://api.github.com/repos/azavea/cac-tripplanner/stargazers","contributors_url":"https://api.github.com/repos/azavea/cac-tripplanner/contributors","subscribers_url":"https://api.github.com/repos/azavea/cac-tripplanner/subscribers","subscription_url":"https://api.github.com/repos/azavea/cac-tripplanner/subscription","commits_url":"https://api.github.com/repos/azavea/cac-tripplanner/commits{/sha}","git_commits_url":"https://api.github.com/repos/azavea/cac-tripplanner/git/commits{/sha}","comments_url":"https://api.github.com/repos/azavea/cac-tripplanner/comments{/number}","issue_comment_url":"https://api.github.com/repos/azavea/cac-tripplanner/issues/comments/{number}","contents_url":"https://api.github.com/repos/azavea/cac-tripplanner/contents/{+path}","compare_url":"https://api.github.com/repos/azavea/cac-tripplanner/compare/{base}...{head}","merges_url":"https://api.github.com/repos/azavea/cac-tripplanner/merges","archive_url":"https://api.github.com/repos/azavea/cac-tripplanner/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/azavea/cac-tripplanner/downloads","issues_url":"https://api.github.com/repos/azavea/cac-tripplanner/issues{/number}","pulls_url":"https://api.github.com/repos/azavea/cac-tripplanner/pulls{/number}","milestones_url":"https://api.github.com/repos/azavea/cac-tripplanner/milestones{/number}","notifications_url":"https://api.github.com/repos/azavea/cac-tripplanner/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/azavea/cac-tripplanner/labels{/name}","releases_url":"https://api.github.com/repos/azavea/cac-tripplanner/releases{/id}","created_at":"2014-11-24T18:46:16Z","updated_at":"2015-01-22T15:04:33Z","pushed_at":"2015-01-22T15:20:09Z","git_url":"git://github.com/azavea/cac-tripplanner.git","ssh_url":"git@github.com:azavea/cac-tripplanner.git","clone_url":"https://github.com/azavea/cac-tripplanner.git","svn_url":"https://github.com/azavea/cac-tripplanner","homepage":null,"size":749,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":4,"forks":1,"open_issues":4,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/azavea/cac-tripplanner/pulls/18"},"html":{"href":"https://github.com/azavea/cac-tripplanner/pull/18"},"issue":{"href":"https://api.github.com/repos/azavea/cac-tripplanner/issues/18"},"comments":{"href":"https://api.github.com/repos/azavea/cac-tripplanner/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/azavea/cac-tripplanner/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/azavea/cac-tripplanner/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/azavea/cac-tripplanner/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/azavea/cac-tripplanner/statuses/2f02ad52ed174b5ea91be860c230e2a1a63ac873"}}}}