Skip to content

Instantly share code, notes, and snippets.

@philshem
Created February 27, 2015 19:41
Show Gist options
  • Select an option

  • Save philshem/8fcff3b029c6d644885b to your computer and use it in GitHub Desktop.

Select an option

Save philshem/8fcff3b029c6d644885b to your computer and use it in GitHub Desktop.
Comparing Switzerland to an A4 document
from geopy.distance import great_circle
# how similar is switzerland to an A4?
# http://isithackday.com/geoplanet-explorer/index.php?woeid=23424957
topright = (47.808380, 10.492030)
topleft = (47.808380, 5.955870)
bottomleft = (45.818020, 5.955870)
bottomright = (45.818020, 10.492030)
top = great_circle(topleft, topright).kilometers
bottom = great_circle(bottomleft, bottomright).kilometers
print 'top =', top,'km'
print 'bottom =', bottom,'km'
left = great_circle(bottomleft, topleft).kilometers
right = great_circle(bottomright, topright).kilometers
print 'left =', left,'km'
print 'right =', right,'km'
average_width = top + bottom * 0.5
average_height = left + right * 0.5
#print average_width
#print average_height
print 'aspect ratio', '1:'+str(average_width/average_height)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment