@opensystemslab/map 0.6.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { Tile as TileLayer } from "ol/layer";
2
2
  import VectorTileLayer from "ol/layer/VectorTile";
3
- import { XYZ } from "ol/source";
4
- export declare function makeRasterBaseMap(copyright: string, apiKey?: string): TileLayer<XYZ>;
5
- export declare function makeOsVectorTileBaseMap(copyright: string, apiKey: string): VectorTileLayer;
3
+ import { OSM } from "ol/source";
4
+ export declare function makeRasterBaseMap(apiKey: string, proxyEndpoint: string, copyright: string): TileLayer<OSM>;
5
+ export declare function makeOsVectorTileBaseMap(apiKey: string, proxyEndpoint: string, copyright: string): VectorTileLayer | undefined;
@@ -0,0 +1,10 @@
1
+ import "./index";
2
+ import type { IWindow } from "happy-dom";
3
+ declare global {
4
+ interface Window extends IWindow {
5
+ }
6
+ }
7
+ declare global {
8
+ interface Window extends IWindow {
9
+ }
10
+ }
@@ -1,6 +1,10 @@
1
+ import { GeoJSONObject } from "ol/format/GeoJSON";
1
2
  import Geometry from "ol/geom/Geometry";
3
+ import { Feature } from "ol/index";
2
4
  import Map from "ol/Map";
3
5
  import { Vector } from "ol/source";
6
+ import VectorSource from "ol/source/Vector";
7
+ import { ProjectionEnum } from "./projections";
4
8
  export declare type AreaUnitEnum = "m2" | "ha";
5
9
  /**
6
10
  * Calculate & format the area of a polygon
@@ -24,3 +28,10 @@ export declare function fitToData(olMap: Map, olSource: Vector<Geometry>, buffer
24
28
  * @returns - a 'rgba(r,g,b,a)' string
25
29
  */
26
30
  export declare function hexToRgba(hexColor: string, alpha: number): string;
31
+ /**
32
+ * Generate a geojson object from a vector source or an array of features
33
+ * @param source
34
+ * @param projection
35
+ * @returns
36
+ */
37
+ export declare function makeGeoJSON(source: VectorSource<Geometry> | Feature<Geometry>[], projection: ProjectionEnum): GeoJSONObject;
@@ -0,0 +1,19 @@
1
+ declare type OSServices = "xyz" | "vectorTile" | "vectorTileStyle" | "places" | "features";
2
+ interface ServiceOptions {
3
+ service: OSServices;
4
+ apiKey: string;
5
+ proxyEndpoint: string;
6
+ params?: Record<string, string>;
7
+ }
8
+ export declare function constructURL(domain: string, path: string, params?: Record<string, string>): string;
9
+ export declare function getOSServiceURL({ service, apiKey, params, }: Omit<ServiceOptions, "proxyEndpoint">): string;
10
+ /**
11
+ * Generate a proxied OS service URL
12
+ * XXX: OS API key must be appended to requests by the proxy endpoint
13
+ */
14
+ export declare function getProxyServiceURL({ service, proxyEndpoint, params, }: Omit<ServiceOptions, "apiKey">): string;
15
+ /**
16
+ * Get either an OS service URL, or a proxied endpoint to an OS service URL
17
+ */
18
+ export declare function getServiceURL({ service, apiKey, proxyEndpoint, params, }: ServiceOptions): string;
19
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,3 @@
1
1
  export declare function getShadowRoot(customEl: string): ShadowRoot | null | undefined;
2
2
  export declare function getShadowRootEl(customEl: string, el: string): Element | null | undefined;
3
+ export declare function setupMap(mapElement: any): Promise<void>;