Group Abstract Group Abstract

Message Boards Message Boards

Incorrect locator GeoPosition error in Manipulate[GeoGraphics[]]

Posted 5 months ago
POSTED BY: Yeonjoon Park
2 Replies
Posted 5 months ago

Thank you. It solved my problem.

POSTED BY: Yeonjoon Park

Hi, the problem here is the difference between geographic coordinates {lat, lon}, as taken by GeoPosition, and then the map projected coordinates {x, y}, as used by Graphics and the locator. We need to do this:

First construct the map of the region:

map = GeoGraphics[GeoRange -> {{48, 56}, {12, 27}}, GeoBackground -> "StreetMap", ImageSize -> Large];

See which projection it is using, in this case the "Mercator" projection:

In[2]:= proj = GeoProjection /. Options[map, GeoProjection]
Out[2]= "Mercator"

These are the geographic coordinates of Warsaw:

In[3]:= GeoPosition[Entity["City", {"Warsaw", "Mazowieckie", "Poland"}]]
Out[3]= GeoPosition[{52.232, 21.0067}]

and these are its projected coordinates in the "Mercator" projection:

In[4]:= warsaw = GeoGridPosition[%, proj]["GridXY"]
Out[4]= {21.0067, 61.4643}

Now we can construct the needed Manipulate:

Manipulate[Column[{"LocPos", GeoPosition[GeoGridPosition[LocPos, proj]], map}], {{LocPos, warsaw}, Locator}]

enter image description here

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard