Skip to Main Content
Python for Secret Agents
book

Python for Secret Agents

by Steven F. Lott
August 2014
Beginner to intermediate content levelBeginner to intermediate
216 pages
5h 13m
English
Packt Publishing
Content preview from Python for Secret Agents

Decoding a GeoRef code

When we decode a GeoRef code, we have to separate the two parts: the four characters at the beginning and the numeric details at the end. Once we've split off the first four characters, we can divide the number of remaining characters in half. One half of the digits will be longitude and the rest will be latitude.

The first four characters must be looked up in our special GeoRef alphabet. We'll find each character's position in the ABCDEFGHJKLMNPQRSTUVWXYZ string to get a numeric value. An expression such as georef_uppercase.find('Q') gives us 14: the position of Q in that alphabet. We can then multiply one position by 15° and add the other position number to translate two characters to the degrees portion of GeoRef.

The remaining ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python for Secret Agents - Volume II - Second Edition

Python for Secret Agents - Volume II - Second Edition

Steven F. Lott

Publisher Resources

ISBN: 9781783980420Supplemental Content