Last active
September 2, 2019 06:45
-
-
Save kristopolous/7f607acf218db8339b2910a48a5e3bf9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, math | |
width=14400 | |
height=10800 | |
image = [ [ 0 for y in range ( width ) ] for x in range( height ) ] | |
maxval = 7 | |
delta_lng = .9 | |
delta_lat = delta_lng * 28/40 | |
lng_low = -118.8 | |
lng_high = lng_low + delta_lng | |
lat_low = 33.70 | |
lat_high = lat_low + delta_lat | |
mult_lng = 360 / delta_lng * .999 | |
mult_lat = 180 / delta_lat * .999 | |
for line in sys.stdin: | |
lat,lng=line.split(',') | |
lat=float(lat) | |
lng=float(lng) | |
if(lng > lng_low and lng < lng_high and lat > lat_low and lat < lat_high): | |
x = round( (mult_lng * width/360.0) * (lng - lng_low) ) | |
y = round( (mult_lat * height/180.0) * (lat - lat_low) ) | |
if image[y][x] < maxval: | |
image[y][x] += 1 | |
print("P2") | |
print("{} {}".format(width, height)) | |
print(maxval) | |
for row in reversed(image): | |
print(" ".join([str(x) for x in row])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment