For learning Python/GDAL I want to create a GeoTiff from the NOAA Aurora forecast data in Python3. I can already create an XYZ file:
import urllib.request, json
import shutil
import os
tempfile="aurora.tmp"
outfile="/out/aurora.xyz"
with urllib.request.urlopen("https://services.swpc.noaa.gov/json/ovation_aurora_latest.json") as url:
data = json.load(url)
f = open(tempfile, "w")
for coords in data['coordinates']:
line = "%d %d %d\n" % (coords[0]-180, coords[1], coords[2])
f.write(line)
f.close()
shutil.copyfile(tempfile, outfile)
if os.path.exists(tempfile):
os.remove(tempfile)
How would I go about writing an EPSG:4326 GeoTIFF (or any GDAL raster for that matter) from this data?