Essentials · Angular, React and OpenLayers
Zoom limits on a satellite map
Restrict OpenLayers camera zoom between minZoom and maxZoom over Esri World Imagery using an ArcGIS {z}/{y}/{x} image tile source and attributions.

What this example shows
Esri World Imagery opens over Kraków and the Vistula river bend at zoom 11 and restricts camera scale strictly to levels 9 through 13. Mouse-wheel scrolling, pinch gestures, keyboard shortcuts and zoom buttons all stop cleanly at the regional overview (zoom 9) and neighbourhood aerial view (zoom 13), with required provider credits shown in the corner.
When you need it
Satellite orthophotos, specialized thematic rasters and commercial tile feeds are frequently licensed, cached or visually meaningful only across a bounded range of map scales.
Blocking zoom-out past regional coverage saves tile quota on irrelevant territory, while capping zoom-in prevents missing-tile 404 errors or pixelated overscaling beyond native sensor resolution.
The code
The example uses cc-openlayers, my Angular component library for OpenLayers: each aol-… element creates the OpenLayers object it names, updates it from its inputs and disposes of it with the component.
zoom-constrained.tsimport { ChangeDetectionStrategy, Component } from '@angular/core';
import {
CoordinateComponent,
DefaultControlComponent,
DefaultInteractionComponent,
LayerTileComponent,
MapComponent,
SourceImageTileComponent,
ViewComponent,
} from 'cc-openlayers';
/** Esri's World Imagery over Kraków in a view that zooms only between levels 9 and 13. */
@Component({
selector: 'app-zoom-constrained',
imports: [
CoordinateComponent,
DefaultControlComponent,
DefaultInteractionComponent,
LayerTileComponent,
MapComponent,
SourceImageTileComponent,
ViewComponent,
],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<aol-map height="480px">
<aol-interaction-default />
<aol-control-defaults />
<aol-view [zoom]="11" [minZoom]="9" [maxZoom]="13">
<aol-coordinate [x]="19.9368" [y]="50.0614" srid="EPSG:4326" />
</aol-view>
<aol-layer-tile>
<aol-source-imagetile
url="https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"
attributions="Tiles © Esri — Source: Esri, Maxar, Earthstar Geographics, and the GIS User Community"
/>
</aol-layer-tile>
</aol-map>
`,
})
export class ZoomConstrained {} The React version uses the library's React adapter, cc-openlayers/react: each component creates the OpenLayers object it names when it mounts, updates it from its props and disposes of it when it unmounts.
zoom-constrained.react.tsximport {
Coordinate,
DefaultControls,
DefaultInteractions,
ImageTileSource,
Map,
TileLayer,
View,
} from 'cc-openlayers/react';
/** Esri's World Imagery over Kraków in a view that zooms only between levels 9 and 13. */
export function ZoomConstrained() {
return (
<Map height="480px">
<DefaultInteractions />
<DefaultControls />
<View zoom={11} minZoom={9} maxZoom={13}>
<Coordinate x={19.9368} y={50.0614} srid="EPSG:4326" />
</View>
<TileLayer>
<ImageTileSource
url="https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"
attributions="Tiles © Esri — Source: Esri, Maxar, Earthstar Geographics, and the GIS User Community"
/>
</TileLayer>
</Map>
);
}How the React version works
Esri World Imagery over Kraków in a view that allows only zoom 9 to 13 (start: 11).
What both versions share
OpenLayers renders the map and handles the interactions; the cc-openlayers/core layer gives both adapters the same view binding (MapViewBinding) and the same conversion of coordinates from EPSG:4326 to the map's projection. ol/source/ImageTile loads the tiles.
From Angular to React
| Angular | React |
|---|---|
[minZoom]="9" [maxZoom]="13" | minZoom={9} maxZoom={13} |
<aol-source-imagetile> | <ImageTileSource> |
Who creates, updates and disposes
Map creates the ol/Map in useLayoutEffect and disposes of it on unmount; each layer, source and interaction component adds its object to the parent it gets from context and removes it in its effect's cleanup, as ngOnDestroy does in Angular.
Architecture and OpenLayers mechanics
OpenLayers separates view scale constraints from layer visibility ranges. Declaring [minZoom]="9" and [maxZoom]="13" on the view clamps camera resolution across every gesture and control, whereas setting minZoom and maxZoom on a layer leaves the camera unconstrained and simply hides that layer outside the interval.
aol-source-imagetile connects directly to Esri’s REST cache using ArcGIS’s row-first URL template ({z}/{y}/{x}) alongside explicit attributions metadata.
How it works
[minZoom]="9"and[maxZoom]="13"on the view stop mouse wheel, pinch, keyboard and button zooming at the configured scale bounds.aol-source-imagetilerequests Esri World Imagery tiles using ArcGIS’s{z}/{y}/{x}template, where tile row{y}precedes column{x}.attributionssupplies mandatory Esri and imagery-partner credits to the default attribution control.- Starting the camera at zoom 11 places the initial viewport right in the middle of the allowed five-level range.
Pitfalls
- Swapping
{x}and{y}in an ArcGIS REST URL loads valid tiles from completely wrong locations on Earth without throwing network errors—always verify whether a service expects XYZ or ZYX order. - Setting
minZoomandmaxZoomon the layer instead of the view hides the imagery outside levels 9–13 rather than stopping the user from zooming further. - Programmatic fit() calls also obey view
maxZoomandminZoomceilings, so small geometries will stop at zoom 13.
Related examples
The same feature in the OpenLayers examples .
Background: state and lifecycle of maps in Angular with OpenLayers, which the components of cc-openlayers take care of.