Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #15701 > unrolled thread

Polygon projection in CountryData incorrect?

Started by"Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com>
First post2011-02-09 07:10 +0000
Last post2011-02-10 10:21 +0000
Articles 3 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Polygon projection in CountryData incorrect? "Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com> - 2011-02-09 07:10 +0000
    Re: Polygon projection in CountryData incorrect? "Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com> - 2011-02-11 09:17 +0000
    Re: Polygon projection in CountryData incorrect? Heike Gramberg <heike.gramberg@gmail.com> - 2011-02-10 10:21 +0000

#15701 — Polygon projection in CountryData incorrect?

From"Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com>
Date2011-02-09 07:10 +0000
SubjectPolygon projection in CountryData incorrect?
Message-ID<iitekr$jj7$1@smc.vnet.net>
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

[toc] | [next] | [standalone]


#15815

From"Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com>
Date2011-02-11 09:17 +0000
Message-ID<ij2uqh$7p8$1@smc.vnet.net>
In reply to#15701
Thanks Heike, this works great indeed.

I'm tempted to consider this a bug as you would expect the projections
to use the same defaults wherever in the system they're used.

Cheers -Sjoerd


On Feb 10, 11:21=C2 am, Heike Gramberg <heike.gramb...@gmail.com> wrote:
> 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], =E2=80=A8 =C2  CountryData["Net=
herlands",
> {"Polygon", "Mercator"}]}, Red, =E2=80=A8 =C2 PointSize[0.02],=E2=80=A8=
 =C2 
> Point@GeoGridPosition[=E2=80=A8 =C2  =C2  GeoPosition[=E2=80=A8 =C2=
  =C2  =C2 CityData[{"Amsterdam",
> "NoordHolland", "Netherlands"}, =E2=80=A8 =C2  =C2  =C2  "Coordinat=
es"]], {"Mercator",
> "Centering" -> 0, =E2=80=A8 =C2  =C2  =C2 "ReferenceModel" -> 360/2=
/Pi}][[1]]=E2=80=A8 =C2 }=E2=80=A8 ]
>
> Heike.
>
> On 2011-02-09 07:10:19 +0000, "Sjoerd C. de Vries"
> <sjoerd.c.devr...@gmail.com> said:
>
> > CountryData contains a polygon for every country. It can be output in
> > various projections using a specification like =C2 {"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[
> > =C2 {
> > =C2  {FaceForm[], EdgeForm[Black],
> > =C2  =C2 CountryData["Netherlands", {"Polygon", "Mercator"}]},
> > =C2  Red, PointSize[0.02],
> > =C2  Point@GeoGridPosition[
> > =C2  =C2  =C2 GeoPosition[
> > =C2  =C2  =C2  CityData[{"Amsterdam", "NoordHolland", "Netherland=
s"},
> > =C2  =C2  =C2  =C2 "Coordinates"]], "Mercator"][[1]]
> > =C2  }
> > =C2 ]
>
> > Graphics[
> > =C2 {
> > =C2  {FaceForm[], EdgeForm[Black],
> > =C2  =C2 Polygon[Map[GeoGridPosition[GeoPosition[#], "Mercator"][[1=
]] &,
> > =C2  =C2  =C2 CountryData["Netherlands", "Coordinates"], {2}]]},
> > =C2  Red, PointSize[0.02],
> > =C2  Point@GeoGridPosition[
> > =C2  =C2  =C2 GeoPosition[
> > =C2  =C2  =C2  CityData[{"Amsterdam", "NoordHolland", "Netherland=
s"},
> > =C2  =C2  =C2  =C2 "Coordinates"]], "Mercator"][[1]]
> > =C2  }
> > =C2 ]
>
> > Cheers -- Sjoerd
>
>

[toc] | [prev] | [next] | [standalone]


#15871

FromHeike Gramberg <heike.gramberg@gmail.com>
Date2011-02-10 10:21 +0000
Message-ID<ij0e75$9bm$1@smc.vnet.net>
In reply to#15701
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@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


[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web