Message Boards Message Boards


Changing from Lat-Long to a Geometric Projection

Posted 9 years ago
2 Replies
1 Total Likes
I was playing with CountryData, and wanted to chart distance lines between my home and major European cities on a map.

I used the "Polygon" property of CountryData[] to get the country outlines of European countries, CityData[] to get lat-long of the cities I wanted, and Line[] to produce the lines. Finally, Graphics[] plotted all my output.

But given I live at latitude N45, the maps looked distorted, because they were simple lat-long projections onto a flat surface, I decided to explore some of the geographic projection options. CountryData["France", {"Polygon", "LambertConic"}], for example, does the job for the map of France, and worked well for all the rest of my target countries.

But I have been unable to figure out how to convert straightforward lat-long to the same projection, so I can place cities and my home. Combinations of GeoGridPosition and GeoPosition seemed promising, but they never hit my target projection correctly.

Also, the list of available projections in CountryData[] is not an exact mapping to those available in GeoProjectionData[]. For example, the latter contains options like...

"LambertConformalConic",  "LambertConformalConicNGS"

...whereas the former contains just...


Close, but no cigar.

Can anyone show me how to perform this transformation, both to and from?

Thanks in advance.

POSTED BY: Brad Varey
2 Replies
Posted 9 years ago
Dear Christopher,

Thanks very much, it certainly looks like that will do the trick!

POSTED BY: Brad Varey
CityData and CountryData property "Coordinates" gives results in lat-long, but the "Coordinates" property does not have have any built-in projection syntax. GeoGridPosition converts lat-long coordinates into {longitude, latitude} needed for display with Graphics primitives. The projection {"LambertConformalConic", {0, 0}} is very similar to "LambertConic" in CountryData.
 With[{co = "France"}, Graphics[{Polygon[
     Map[ GeoGridPosition[ GeoPosition[#], {"LambertConformalConic", {0, 0}}][[1]] & ,
      CountryData[co, "Coordinates"],
    {Yellow, Point@First@GeoGridPosition[
       GeoPosition[CountryData[co, "CenterCoordinates"]],
                        {"LambertConformalConic", {0, 0}}]},
    {Red, Point@First@GeoGridPosition[
       GeoPosition[CityData[CountryData[co, "CapitalCity"], "Coordinates"]],
                       {"LambertConformalConic", {0, 0}}]}},
  Frame -> True]]
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract