UNPKG

mobility-toolbox-js

Version:

Toolbox for JavaScript applications in the domains of mobility and logistics.

36 lines (35 loc) 2.22 kB
import type { Feature as FeatureType } from 'ol'; import type { FeatureLike } from 'ol/Feature'; import type { Vector } from 'ol/layer'; import type { ProjectionLike } from 'ol/proj'; import type VectorSource from 'ol/source/Vector'; declare class MapsetKmlFormat { /** * Read a KML string. * @param {String} kmlString A string representing a KML file. * @param {<ol.Projection|String>} featureProjection The projection used by the map. * @param {<boolean>} doNotRevert32pxScaling Set it to true if you use ol < 6.7 and last version of react-spatial, Fix the 32px scaling, introduced by (ol >= 6.7), see https://github.com/openlayers/openlayers/pull/12695. */ readFeatures(kmlString: string, featureProjection: ProjectionLike, doNotRevert32pxScaling?: boolean): FeatureType[]; /** * Removes the <Camera> tag from a KML string. Returns the KML string with removed <Camera> tag. * @param {String} kmlString A string representing a KML file. */ removeDocumentCamera(kmlString: string): string; sanitizeFeature(feature: FeatureType, doNotRevert32pxScaling?: boolean): void; /** * Write the <Camera> tag into a KML string. Returns the KML string with added <Camera> tag. * @param {String} kmlString A string representing a KML file. * @param {Object} cameraAttributes Object containing the camera tags (longitude, latitude, altitude, heading, tilt, altitudeMode, roll) * as keys with corresponding values. See https://developers.google.com/kml/documentation/kmlreference#camera */ writeDocumentCamera: (kmlString: string, cameraAttributes: null | Record<string, string>) => string; /** * Create a KML string. * @param {VectorLayer} layer A react-spatial VectorLayer. * @param {<ol.Projection|String>} featureProjection The current projection used by the features. * @param {<boolean>} fixGxyAndGxh If the KML contains gx:w and gx:h, (ol >= 6.7), it will fix the bug introduced by https://github.com/openlayers/openlayers/pull/12695. */ writeFeatures(layer: Vector<VectorSource<FeatureLike>>, featureProjection: string, mapResolution: number): string | undefined; } export default MapsetKmlFormat;