Files
openlayers/examples/hitdetect-vector.html
2022-01-07 12:45:27 -07:00

16 lines
732 B
HTML

---
layout: example.html
title: Vector Layer Hit Detection
shortdesc: Example of hit detection on an ecoregions vector layer with protection status.
docs: >
The ecoregions are loaded from a GeoJSON file. Information about features is
retrieved using the layer's `getFeatures()` method on hover and click. For
vector layers, this function resolves with an array of only the topmost
feature. It uses an efficient hit detection algorithm, at the cost of
accuracy. For pixel exact hit detection, when performance is not a concern,
use the map's `getFeaturesAtPixel()` or `forEachFeatureAtPixel()` methods.
tags: "vector, geojson, click, hover, hit detection"
---
<div id="map" class="map"></div>
<div id="info">&nbsp;</div>