5
$\begingroup$

I'd like to make a world map with a blue coloured ocean and transparent land surface (to be used later as an overlay). With:

map = GeoGraphics[
  CountryData["World", {"SchematicPolygon", "Equirectangular"}], 
  GeoRange -> {{-90, 90}, {-180, 180}}, GeoBackground -> Transparent]

I get the opposite, i.e. ocean is transparent and land is coloured. How can this be reversed?

$\endgroup$
4
$\begingroup$

Something like this?

polygon = CountryData["World", "SchematicPolygon"];
image = ExampleData[{"TestImage", "Lena"}];
GeoGraphics[{GeoStyling[{"GeoImage", image}], polygon}, GeoBackground -> LightBlue, GeoRange -> "World", GeoProjection -> "Bonne"]

enter image description here

$\endgroup$
1
$\begingroup$

Better if both images have the same dimensions. Anyway.

p = CountryData["World", "Polygon"];
rose = Import["ExampleData/rose.gif"];
mask = Graphics[{EdgeForm[Black], p}];
blueOcean = ColorReplace[mask, White -> Blue];
ImageAdd[ImageMultiply[rose, ColorNegate@mask], blueOcean]

Mathematica graphics

$\endgroup$
  • $\begingroup$ Thanks! This works; however the resulting mask and final graphic is no longer a GeoGraphics object. I'd like to keep it that way because I'd like to subsequently also project the graphic using one of the projection transformations of Mathematica 10. $\endgroup$ – hippo3773 Apr 8 '15 at 20:37
  • $\begingroup$ Sorry, only version 9 here... $\endgroup$ – Dr. belisarius Apr 9 '15 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.