Message Boards Message Boards

using latitude and longitude in CountryData

Posted 12 years ago
I am working on a simple demographic report with plots on the world map. I am trying to move the map using the latitude and longitude, but I can't make the latitude shift to work. Below is a code that generates maps with different coordinates, but notice it only moves horizontally, not vertically.

Am I using the arguments correctly? If so, what could be a workaround for this? I am plotting some data on the map with tooltips, so I want to know if there are ways without exporting the map to an image.

Table[Panel@Graphics[
CountryData[#, {"SchematicPolygon", {"Equirectangular", {lat, lon}}}] & /@ CountryData[]],
{lat, {-60, 0, 60}}, {lon, {-120, 0, 120}}
] // Grid
POSTED BY: Jeremy Lee
3 Replies
"Equirectangular" projection only moves the map along longitude direction. It is the same with "CylindricalEquidistant" and "Sinusoidal". For an example of a projection that centers, try "Albers":
Graphics[CountryData[#, {"SchematicPolygon", {"Albers", CountryData["Greenland", "CenterCoordinates"]}}]&/@
CountryData[], Frame -> True, Axes -> True]

Using this list of projections,
{"Albers", "Bonne", "CylindricalEqualArea", "CylindricalEquidistant", "EckertIV", "EckertVI", "Equirectangular",
"LambertAzimuthal", "LambertConic", "LambertCylindrical", "Mercator", "MillerCylindrical", "Mollweide", "Orthographic",
"Polyconic", "Robinson", "Sinusoidal", "Stereographic", "VanDerGrinten", "WinkelTripel"}
you can explore them to find one that does something reasonable.
 Manipulate[Graphics[
 CountryData[#, {"SchematicPolygon", {proj,CountryData[country, "CenterCoordinates"]}}] & /@ CountryData[],
 Frame -> True, Axes -> True],
 {proj, {"Albers", "Bonne", "CylindricalEqualArea",
 "CylindricalEquidistant", "EckertIV", "EckertVI",
 "Equirectangular", "LambertAzimuthal", "LambertConic",
 "LambertCylindrical", "Mercator", "MillerCylindrical", "Mollweide",
 "Orthographic", "Polyconic", "Robinson", "Sinusoidal",
 "Stereographic", "VanDerGrinten", "WinkelTripel"}},
{country, CountryData[]}]

Tooltips with data plots can be included in your graphics. Keep in mind, if you choose a projection that is something other than the default {"Equirectangular", {0,0}} then all of your decorations will also have to use the same projection. The alignment will be much simpler, sticking with one basic map rather than using unusual projections.

Also, keep in mind the map coordinates convention {lat, long} gets reversed when used as coordinates for graphics. For example the center of Greenland will be located at
Reverse@CountryData["Greenland", "CenterCoordinates"]
in order to get it over top of the Polygon for Greenland.
Posted 12 years ago
Thank you so much Chistopher! emoticon Now I understand why it did not work.

The code without the default projection and as you mentioned, it did not align except when centered in the target location. ("USA" in the following example)
I tried the following code, but it was not how I should be doing.
Disk[Reverse[CountryData["USA", {"CenterCoordinates","Albers"}] - {lat, lon}], 1]
POSTED BY: Jeremy Lee
Yes, the centering argument of a projection can take the option Center. That uses the center coordinates of the country
Graphics@CountryData["Greenland", {"Polygon", {"Albers", Center}}]

where the projection is an argument of one of the cartographic type display properties.
Select[CountryData["Properties"], ! StringFreeQ[#, {"Polygon", "Shape"}] &]
{"FullPolygon", "Polygon", "SchematicPolygon", "Shape"}

Projections, unfortunately, are not a possible argument of "CenterCoordinates" or other map coordinate related properties
Select[CountryData["Properties"], ! StringFreeQ[#, {"Coordinates"}] &]
{"CenterCoordinates", "Coordinates", "FullCoordinates", "SchematicCoordinates"}
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