Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement bounding box check for a coordinate #13

Open
brennanMKE opened this issue Oct 26, 2014 · 2 comments
Open

Implement bounding box check for a coordinate #13

brennanMKE opened this issue Oct 26, 2014 · 2 comments
Assignees

Comments

@brennanMKE
Copy link
Contributor

See the isInBoundingBox function in bustime.js for what needs to be implemented. The bounding box is created in the function just above it. Once they are done both will need to be tested. I wrote some code in JavaScript a while back which worked with Google Maps for bounding box but that code may not be on GitHub. I have to look for it.

Using the bounding box will cut down on using the haversine function which can be a bit processor intensive when there are more coordinates to process, especially for a city like Chicago. It appears to run very quickly for Milwaukee.

https://github.com/BusTicker/BusTickr-Server/pull/12/files#diff-ee81bfd40e82aba1581a82ad8aa983caR230

@tdhsmith

@brennanMKE
Copy link
Contributor Author

From @morganherlocker on Twitter:

@brennanMKE fastest would be an inline check if(lon>=bbox[0]&&lon<=bbox[2]&&lat>=bbox[1]&&lat<=bbox[3]){console.log('inside')}

https://twitter.com/morganherlocker/status/526477105832677377

@brennanMKE
Copy link
Contributor Author

From @morganherlocker on Twitter:

@brennanMKE for greater precision, use turf-inside, which is fast, and checks if a pt falls on any type of geometry https://t.co/MHf5kOu8ZD

https://twitter.com/morganherlocker/status/526477521781792768

@brennanMKE brennanMKE added the api label Oct 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants