Last active
July 19, 2020 20:31
-
-
Save markmarkoh/7d35df2e44153ef2edf6ed683a1a0b11 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 h3 | |
import csv | |
import json | |
with open('./thor_filtered.csv', newline='') as csvfile: | |
line = csv.reader(csvfile, delimiter=',') | |
lines = 0 | |
results = {} | |
for row in line: | |
lines += 1 | |
if (lines == 1): | |
continue | |
lat, lng = float(row[8]), float(row[9]) | |
hexval = h3.geo_to_h3(lat, lng, 7) | |
if hexval in results: | |
results[hexval] += 1 | |
else: | |
results[hexval] = 1 | |
hexarr = [] | |
for val in results: | |
# skip the 1 off in this dataset, looks to be air combat? | |
count = results[val] | |
if count == 1 or count > 7000: | |
continue | |
obj = {} | |
obj['hex'] = val | |
obj['count'] = count | |
hexarr.append(obj) | |
print(json.dumps(hexarr, indent=2)) | |
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
[ | |
{ | |
"hex": "87416e865ffffff", | |
"count": 862 | |
}, | |
{ | |
"hex": "87414880bffffff", | |
"count": 866 | |
}, | |
{ | |
...] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment