Skip to content

Instantly share code, notes, and snippets.

import geoscript.layer.Shapefile
import geoscript.layer.io.CsvReader
import geoscript.style.*
import geoscript.render.Map
import geoscript.geom.Bounds
def dir = "/Users/jericks/Projects/NaturalEarth/SmallScale"
def ocean = new Shapefile("${dir}/110m_Physical/110m_ocean.shp")
ocean.style = new Fill("#66CCFF")
import geoscript.layer.*
import geoscript.geom.Bounds
import geoscript.proj.Projection
import javax.imageio.ImageIO
Projection proj = new Projection("EPSG:4326")
Bounds bounds = new Bounds(-180,-90,180,90, proj)
List imageSize = [1600, 800]
elif options.offsetcalc:
import exifread
from datetime import datetime
imgDate = datetime.strptime(args[0], "%Y-%m-%d %H:%M:%S")
f = open(args[1], 'rb')
tags = exifread.process_file(f)
f.close()
exifDateStr = tags['EXIF DateTimeDigitized'].values
exifDate = datetime.strptime(exifDateStr, "%Y:%m:%d %H:%M:%S")
diff = exifDate - imgDate
File file = new File("earth.tif")
GeoTIFF geotiff = new GeoTIFF(file)
Raster raster = geotiff.read("earth")
File arcGridFile = new File("earth.asc")
ArcGrid arcGrid = new ArcGrid(arcGridFile)
arcGrid.write(raster)
Raster arcGridRaster = arcGrid.read("earth")
arcGridRaster.eachCell {double value, double x, double y ->