10
$\begingroup$

So far this is what i have:

   countries = EntityList[EntityClass["Country", "EuropeSovereign"]];
   GeoGraphics[countries, ImageSize -> 500, GeoBackground -> "ReliefMap"]

I want to be able to do these things:

  1. add country border line
  2. change the color scheme for "ReliefMap" - to a gray level scheme? is that possible?
  3. I have a list of lat/long data that I'd like to plot on the map and be able to label them with numbers. How can I do that?

Thanks for your help in advance.

$\endgroup$

1 Answer 1

12
$\begingroup$

The scheme of the Relief plot can be set using the ColorFunction option. The country border can be shown using Polygon and the location can be labeled using GeoMarker. Here is an example

countries = EntityList[EntityClass["Country", "EuropeSovereign"]];
loc = EntityValue[EntityValue[countries, "CapitalCity"], "Position"];

GeoGraphics[{EdgeForm[Red], Polygon /@ countries, 
  Table[GeoMarker[loc[[n]], Style[n, Green]], {n, 1, Length@loc}]}, 
 ImageSize -> 500, 
 GeoBackground -> GeoStyling["ReliefMap", ColorFunction -> GrayLevel]]

enter image description here

$\endgroup$
4
  • $\begingroup$ Thanks! this is great. I have a question though about formatting loc. Say i want to plot one location e.g. Paris lat: 48.864716;long: 2.349014. How should i define loc? $\endgroup$
    – user147813
    Commented Apr 17, 2016 at 17:30
  • $\begingroup$ @user147813 You can use GeoPosition[{48.864716,2.349014}] to do that. You may want to have a look at the documentation page of GeoPosition, it has many examples. $\endgroup$ Commented Apr 17, 2016 at 17:32
  • 1
    $\begingroup$ When asking for a property of a list of entities, it is faster to use a single EntityValue call, as in loc = EntityValue[countries, "CapitalCity"], rather than using Map. Note also that you do not need to get the "Position" of each city in advance in this particular case, because the Geo functions can obtain the position themselves (and will do it minimizing the number of EntityValue calls). $\endgroup$
    – jose
    Commented Apr 21, 2016 at 20:45
  • $\begingroup$ @jose Thanks! I have edited the post to reflect that. I didn't know EntityValue is listable. The "Position" is added in purpose, so that the GeoPosition structure would be clear for the OP to change to other lat and long values. $\endgroup$ Commented Apr 21, 2016 at 20:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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