Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Polygon projection in CountryData incorrect?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116295] Re: Polygon projection in CountryData incorrect?
  • From: Heike Gramberg <heike.gramberg at gmail.com>
  • Date: Thu, 10 Feb 2011 05:21:49 -0500 (EST)
  • References: <iitekr$jj7$1@smc.vnet.net>

I don't know if it qualifies as a bug, but it seems that the 
coordinates of the vertices of the polygon returned by CountryData[..., 
{"Polygon", "Mercator"}] are in degrees where the point (0,0) 
corresponds to the actual point (lat,lon)=(0,0) whereas the coordinates 
returned by GeoGridPosition[...,"Mercator"] are in radians such that 
the point (0,0) corresponds to the actual point (lat, lon)=(0,-180 
degrees).

I guess one way to match the two coordinate systems is to adjust the 
"Centering" and the "ReferenceModel" properties of the "Mercator" 
projection used in GeoGridPosition, i.e. to use something like this:

Graphics[{{FaceForm[], EdgeForm[Black], â?¨   CountryData["Netherlands", 
{"Polygon", "Mercator"}]}, Red, â?¨  PointSize[0.02],â?¨  
Point@GeoGridPosition[â?¨     GeoPosition[â?¨      CityData[{"Amsterdam", 
"NoordHolland", "Netherlands"}, â?¨       "Coordinates"]], {"Mercator", 
"Centering" -> 0, â?¨      "ReferenceModel" -> 360/2/Pi}][[1]]â?¨  }â?¨ ]â?¨

Heike.

On 2011-02-09 07:10:19 +0000, "Sjoerd C. de Vries" 
<sjoerd.c.devries at gmail.com> said:

> CountryData contains a polygon for every country. It can be output in
> various projections using a specification like  {"Polygon",
> "Mercator"}.
> 
> However, the resulting polygon doesn't seem to be consistent with a
> transformation using GeoGridPosition and GeoPosition.
> 
> If I plot Amsterdam using its CityData coordinates transformed with a
> Mercator projection it falls outside the Netherland's borders (1st
> example below). When I use the alternative approach (2nd example)
> everything seems OK. Am I doing something wrong or is this a bug?
> 
> 
> Graphics[
>  {
>   {FaceForm[], EdgeForm[Black],
>    CountryData["Netherlands", {"Polygon", "Mercator"}]},
>   Red, PointSize[0.02],
>   Point@GeoGridPosition[
>      GeoPosition[
>       CityData[{"Amsterdam", "NoordHolland", "Netherlands"},
>        "Coordinates"]], "Mercator"][[1]]
>   }
>  ]
> 
> 
> Graphics[
>  {
>   {FaceForm[], EdgeForm[Black],
>    Polygon[Map[GeoGridPosition[GeoPosition[#], "Mercator"][[1]] &,
>      CountryData["Netherlands", "Coordinates"], {2}]]},
>   Red, PointSize[0.02],
>   Point@GeoGridPosition[
>      GeoPosition[
>       CityData[{"Amsterdam", "NoordHolland", "Netherlands"},
>        "Coordinates"]], "Mercator"][[1]]
>   }
>  ]
> 
> Cheers -- Sjoerd




  • Prev by Date: Re: Using Mathematica for text mining
  • Next by Date: NDSolve and NumericQ
  • Previous by thread: Polygon projection in CountryData incorrect?
  • Next by thread: Re: Polygon projection in CountryData incorrect?