# Finding the center of the viewpoint in DynamicGeoGraphics

My goal here is to be able to display the coordinates of the center of a DynamicGeoGraphic which updates as the map is dragged (without right clicking on the map to get coordinates).

One method I came up with to do this was to read the GeoRange of the map, then take the average of the latitudes and longitudes in the GeoRange, but the GeoRange doesn't update dynamically as the map is dragged:

Column[
{map = DynamicGeoGraphics[GeoPosition[{40.097191, -88.245990}]],
Dynamic[Options[map, GeoRange]]}]


I've provided a specific GeoPosition here just for the sake of clarity. I have two questions:

1. Is there a better way to access information about the map directly than what I've done here?

2. Why won't the GeoRange change as the map is moved?

Any other ideas for how to accomplish this are also welcome.

Insert[
ToBoxes@DynamicGeoGraphics[],
Initialization :> (CreatePalette[
DynamicModule[{},
Panel@Column[{EvaluationCell[],
Dynamic[Column@{TypesetgeoRange$$, TypesetgeoZoom$$,
TypesetgeoProjection}]}], InheritScope -> True]]),
{1, 1, -1}
] // RawBoxes


• I think this is closest to what I was hoping to find, but I'm having trouble understanding what's actually going on with your code. I've not seen a context used in this way before. Could you expand a bit on why/how this works? – Texas Red Sep 12 '16 at 23:56
• @TexasRed I will later :) – Kuba Sep 13 '16 at 5:35

This is a comment.

The following gives dynamically the XYZ coordinates asked to the tiles server OpenStreetMap (not Wolfram Tile Server). It updates when you release the mouse button in the map.

A particularly interesting thing is that the option GeoServer of GeoGraphics works also with DynamicGeoGraphics.

Dynamic[{x, y, z}]
DynamicGeoGraphics[
Entity["City", {"Paris", "IleDeFrance", "France"}],
GeoServer ->
StringTemplate[
"http://a.tile.openstreetmap.org/<*z=#1*>/<*x=#2*>/<*y=#3*>.png"]]
`

Edit
This gives the coordinate of the last tile asked to the server, which is probably not the center of the map.
End Edit

• Very interesting. I was hoping to be able to update the value while the map was dragged, not just when it was released, but this is quite clever. I take it that the reason this works has more to do with OpenStreetMap than Mathematica? – Texas Red Sep 12 '16 at 23:58