---
layout: example.html
title: Advanced View Positioning
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 fit
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.