Module: ol/featureloader

ol/featureloader


import * as olFeatureloader from 'ol/featureloader';

Functions

setWithCredentials(xhrWithCredentials)

import {setWithCredentials} from 'ol/featureloader';

Setter for the withCredentials configuration for the XHR.

Name Type Description
xhrWithCredentials boolean

The value of withCredentials to set. Compare https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/

xhr(url, format){FeatureLoader<FeatureType>}

import {xhr} from 'ol/featureloader';

Create an XHR feature loader for a url and format. The feature loader loads features (with XHR), parses the features, and adds them to the vector source.

Name Type Description
url string | FeatureUrlFunction

Feature URL service.

format FeatureFormat<FeatureType>

Feature format.

Returns:
The feature loader.

Type Definitions

FeatureLoader()

VectorSource sources use a function of this type to load features.

This function takes 3 arguments: an Extent representing the area to be loaded, a {number} representing the resolution (map units per pixel), and a Projection for the projection. The function is expeced to return a promise that resolves to an array of features.

There are also a deprecated signature, with void as return, and two additional arguments: an optional success callback that should get the loaded features passed as an argument and an optional failure callback with no arguments.

The function is responsible for loading the features and adding them to the source.

FeatureUrlFunction()

VectorSource sources use a function of this type to get the url to load features from.

This function takes an Extent representing the area to be loaded, a {number} representing the resolution (map units per pixel) and an Projection for the projection as arguments and returns a {string} representing the URL.