Dec 26, 2007

Fun with image overlay

Here shows the example to creating new maps in Mathematica by using image overlay.
Download the earthmap image

(*import reference image*)

refimage=Import["earthmap.png"];
(*create the overlay for earthmap image*)
overlayimage = Rasterize[
Graphics[Translate[{EdgeForm[Black], FaceForm[],
CountryData["World", "FullPolygon"]}, {180, 90}],
PlotRange -> {{0, 360}, {0, 180}}], ImageSize -> 1024,
Background -> None]
(*show two images together*)
Show[refimage,overlayimage]




Several parameters are important here:
Translate[...,{180,90}]: the lower left corner of the reference image is always (0,0), the overlay image has to be moved to the same origin.
Background -> None: set overlay image with transparent background
ImageSize -> 1024: math the size of reference image

1 comment:

mdavidson said...

I'm glad I stumbled over this site and this particular example. I've been missing more examples of Mathematica used for geographic and GIS-type applications. This site is a good start even though Mathematica still has a long way to go before reaching the level of IDL or Matlab