Using GeoScript to create a Geologic Map of Mars
I recently finished reading Kim Stanley Robinson’s Mars Triology. There are a lot of great maps in those three books and it inspired me to look around and see if I could find GIS data for Mars. I found the https://astrogeology.usgs.gov web site which has awesome surficial geology maps and data of the red planet.
The data download comes with shapefiles and a text file of geologic units and their colors. So I created a GeoScript Groovy script to download the data and create a geologic map of Mars.
First, we need to import a few classes and download the data. GeoScript has a few static methods on that we will use to download and unzip the data.
import geoscript.layer.Layer
import geoscript.layer.Shapefile
import geoscript.render.Map
import geoscript.style.io.UniqueValuesReader
import static geoscript.GeoScript.download
import static geoscript.GeoScript.unzip
File dir = new File("mars")
dir.mkdir()
unzip(
download(
new URL("https://astropedia.astrogeology.usgs.gov/download/Mars/Geology/Mars15MGeologicGISRenovation.zip"),
new File(dir, "mars.zip"),
overwrite: false
)
)
Next we can read the Shapefile of geologic units into a Layer.
Layer layer = new Shapefile("mars/I1802ABC_Mars_global_geology/Shapefiles/I1802ABC_Mars2000_Sphere/geo_units_oc_dd.shp")
The I1802ABC_geo_units_RGBlut.txt file has geologic units and RGB color values. It looks like this:
Unit,R,G,B
AHa,175,0,111
AHat,192,54,22
AHcf,150,70,72
AHh,109,13,60
AHpe,232,226,82
AHt,99,0,95
AHt3,233,94,94
GeoScript’s UniqueValuesReader can read this file and create the correct style.
UniqueValuesReader styleReader = new UniqueValuesReader("UnitSymbol", "polygon")
layer.style = styleReader.read(new File("mars/I1802ABC_Mars_global_geology/I1802ABC_geo_units_RGBlut.txt"))
Finally, we can use the Map class to create a PNG file.
Map map = new Map(layers: [layer], width: 1000, height: 500)
map.render(new File("mars_geology.png"))