Vector data · Angular, React and OpenLayers
Feature properties from vector tiles
Inspect vector-tile RenderFeature attributes under the pointer as formatted JSON in OpenLayers over Esri World Basemap Mapbox Vector Tiles.

What this example shows
Esri’s World Basemap vector-tile pyramid renders around Kraków with OpenLayers’ default vector style—thin blue outlines over translucent white fills—making tile seams, label anchors and road centrelines clearly visible, while hovering over any geometry prints its full attribute dictionary as formatted JSON beneath the map.
When you need it
Before authoring flat style expressions or Mapbox GL rules for a new MVT service, cartographers and developers must discover exact source-layer names, road classification codes and label fields carried inside the binary tiles.
Hovering over raw vector tiles with an attribute inspector reveals the real schema at every zoom level instantaneously.
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.
vector-tile-info.tsimport { ChangeDetectionStrategy, Component, signal, viewChild } from '@angular/core';
import {
CoordinateComponent,
DefaultControlComponent,
DefaultInteractionComponent,
FormatMVTComponent,
LayerVectorTileComponent,
MapComponent,
SourceVectorTileComponent,
ViewComponent,
} from 'cc-openlayers';
import type MapBrowserEvent from 'ol/MapBrowserEvent';
/** A vector tile layer whose feature properties appear below the map while the pointer is over a feature. */
@Component({
selector: 'app-vector-tile-info',
imports: [
CoordinateComponent,
DefaultControlComponent,
DefaultInteractionComponent,
FormatMVTComponent,
LayerVectorTileComponent,
MapComponent,
SourceVectorTileComponent,
ViewComponent,
],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<aol-map height="480px" (pointerMove)="show($event)" (pointerleave)="info.set('')">
<aol-interaction-default />
<aol-control-defaults />
<aol-view [zoom]="9"><aol-coordinate [x]="19.9368" [y]="50.0614" srid="EPSG:4326" /></aol-view>
<aol-layer-vectortile>
<aol-source-vectortile
url="https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_v2/VectorTileServer/tile/{z}/{y}/{x}.pbf"
>
<aol-format-mvt />
</aol-source-vectortile>
</aol-layer-vectortile>
</aol-map>
<div class="example-controls">
<pre>{{ info() || 'Move the pointer over a feature.' }}</pre>
</div>
`,
})
export class VectorTileInfo {
readonly info = signal('');
private readonly map = viewChild.required(MapComponent);
/** The properties of the first feature under the pointer, or nothing while the map is dragged. */
protected show(event: MapBrowserEvent): void {
if (event.dragging) return;
const [feature] = this.map().instance.getFeaturesAtPixel(event.pixel);
this.info.set(feature ? JSON.stringify(feature.getProperties(), null, 2) : '');
}
} 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.
vector-tile-info.react.tsximport { useRef, useState } from 'react';
import type OLMap from 'ol/Map.js';
import type MapBrowserEvent from 'ol/MapBrowserEvent.js';
import {
Coordinate,
DefaultControls,
DefaultInteractions,
Map,
VectorTileLayer,
VectorTileSource,
View,
useMVTFormat,
} from 'cc-openlayers/react';
/** A vector tile layer whose feature properties appear below the map while the pointer is over a feature. */
export function VectorTileInfo() {
const [info, setInfo] = useState('');
const map = useRef<OLMap>(null);
const format = useMVTFormat();
/** The properties of the first feature under the pointer, or nothing while the map is dragged. */
const show = (event: MapBrowserEvent) => {
if (event.dragging) return;
const [feature] = map.current?.getFeaturesAtPixel(event.pixel) ?? [];
setInfo(feature ? JSON.stringify(feature.getProperties(), null, 2) : '');
};
// Angular listens for pointerleave on the map's host element; in React the map gets a wrapper for it.
return (
<>
<div onPointerLeave={() => setInfo('')}>
<Map ref={map} height="480px" onPointerMove={show}>
<DefaultInteractions />
<DefaultControls />
<View zoom={9}>
<Coordinate x={19.9368} y={50.0614} srid="EPSG:4326" />
</View>
<VectorTileLayer>
<VectorTileSource
url="https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_v2/VectorTileServer/tile/{z}/{y}/{x}.pbf"
format={format}
/>
</VectorTileLayer>
</Map>
</div>
<div className="example-controls">
<pre>{info || 'Move the pointer over a feature.'}</pre>
</div>
</>
);
}How the React version works
Below the map, the list of properties of the vector tile feature under the pointer.
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.
From Angular to React
| Angular | React |
|---|---|
<aol-source-vectortile> with <aol-format-mvt> | <VectorTileSource format> with a format from useMVTFormat |
(pointerleave) on the map host | onPointerLeave on a wrapping div |
(pointerMove) and viewChild of the map | onPointerMove (and onClick) on Map with useRef<OLMap>; the reading in useState |
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
Mounting aol-source-vectortile with aol-format-mvt decodes binary Mapbox Vector Tiles into lightweight OpenLayers render features painted in default blue when no custom style is attached.
As the pointer moves across the canvas, getFeaturesAtPixel retrieves intersecting features, reads the topmost feature’s dictionary via getProperties() (which includes the MVT layer name injected by the decoder), formats it with JSON.stringify, and clears the readout on (pointerleave).
How it works
aol-source-vectortilepaired withaol-format-mvtdecodes Esri World Basemap vector tiles in OpenLayers’ diagnostic default blue style.getFeaturesAtPixelresolves features beneath the cursor and prints the first hit’sgetProperties()dictionary viaJSON.stringify.- OpenLayers’ MVT decoder attaches a
layerproperty naming the originating MVT sub-layer (such as Road/label). (pointerleave)clears the JSON panel whenever the cursor exits the map viewport.
Pitfalls
- Default MVT features are lightweight read-only RenderFeature instances clipped along tile boundaries—meaning a single motorway or river exists as separate fragments across neighbouring tiles.
- Default unstyled vector tiles draw water polygons, road lines and label anchor points with that same pale fill and blue outline; pair the source with a dedicated style function or Mapbox style document for production cartography.
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.