Message Boards Message Boards

Delete the background of a map of administrative divisions

Hello. I am trying to build a map of Colombia, in which I attach a specific color. each of its departments (the main administrative division of the country) .

The following code seems to be working quite well:

colores = {Blue, Yellow, RGBColor[1, 0, 0], Yellow, Darker[Orange], 
   Yellow, White, Darker[Orange], Yellow, Darker[Orange], 
   Darker[Red], RGBColor[0.35, 0, 0.35], Darker[Red], Cyan, Blue, 
   Blue, Blue, RGBColor[0.35, 0, 0.35], RGBColor[0.35, 0, 0.35], 
   Darker[Red], Darker[Orange], White, White, Cyan, White, White, 
   White, Darker[Orange], Darker[Red], White, White, Blue, Blue} ;

departamentos = 
  Entity["Country", "Colombia"][
   EntityProperty["Country", "AdministrativeDivisions"]];
mapita=GeoGraphics[{EdgeForm[Black], FaceForm[colores[[1]]], 
  Polygon[departamentos[[1]]], FaceForm[colores[[2]]], 
  Polygon[departamentos[[2]]], FaceForm[colores[[3]]], 
  Polygon[departamentos[[3]]], FaceForm[colores[[4]]], 
  Polygon[departamentos[[4]]], FaceForm[colores[[5]]], 
  Polygon[departamentos[[5]]], FaceForm[colores[[6]]], 
  Polygon[departamentos[[6]]], FaceForm[colores[[7]]], 
  Polygon[departamentos[[7]]], FaceForm[colores[[8]]], 
  Polygon[departamentos[[8]]], FaceForm[colores[[9]]], 
  Polygon[departamentos[[9]]], FaceForm[colores[[10]]], 
  Polygon[departamentos[[10]]], FaceForm[colores[[11]]], 
  Polygon[departamentos[[11]]], FaceForm[colores[[12]]], 
  Polygon[departamentos[[12]]], FaceForm[colores[[13]]], 
  Polygon[departamentos[[13]]], FaceForm[colores[[14]]], 
  Polygon[departamentos[[14]]], FaceForm[colores[[15]]], 
  Polygon[departamentos[[15]]], FaceForm[colores[[16]]], 
  Polygon[departamentos[[16]]], FaceForm[colores[[17]]], 
  Polygon[departamentos[[17]]], FaceForm[colores[[18]]], 
  Polygon[departamentos[[18]]], FaceForm[colores[[19]]], 
  Polygon[departamentos[[19]]], FaceForm[colores[[20]]], 
  Polygon[departamentos[[20]]], FaceForm[colores[[21]]], 
  Polygon[departamentos[[21]]], FaceForm[colores[[22]]], 
  Polygon[departamentos[[22]]], FaceForm[colores[[23]]], 
  Polygon[departamentos[[23]]], FaceForm[colores[[24]]], 
  Polygon[departamentos[[24]]], FaceForm[colores[[25]]], 
  Polygon[departamentos[[25]]], FaceForm[colores[[26]]], 
  Polygon[departamentos[[26]]], FaceForm[colores[[27]]], 
  Polygon[departamentos[[27]]], FaceForm[colores[[28]]], 
  Polygon[departamentos[[28]]], FaceForm[colores [[29]]], 
  Polygon[departamentos[[29]]], FaceForm[colores[[30]]], 
  Polygon[departamentos[[30]]], FaceForm[colores[[31]]], 
  Polygon[departamentos[[31]]], FaceForm[colores[[32]]], 
  Polygon[departamentos[[32]]], FaceForm[colores[[33]]], 
  Polygon[departamentos[[33]]]}]

However, I have not managed to build a map without the background (which in this case is a nuisance). I have tried to plug in GeoBackground->None at different parts of the code, but without success. How can I dispose of the pesky background?

Any help appreciated.

Francisco

3 Replies

Many thanks Eric and Rohit, very useful!

Posted 2 years ago

A more compact way of generating the regions

regions = {Polygon[departamentos[[#]]], FaceForm[colores[[#]]]} & /@ 
    Range@Length@departamentos // Flatten;
mapita = 
 GeoGraphics[Prepend[regions, EdgeForm[Black]], GeoBackground -> None]

enter image description here

POSTED BY: Rohit Namjoshi
Posted 2 years ago

GeoBackground is an option for GeoGraphics. If you just put GeoBackground->None at the end of the expression inside GeoGraphics, it will remove the background.

GeoGraphics[{EdgeForm[Black], FaceForm[colores[[1]]], /* removed a bunch of elements for clarity */
  FaceForm[colores[[33]]], 
  Polygon[departamentos[[33]]]}, GeoBackground -> None]

You said that you tried GeoBackground->None at different parts, so I would have thought you would have tried it there. So maybe the result isn't what you want. If the result isn't what you want, then please provide more detail about what you do want.

POSTED BY: Eric Rimbey
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract