locar-tiler 0.2.0 → 0.4.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.
package/README.md CHANGED
@@ -12,9 +12,9 @@ Consequently `locar-tiler` needs to be provided with a server URL which accepts
12
12
 
13
13
  Note that `locar-tiler` does not include any mechanism to cache the tiled data - this is up to the developer to do. It merely downloads the tiled data when needed (i.e. the user moves into a new area) and holds it in memory so the data for that tile isn't downloaded if the user revisits that tile in the same session.
14
14
 
15
- ## Overview of classes
15
+ ## API Documentation
16
16
 
17
- Full API documentation is available in `docs`.
17
+ Available on [GitHub Pages](https://ar-js-org.github.io/locar-tiler).
18
18
 
19
19
  ## Based on
20
20
 
@@ -83,7 +83,7 @@ export declare class DemTiler extends Tiler {
83
83
  * @param {EastNorth} sphMercPos - the Spherical Mercator position.
84
84
  * @return {number} the elevation in metres, or Number.NEGATIVE_INFINITY if this position is outside the extent of the DEM.
85
85
  */
86
- getElevation(sphMercPos: EastNorth): number;
86
+ getElevation(sphMercPos: EastNorth): number | null;
87
87
  /**
88
88
  * Obtain the elevation in metres for a given longitude/latitude.
89
89
  * @param {LonLat} lonLat - the longitude/latitude.
@@ -113,6 +113,22 @@ export declare class EastNorth {
113
113
  * @param {number} n - the northing.
114
114
  */
115
115
  constructor(e: any, n: any);
116
+ /**
117
+ * Returns a string representation of the EastNorth.
118
+ * @return {string} the string representation.
119
+ */
120
+ toString(): string;
121
+ }
122
+
123
+ export declare interface Feature {
124
+ type: string;
125
+ properties: any;
126
+ geometry: Point | LineString | MultiLineString;
127
+ }
128
+
129
+ export declare interface FeatureCollection {
130
+ type: string;
131
+ features: Array<Feature>;
116
132
  }
117
133
 
118
134
  /** Class representing a Tiler which delivers JSON data. */
@@ -131,6 +147,11 @@ export declare class JsonTiler extends Tiler {
131
147
  readTile(url: string): Promise<any>;
132
148
  }
133
149
 
150
+ export declare interface LineString {
151
+ type: string;
152
+ coordinates: number[][];
153
+ }
154
+
134
155
  /** Represents a longitude/latitude.
135
156
  * @property {number} lon - the longitude.
136
157
  * @property {number} lat -the latitude.
@@ -139,12 +160,27 @@ export declare class LonLat {
139
160
  lon: number;
140
161
  lat: number;
141
162
  /**
142
- * Creates an LonLat.
163
+ * Creates a LonLat.
143
164
  * @class
144
165
  * @param {number} lon - the longitude.
145
166
  * @param {number} lat - the latitude.
146
167
  */
147
168
  constructor(lon: any, lat: any);
169
+ /**
170
+ * Returns a string representation of the LonLat.
171
+ * @return {string} the string representation.
172
+ */
173
+ toString(): string;
174
+ }
175
+
176
+ export declare interface MultiLineString {
177
+ type: string;
178
+ coordinates: number[][][];
179
+ }
180
+
181
+ export declare interface Point {
182
+ type: string;
183
+ coordinates: number[];
148
184
  }
149
185
 
150
186
  export declare interface RawPngData {
@@ -223,6 +259,7 @@ export declare class Tile {
223
259
  * @return {string} a string indexing the tile in format z/x/y
224
260
  */
225
261
  getIndex(): string;
262
+ toString(): string;
226
263
  }
227
264
 
228
265
  /** Represents a tiler, capable of delivering Tiles from a given URL. */
@@ -284,7 +321,7 @@ export declare abstract class Tiler {
284
321
  * @param {number} z - zoom level to use (default 13)
285
322
  * @return {Promise<Tile>} Promise resolving with the given Tile.
286
323
  */
287
- getData(sphMercPos: EastNorth, z?: number): Promise<Tile>;
324
+ getData(sphMercPos: EastNorth, z?: number): Promise<DataTile>;
288
325
  /**
289
326
  * Converts the raw data from the server to a custom type of data.
290
327
  * By default, returns a DataTile object containing the Tile and the raw data returned from readTile(), but this can be overridden (e.g. in DemTile the `data` of the DataTile is a DEM object).