0

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?

2
  • 1
    Try converting your JSON to a GeoJSON, then reading it with GeoPandas and converting to GeoTIFF, as was described here: gis.stackexchange.com/questions/464242/…
    – Taras
    Commented Jul 29 at 8:06
  • alternatively look at GDAL to make the conversion either via the API or by a subprocess call
    – Ian Turton
    Commented Jul 29 at 9:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.