#!/bin/sh
# Set common options
PROJECTION=A-20.0/-30.0/180/19.998266666666666c
REGION=-101.75576886232234/-51.72069985658921/20.062665960105004/15.049750517347888r
FILENAME=South_Atlantic_Ocean_laea_location_map.ps
# Get Natural Earth datafiles
echo "Downloading datafiles from naturalearthdata.com"
wget -nv -nc \
http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/110m-coastline.zip\
http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/110m-land.zip\
http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/cultural/110m-admin-0-boundary-lines.zip
echo "...done\n"
echo "Inflating archives"
unzip 110m\*.zip
echo "...done\n"
echo "Converting shapefiles to GMT"
ogr2ogr -F GMT 110m_land.gmt 110m_land.shp
ogr2ogr -F GMT 110m_coastline.gmt 110m_coastline.shp
ogr2ogr -F GMT 50m_borders.gmt ne_50m_admin_0_boundary_lines_land.shp
echo "...done\n"
echo "Creating maps"
GMT psxy -m -J$PROJECTION -R$REGION --PAGE_COLOR=198/236/255 --POLAR_CAP=none --PAPER_MEDIA=A3 --BASEMAP_TYPE=plain --BASEMAP_AXES=NESW --FRAME_PEN=0.15p,black 110m_land.gmt -K -G254/254/233 > $FILENAME
GMT psxy -m -J$PROJECTION -R$REGION 110m_coastline.gmt -O -K -W0.535p,9/120/171 >> $FILENAME
GMT psxy -m -J$PROJECTION -R$REGION 50m_borders.gmt -O -W100/100/100 >> $FILENAME
echo "...done\n"
echo "You can now open $FILENAME in Inkscape to clean up the file and save it as SVG. You should add an ocean coloured background and simplify the graticules using CTRL+L."
gv $FILENAME