Subscription
0
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning

## You're reading fromPython for Secret Agents

Product type Book
Published in Aug 2014
Publisher
ISBN-13 9781783980420
Pages 216 pages
Edition 1st Edition
Languages
Concepts
Author (1):
Steven F. Lott

Python for Secret Agents
Credits
www.PacktPub.com
Preface
1. Our Espionage Toolkit 2. Acquiring Intelligence Data 3. Encoding Secret Messages with Steganography 4. Drops, Hideouts, Meetups, and Lairs 5. A Spymaster's More Sensitive Analyses Index

## How close? What direction?

In order to calculate the distance between two points, we'll need to use some spherical geometry calculations. The problem we will have to overcome is that our charts and maps are flat. But the actual planet is very close to being spherical. While the spherical geometry may be a bit advanced, the programming is pretty simple. It will show us several features of the Python `math` library.

The distance between two latitude and longitude points on a sphere is defined as follows:

This formula determines the cosine between the two positions; the angle with that cosine is multiplied by the radius of the earth, R, to get the distance along the surface. We can use R = 3,440 NM, R = 3,959 mi, or R = 6,371 km; we get reasonably accurate distances in nautical miles, statute miles, or kilometers.

This formula doesn't work well with small distances. The haversine formula is preferred to compute distances more accurately. Here is some background information http://en.wikipedia.org...

The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime