Sets the near and far clipping distances of the new camera.
These values only take effect when the map's automatic near/far adjustment is turned off (see Map.setAutoAdjustDepthRangeEnabled). With that adjustment on (the default), the map manages the near and far for you, so values set here apply only once you turn it off. A freshly built orthographic camera defaults to a near of -9000 and a far of 20000.
The near and far bound the depth range: the interval along the view direction, measured from the eye, that is kept. For an orthographic projection the view volume between them is a box (parallel, equally sized near and far planes), so unlike a perspective camera the near distance may be zero or negative, depth is linear, and the far to near ratio does not affect precision. The range only has to contain the geometry you want to keep visible, so bracketing your content with some margin is enough (for a top-down view, a range that is roughly symmetric around the plane you are looking at works well).
Practical note: the orthographic camera is currently only used for 2D (projected, grid) maps, where all content lies in the map plane (at z=0), so the exact near and far have little visible effect as long as the range contains that plane.
- Parameters
-
| nearPlane | the distance from the eye to the near clipping plane. |
| farPlane | the distance from the eye to the far clipping plane. |
- Returns
- this builder
- Since
- 2026.1