10
$\begingroup$

I'm trying to build a real world map in Minecraft and want a pixel-perfect raster image I can copy pixel for block.

How can I modify

CountryData["World", {"Shape", "Robinson"}]

which gives

bad map

such that:

  • Each country is its own separate color (random colors are fine).
  • The water color is distinct from the background.
  • There are no black border lines (but the borders are still clear from the color difference in countries).
  • There is no anti-aliasing or color blending between regions of different colors, be they countries, water, or the background.
  • I can scale the map to the exact width (or height) in pixels I want.

Sorry if this is asking a bit much. Mathematica is completely new to me and I wasn't getting anywhere fumbling around with CountryData and GeoGraphics and WorldPlot for an hour.

$\endgroup$
  • $\begingroup$ What version are you on? $\endgroup$ – J. M. will be back soon Jul 22 '16 at 5:02
  • 1
    $\begingroup$ @J.M. The pilot release for Raspberry Pi (10.0.0.0). $\endgroup$ – Calvin's Hobbies Jul 22 '16 at 5:06
  • 2
    $\begingroup$ Would Graphics[Riffle[CountryData["World", {"SchematicPolygon", "Robinson"}] /. Polygon[{p__?MatrixQ}] :> Map[Polygon, {p}], Unevaluated[RandomColor[]], {1, -2, 2}], Background -> ColorData["Legacy", "Azure"]] suit your needs? $\endgroup$ – J. M. will be back soon Jul 22 '16 at 5:20
  • $\begingroup$ @J.M. That still appears to have the anti-aliased borders between countries. I can maybe deal with those in an image editor but I'd prefer not to. $\endgroup$ – Calvin's Hobbies Jul 22 '16 at 5:29
  • $\begingroup$ What if you use "FullPolygon" instead of "SchematicPolygon"? FWIW: these are all generating vector graphics, which you can easily resize before saving as an image file. $\endgroup$ – J. M. will be back soon Jul 22 '16 at 5:41
11
$\begingroup$

With GeoGraphics:

GeoGraphics[{GeoStyling@Opacity@1, RandomColor[], 
    CountryData[#, "SchematicPolygon"]} & /@ Join[CountryData["Continents"], CountryData[]], 
 GeoBackground -> Hue[0.56, .8, .8, .5], GeoRange -> "World", 
 GeoProjection -> "Robinson", Background -> White]

Mathematica graphics

$\endgroup$
  • $\begingroup$ Just what I wanted. (Any chance of adding antarctica?) $\endgroup$ – Calvin's Hobbies Jul 22 '16 at 6:59
  • 2
    $\begingroup$ Since Antarctica is not a country, it's not returned by CountryData[] (cf. this post). I've joined continents and countries to have everything - make sure you do not change the order as then continents would cover countries. $\endgroup$ – István Zachar Jul 22 '16 at 7:49
3
$\begingroup$

From its doc

Graphics[{Hue[
 2/3 Sqrt[
   1 - (CountryData[#, 
        "IndependenceYear"] /. {DateObject[{y_}] :> y, _Missing ->
          First[DateList[]]})/First[DateList[]]]], 
CountryData[#, "SchematicPolygon"]} & /@ CountryData[]]

which makes it plot countries color coded by the length of their claimed independence. You can plot by any other method.

$\endgroup$
  • $\begingroup$ This is almost just what I want :) but (unless I'm very mistaken), it's not a Robinson projection. How could I fix that? $\endgroup$ – Calvin's Hobbies Jul 22 '16 at 5:28

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.