--- template: "example.html" title: "Advanced View Positioning example" shortdesc: "This example demonstrates how a map's view can be adjusted so a geometry or coordinate is positioned at a specific pixel location." docs: > This example demonstrates how a map's view can be adjusted so a geometry or coordinate is positioned at a specific pixel location. The map above has top, right, bottom, and left padding applied inside the viewport. The view's `fitGeometry` method is used to fit a geometry in the view with the same padding. The view's `centerOn` method is used to position a coordinate (Lausanne) at a specific pixel location (the center of the black box).

Use `Alt`+`Shift`+drag to rotate the map.

tags: "center, rotation, openstreetmap" ---
(best fit),
(respect resolution constraint).
(nearest),
(with min resolution),