import { Vector } from 'ol/source'; import IDW from 'ol-ext/source/IDW'; import { Feature } from 'ol'; import { Geometry } from 'ol/geom'; import { LoadingStrategy } from 'ol/source/Vector'; import { Projection } from 'ol/proj'; import { Subject } from 'rxjs'; import { Extent } from 'ol/extent'; type SparqlOptions = { category?: string; category_field?: any; clear_on_move?: boolean; /** * URL of the SPARQL endpoint * @example https://www.foodie-cloud.org/sparql */ endpointUrl?: string; /** * Additional parametres which shall be sent to the SPARQL endpoint along with the query. */ endpointOptions?: any; extend_with_attribs?: any; /** * Query variable (attribute) holding a unique ID of each feature. * It may include the leading question mark or dollar sign. * @default 's' */ idAttribute?: string; /** * Query variable (attribute) holding the geometry of each feature. * It may include the leading question mark or dollar sign. */ geomAttribute?: string; /** * URL of hslayers-proxy if used. Left empty if proxy is not necessary. */ proxyPrefix?: string; /** * When set to 'virtuoso', the query will use Virtuoso's optimised "bif" functions instead of standardised GeoSPARQL functions. * When set to 'wikibase', the query will use Blazegraph & Wikibase SERVICE instead of standardised GeoSPARQL functions. * When unset, the query will use standardised GeoSPARQL functions. * @default undefined */ optimization?: 'virtuoso' | 'wikibase'; /** * EPSG code of projection */ projection: string; /** * Actual SPARQL query. * Must contain magical keyword somewhere in the WHERE clause, which will be automagically replaced by a current extent filter. */ query?: string; strategy?: any; /** * @deprecated * Shorthand, which usage is discouraged. You should split your 'url' param into * 'endpointUrl','query' and possibly 'endpointOptions', if needed. */ url?: string; /** * @deprecated * Was not obvious what it was good for and no use case was found. * If you have some, please file an issue at https://github.com/hslayers/hslayers-ng/issues */ updates_url?: string; }; /** * Provides a source of features from SPARQL endpoint */ declare class SparqlJson extends Vector { category_map: {}; category_id: number; loadCounter: number; occupied_xy: { [coord: string]: boolean; }; styleAble: boolean; hasPoint: boolean; /** * Only either 'url' or 'endpointUrl' + 'query' are mandatory */ constructor({ category, category_field, clear_on_move, endpointUrl, endpointOptions, extend_with_attribs, idAttribute, geomAttribute, proxyPrefix, optimization, projection, query, strategy, url, updates_url, }: SparqlOptions); extendAttributes(extend_with_attribs: any, objects: any): void; composeUrl({ endpointUrl, query, geomAttribute, extent, optimization, proxyPrefix, }: { endpointUrl: string; query: string; geomAttribute: string; extent: any[]; optimization?: string; proxyPrefix?: string; }): string; /** * @param src - OL Source */ createFeatures({ entities, src, occupiedXY, categoryField, categoryMap, categoryId, proj, }: { entities: any[]; src: SparqlJson; occupiedXY: { [coord: string]: boolean; }; categoryField: any; categoryMap: any; categoryId: any; proj: any; }): any[]; /** * This function generates vibrant, "evenly spaced" colours (i.e. no clustering). This is ideal for creating easily distinguishable vibrant markers in Google Maps and other apps. * Adam Cole, 2011-Sept-14 * HSV to RBG adapted from: http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript * based on http://stackoverflow.com/a/7419630 */ rainbow(numOfSteps: number, step: number, opacity: number): string; /** * FIXME: What is this? */ registerCategoryForStatistics({ featureObject, categoryField, feature, categoryMap, categoryId, }: { featureObject: any; categoryField: any; feature: any; categoryMap: any; categoryId: any; }): void; /** * Converts arbitrary JSON form into a JSON compliant with a SPARQL Results JSON Spec, see https://www.w3.org/TR/sparql11-results-json/ * @param json - Output JSON of xml-js library * @returns Standard-compliant SPARQL JSON */ xmlJson2sparqlJson(json: any): { head: { vars: any; }; results: { bindings: any; }; }; } type SPOIOptions = { /** * One of SPOI categories. Can be ONLY ONE. * @example 'cafe' */ category: string; projection: string; }; /** * Handy shorthand for SparqlJson source with some params pre-filled for SPOI dataset */ declare class SPOI extends SparqlJson { constructor({ category, projection }: SPOIOptions); } declare const NORMALIZED_WEIGHT_PROPERTY_NAME = "hs_normalized_IDW_value"; interface IDWImageData { type: 'image'; data: Uint8ClampedArray; width: number; height: number; } interface InterpolatedSourceOptions { min?: number; max?: number; features?: Feature[]; weight: string; loader?(params: any): Promise; colorMap?: ((v: number) => number[]) | string; strategy?: LoadingStrategy; maxFeaturesInExtent?: number; maxFeaturesInCache?: number; } declare class InterpolatedSource extends IDW { options: InterpolatedSourceOptions; featureCache: Vector; cancelUrlRequest: Subject; colorMapChanged: Subject; geoJSONFeatures: string[]; constructor(options: InterpolatedSourceOptions); onImageData(imageData: IDWImageData): void; /** * Get Minimum boundary used in normalization. Values under this minimum are set to it (clamped) */ get min(): number; /** * Set Minimum boundary used in normalization. Values under this minimum are set to it (clamped) */ set min(value: number); /** * Get Maximum boundary used in normalization. Values over this minimum are set to it (clamped) */ get max(): number; /** * Set Maximum boundary used in normalization. Values over this minimum are set to it (clamped) */ set max(value: number); get colorMap(): ((v: number) => number[]) | string; set colorMap(value: ((v: number) => number[]) | string); /** * Get the feature attribute used to get the values interpolated */ get weight(): string; /** * Set the feature attribute used to get the values interpolated */ set weight(value: string); /** * Fill Interpolated source features * @param features - Parsed Ol features from get request * @param extent - Current map extent */ fillFeatures(features: Feature[], extent?: number[]): void; /** * Parse features from get request * @param collection - Get request response feature collection * @param mapProjection - Map projection */ parseFeatures(collection: any, mapProjection: string | Projection): void; /** * Create url for get request including current map extent * @param url - external source URL * @param extent - Current map extent */ createIDWSourceUrl(url: string, extent: number[]): string; /** * Normalize weight values to be between 0 and 100 * //https://www.statology.org/normalize-data-between-0-and-100/ * @param weight - Weight property name */ normalizeWeight(weight: string): void; /** * Determine whether the IDW canvas displays data or not * by checking 4 pixels in predefined image areas */ isImageDataMostlyEmpty(imageData: IDWImageData): boolean; /** * Draw 'NO DATA' label over layers canvas */ drawNoData(ctx: any, canvas: any): void; } type WfsOptions = { /** * If proxy is necessary to use in combination with this WFS layer's server, * specify a path to the running instance of hslayers-server. * This option is independent on HsConfig.proxyPrefix and HsConfig.useProxy. * If left undefined or with an empty string, no proxy is used. */ proxyPrefix?: string; data_version?: string; output_format?: string; crs?: string; provided_url?: string; layer_name?: string; featureNS?: string; map_projection?: any; layerExtent?: Extent; withCredentials?: boolean; }; /** * Provides a source of features from WFS endpoint */ declare class WfsSource extends Vector { private options; constructor(options: WfsOptions); } /** * Creates a POST feature request */ declare function createPostFeatureRequest(layer_name: string, data_version: string, responseFeatureCRS: string, featureNS: string, output_format: string, extent: Extent, srs: string, filter: any, geometryName: string): Promise; /** * Creates parameters for a GET feature request */ declare function createGetFeatureRequest(layer_name: string, data_version: string, responseFeatureCRS: string, output_format: string, extent: Extent, srs: string): string; export { InterpolatedSource, NORMALIZED_WEIGHT_PROPERTY_NAME, SPOI, SparqlJson, WfsSource, createGetFeatureRequest, createPostFeatureRequest }; export type { IDWImageData, InterpolatedSourceOptions, SPOIOptions, SparqlOptions, WfsOptions };