I would like to build a GeoGraphics
map showing a z-elevated perspective (e.g. the view from a plane). Specifically, I'm looking to use multiple GeoMarker
's (with custom graphics) in the pseudo-3D perspective.
For example, consider this plot of the Eiffel Tower:
I would like to reproduce it in a 3D perspective like this:
Both examples come from google maps, I’m not sure if this is possible in 11.3, but would love to know.
Answer
You could use an orthographic with a custom centering:
GeoGraphics[
Entity["Building", "EiffelTower::5h9w8"],
GeoProjection -> {"Orthographic", "Centering" -> GeoPosition[{-30.858`, 2.295`}]},
GeoZoomLevel -> 18,
GeoRange -> {{48.852`, 48.872`}, {2.2895`, 2.2995`}}
]
Note that this does incorporate the curvature of the earth and will be noticeable over larger areas.
If you're after something flat, you could always inset the tiles in 3D and pick custom View*
values. Note I pad the range to allow the map to be seen at an angle:
im = GeoImage[
Entity["Building", "EiffelTower::5h9w8"],
"StreetMapNoLabels",
GeoZoomLevel -> 17,
GeoRange -> {{48.852`, 48.872`}, {2.285`, 2.305`}}
];
{x, y} = ImageDimensions[im];
Graphics3D[
{Texture[im], EdgeForm[], Polygon[{{0, 0, 0}, {x, 0, 0}, {x, y, 0}, {0, y, 0}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]},
Background -> Black,
Boxed -> False,
Lighting -> "Neutral",
ViewAngle -> 0.03233723833101999`,
ViewCenter -> {{0.5`, 0.5`, 0.5`}, {1.4456583184354543`, 0.7806170277104297`}},
ViewPoint -> {1.076788325190908`, -3.1635309749673284`, 0.5316001064285271`},
ViewVertical -> {0.00011882147473772082`, -0.00015290540260965785`, 0.9999999812506973`}
]
Here's a way to 'lift' a GeoGraphics
object into 3D. My solution is probably not robust but works for simple cases:
GeoGraphics3D[args__] := Block[{g2d, g3d, ε = .0001},
g2d = GeoGraphics[args][[1, 1]] /. {___, Opacity[0], ___} -> {};
g3d = g2d /. {
expr : _[VertexTextureCoordinates, _] :> expr,
Inset[g_, {x_, y_}, opos_, Offset[o_]] :> Inset[g, RotationTransform[\[CurlyEpsilon], {0, -1, 0}]@{x, y, 0}, opos, .5 o],
{x_Real, y_} :> RotationTransform[\[CurlyEpsilon], {0, -1, 0}][{x, y, 0}]
};
Graphics3D[
g3d,
Boxed -> False,
ImageSize -> Large,
Lighting -> {{"Ambient", White}}
]
]
Example:
eif = Entity["Building", "EiffelTower::5h9w8"];
Show[
GeoGraphics3D[
{GeoMarker[eif], Text[Style["Eiffel Tower", ColorData[112, 1], 14], eif, {0, 1}]},
GeoRange -> Quantity[1000, "Meters"],
GeoZoomLevel -> 17
],
ViewAngle -> 2°,
ViewPoint -> {1.75`, -2.85`, 0.55`}
]
Comments
Post a Comment