ol-stac 0.0.0 → 0.0.1

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.
Files changed (120) hide show
  1. package/README.md +1 -1
  2. package/events/ErrorEvent.d.ts +17 -0
  3. package/events/ErrorEvent.d.ts.map +1 -0
  4. package/{src/ol/events → events}/ErrorEvent.js +9 -11
  5. package/events/ErrorEvent.js.map +1 -0
  6. package/layer/STAC.d.ts +422 -0
  7. package/layer/STAC.d.ts.map +1 -0
  8. package/layer/STAC.js +698 -0
  9. package/layer/STAC.js.map +1 -0
  10. package/layer/stacUtil.d.ts +46 -0
  11. package/layer/stacUtil.d.ts.map +1 -0
  12. package/layer/stacUtil.js +154 -0
  13. package/layer/stacUtil.js.map +1 -0
  14. package/package.json +3 -85
  15. package/source/GeoTIFF2.d.ts +35 -0
  16. package/source/GeoTIFF2.d.ts.map +1 -0
  17. package/{src/ol/source → source}/GeoTIFF2.js +9 -16
  18. package/source/GeoTIFF2.js.map +1 -0
  19. package/.eslintignore +0 -2
  20. package/.github/workflows/deploy.yml +0 -67
  21. package/.github/workflows/publish.yml +0 -32
  22. package/.github/workflows/release.yml +0 -21
  23. package/.github/workflows/test.yml +0 -85
  24. package/CHANGELOG.md +0 -14
  25. package/DEVELOPING.md +0 -104
  26. package/config/jsdoc/api/conf.json +0 -38
  27. package/config/jsdoc/api/index.md +0 -1
  28. package/config/jsdoc/api/readme.md +0 -65
  29. package/config/jsdoc/api/template/README.md +0 -3
  30. package/config/jsdoc/api/template/publish.js +0 -743
  31. package/config/jsdoc/api/template/static/scripts/linenumber.js +0 -11
  32. package/config/jsdoc/api/template/static/scripts/main.js +0 -305
  33. package/config/jsdoc/api/template/static/scripts/prettify/Apache-License-2.0.txt +0 -202
  34. package/config/jsdoc/api/template/static/scripts/prettify/lang-css.js +0 -2
  35. package/config/jsdoc/api/template/static/scripts/prettify/prettify.js +0 -28
  36. package/config/jsdoc/api/template/static/styles/carbon.css +0 -65
  37. package/config/jsdoc/api/template/static/styles/jaguar.css +0 -512
  38. package/config/jsdoc/api/template/static/styles/prettify-jsdoc.css +0 -111
  39. package/config/jsdoc/api/template/static/styles/prettify-tomorrow.css +0 -132
  40. package/config/jsdoc/api/template/static/theme +0 -1
  41. package/config/jsdoc/api/template/tmpl/container.tmpl +0 -205
  42. package/config/jsdoc/api/template/tmpl/details.tmpl +0 -84
  43. package/config/jsdoc/api/template/tmpl/example.tmpl +0 -2
  44. package/config/jsdoc/api/template/tmpl/examples.tmpl +0 -16
  45. package/config/jsdoc/api/template/tmpl/exceptions.tmpl +0 -30
  46. package/config/jsdoc/api/template/tmpl/layout.tmpl +0 -92
  47. package/config/jsdoc/api/template/tmpl/mainpage.tmpl +0 -14
  48. package/config/jsdoc/api/template/tmpl/members.tmpl +0 -38
  49. package/config/jsdoc/api/template/tmpl/method.tmpl +0 -132
  50. package/config/jsdoc/api/template/tmpl/navigation.tmpl +0 -59
  51. package/config/jsdoc/api/template/tmpl/observables.tmpl +0 -39
  52. package/config/jsdoc/api/template/tmpl/params.tmpl +0 -109
  53. package/config/jsdoc/api/template/tmpl/properties.tmpl +0 -85
  54. package/config/jsdoc/api/template/tmpl/returns.tmpl +0 -72
  55. package/config/jsdoc/api/template/tmpl/source.tmpl +0 -8
  56. package/config/jsdoc/api/template/tmpl/stability.tmpl +0 -7
  57. package/config/jsdoc/api/template/tmpl/tutorial.tmpl +0 -19
  58. package/config/jsdoc/api/template/tmpl/type.tmpl +0 -7
  59. package/config/jsdoc/info/conf.json +0 -22
  60. package/config/jsdoc/info/publish.js +0 -175
  61. package/config/jsdoc/package.json +0 -4
  62. package/config/jsdoc/plugins/api.cjs +0 -181
  63. package/config/jsdoc/plugins/default-export.cjs +0 -35
  64. package/config/jsdoc/plugins/define-plugin.cjs +0 -33
  65. package/config/jsdoc/plugins/events.cjs +0 -39
  66. package/config/jsdoc/plugins/inline-options.cjs +0 -102
  67. package/config/jsdoc/plugins/markdown.cjs +0 -119
  68. package/config/jsdoc/plugins/observable.cjs +0 -69
  69. package/config/jsdoc/plugins/virtual-plugin.cjs +0 -16
  70. package/config/rollup-full-build.js +0 -24
  71. package/config/tsconfig-build.json +0 -25
  72. package/examples/.eslintrc +0 -29
  73. package/examples/index.html +0 -100
  74. package/examples/index.js +0 -109
  75. package/examples/planetary-computer.html +0 -14
  76. package/examples/planetary-computer.js +0 -53
  77. package/examples/resources/Jugl.js +0 -15
  78. package/examples/resources/common.js +0 -111
  79. package/examples/stac-collection-webmaplinks.html +0 -9
  80. package/examples/stac-collection-webmaplinks.js +0 -55
  81. package/examples/stac-item-from-object.html +0 -9
  82. package/examples/stac-item-from-object.js +0 -102
  83. package/examples/stac-item-tileserver.html +0 -9
  84. package/examples/stac-item-tileserver.js +0 -34
  85. package/examples/stac-item.html +0 -9
  86. package/examples/stac-item.js +0 -45
  87. package/examples/stac-itemcollection.html +0 -11
  88. package/examples/stac-itemcollection.js +0 -39
  89. package/examples/templates/example.html +0 -206
  90. package/examples/templates/readme.md +0 -3
  91. package/examples/webpack/config.mjs +0 -69
  92. package/examples/webpack/example-builder.js +0 -410
  93. package/site/build.js +0 -26
  94. package/site/layouts/default.hbs +0 -78
  95. package/site/src/doc/faq.md +0 -8
  96. package/site/src/doc/index.md +0 -22
  97. package/site/src/doc/quickstart.md +0 -121
  98. package/site/src/doc/tutorials/index.md +0 -8
  99. package/site/src/download/index.hbs +0 -62
  100. package/site/src/favicon.ico +0 -0
  101. package/site/src/index.hbs +0 -71
  102. package/site/src/theme/index.css +0 -26
  103. package/site/src/theme/site.css +0 -531
  104. package/src/ol/layer/STAC.js +0 -780
  105. package/src/ol/layer/stacUtil.js +0 -169
  106. package/tasks/.eslintrc +0 -5
  107. package/tasks/build-website.sh +0 -90
  108. package/tasks/create-release.js +0 -107
  109. package/tasks/generate-index.js +0 -125
  110. package/tasks/generate-info.js +0 -189
  111. package/tasks/get-latest-release.js +0 -36
  112. package/tasks/newest-tag.js +0 -52
  113. package/tasks/prepare-package.js +0 -46
  114. package/tasks/publish.sh +0 -90
  115. package/test/README.md +0 -56
  116. package/test/browser/.eslintrc +0 -14
  117. package/test/browser/karma.config.cjs +0 -94
  118. package/test/browser/spec/ol/layer/STAC.test.js +0 -18
  119. package/test/browser/test-extensions.js +0 -419
  120. package/tsconfig.json +0 -62
@@ -1,410 +0,0 @@
1
- import assert from 'assert';
2
- import frontMatter from 'front-matter';
3
- import fs from 'fs';
4
- import fse from 'fs-extra';
5
- import handlebars from 'handlebars';
6
- import path, {dirname} from 'path';
7
- import sources from 'webpack-sources';
8
- import {fileURLToPath} from 'url';
9
- import {marked} from 'marked';
10
-
11
- const RawSource = sources.RawSource;
12
- const baseDir = dirname(fileURLToPath(import.meta.url));
13
-
14
- const isCssRegEx = /\.css(\?.*)?$/;
15
- const isJsRegEx = /\.js(\?.*)?$/;
16
- const importRegEx = /\s?import .*? from '([^']+)'/g;
17
- const isTemplateJs = /\/(?:bootstrap(?:\.bundle)?)(?:\.min)?\.js(?:\?.*)?$/;
18
- const isTemplateCss =
19
- /\/(?:bootstrap|fontawesome-free@[\d.]+\/css\/(?:fontawesome|brands|solid))(?:\.min)?\.css(?:\?.*)?$/;
20
-
21
- const exampleDirContents = fs
22
- .readdirSync(path.join(baseDir, '..'))
23
- .filter((name) => /^(?!index).*\.html$/.test(name))
24
- .map((name) => name.replace(/\.html$/, ''));
25
-
26
- function getPackageInfo() {
27
- return fse.readJSON(path.resolve(baseDir, '../../package.json'));
28
- }
29
-
30
- handlebars.registerHelper(
31
- 'md',
32
- (str) =>
33
- new handlebars.SafeString(marked(str, {headerIds: false, mangle: false}))
34
- );
35
-
36
- /**
37
- * Used to doube-escape the title when stored as data-* attribute.
38
- */
39
- handlebars.registerHelper('escape', (text) => {
40
- return handlebars.Utils.escapeExpression(text);
41
- });
42
-
43
- handlebars.registerHelper('indent', (text, options) => {
44
- if (!text) {
45
- return text;
46
- }
47
- const count = options.hash.spaces || 2;
48
- const spaces = new Array(count + 1).join(' ');
49
- return text
50
- .split('\n')
51
- .map((line) => (line ? spaces + line : ''))
52
- .join('\n');
53
- });
54
-
55
- /**
56
- * Returns the object with the keys inserted in alphabetic order.
57
- * When exporting with `JSON.stringify(obj)` the keys are sorted.
58
- * @param {Object<string, *>} obj Any object
59
- * @return {Object<string, *>} New object
60
- */
61
- function sortObjectByKey(obj) {
62
- return Object.keys(obj)
63
- .sort() // sort twice to get predictable, case insensitive order
64
- .sort((a, b) => a.localeCompare(b, 'en', {sensitivity: 'base'}))
65
- .reduce((idx, tag) => {
66
- idx[tag] = obj[tag];
67
- return idx;
68
- }, {});
69
- }
70
-
71
- /**
72
- * Create an index of tags belonging to examples
73
- * @param {Array<Object>} exampleData Array of example data objects.
74
- * @return {Object} Word index.
75
- */
76
- function createTagIndex(exampleData) {
77
- const index = {};
78
- exampleData.forEach((data, i) => {
79
- data.tags.forEach((tag) => {
80
- tag = tag.toLowerCase();
81
- let tagIndex = index[tag];
82
- if (!tagIndex) {
83
- tagIndex = [];
84
- index[tag] = tagIndex;
85
- }
86
- tagIndex.push(i);
87
- });
88
- });
89
- return index;
90
- }
91
-
92
- /**
93
- * Create an inverted index of keywords from examples. Property names are
94
- * lowercased words. Property values are objects mapping example index to word
95
- * count.
96
- * @param {Array<Object>} exampleData Array of example data objects.
97
- * @return {Object} Word index.
98
- */
99
- function createWordIndex(exampleData) {
100
- const index = {};
101
- const keys = ['shortdesc', 'title', 'tags'];
102
- exampleData.forEach((data, i) => {
103
- keys.forEach((key) => {
104
- let text = data[key] || '';
105
- if (Array.isArray(text)) {
106
- text = text.join(' ');
107
- }
108
- const words = text.toLowerCase().split(/\W+/);
109
- words.forEach((word) => {
110
- if (word) {
111
- let counts = index[word];
112
- if (!counts) {
113
- counts = {};
114
- index[word] = counts;
115
- }
116
- counts[i] = (counts[i] || 0) + 1;
117
- }
118
- });
119
- });
120
- });
121
- return index;
122
- }
123
-
124
- /**
125
- * Gets dependencies from the js source.
126
- * @param {string} jsSource Source.
127
- * @param {Object} pkg Package info.
128
- * @return {Object<string, string>} dependencies
129
- */
130
- function getDependencies(jsSource, pkg) {
131
- const dependencies = {
132
- ol: pkg.version,
133
- };
134
-
135
- let importMatch;
136
- while ((importMatch = importRegEx.exec(jsSource))) {
137
- const imp = importMatch[1];
138
- if (!imp.startsWith('ol/') && imp != 'ol') {
139
- const parts = imp.split('/');
140
- const dep = imp.startsWith('@') ? parts.slice(0, 2).join('/') : parts[0];
141
- if (dep in pkg.devDependencies) {
142
- dependencies[dep] = pkg.devDependencies[dep];
143
- } else if (dep in pkg.dependencies) {
144
- dependencies[dep] = pkg.dependencies[dep];
145
- }
146
- }
147
- }
148
- return dependencies;
149
- }
150
-
151
- export default class ExampleBuilder {
152
- /**
153
- * A webpack plugin that builds the html files for our examples.
154
- * @param {Object} config Plugin configuration. Requires a `templates` property
155
- * with the path to templates and a `common` property with the name of the
156
- * common chunk.
157
- */
158
- constructor(config) {
159
- this.name = 'ExampleBuilder';
160
- this.templates = config.templates;
161
- this.common = config.common;
162
- }
163
-
164
- /**
165
- * Called by webpack.
166
- * @param {Object} compiler The webpack compiler.
167
- */
168
- apply(compiler) {
169
- compiler.hooks.compilation.tap(this.name, (compilation) => {
170
- compilation.hooks.additionalAssets.tapPromise(this.name, async () => {
171
- await this.addAssets(compilation.assets, compiler.context);
172
- });
173
- });
174
- }
175
-
176
- async addAssets(assets, dir) {
177
- const jsAssetRE = /^[\w-]+\.js$/;
178
- const names = [];
179
- for (const filename in assets) {
180
- if (!jsAssetRE.test(filename)) {
181
- continue;
182
- }
183
-
184
- const name = filename.replace(/\.js$/, '');
185
- if (!exampleDirContents.includes(name)) {
186
- continue;
187
- }
188
-
189
- names.push(name);
190
- }
191
-
192
- if (names.length === 0) {
193
- return;
194
- }
195
-
196
- const exampleData = await Promise.all(
197
- names.map((name) => this.parseExample(dir, name))
198
- );
199
-
200
- const examples = exampleData.map((data) => ({
201
- link: data.filename,
202
- title: data.title,
203
- shortdesc: data.shortdesc,
204
- tags: data.tags,
205
- }));
206
-
207
- examples.sort((a, b) =>
208
- a.title.localeCompare(b.title, 'en', {sensitivity: 'base'})
209
- );
210
- const tagIndex = createTagIndex(examples);
211
- const info = {
212
- examples: examples,
213
- // Tags for main page... TODO: implement index tag links
214
- // tagIndex: sortObjectByKey(tagIndex),
215
- wordIndex: sortObjectByKey(createWordIndex(examples)),
216
- };
217
- exampleData.forEach((data) => {
218
- data.tags = data.tags.map((tag) => {
219
- const tagExamples = tagIndex[tag.toLowerCase()];
220
- return {
221
- tag: tag,
222
- examples: tagExamples.map((exampleIdx) => {
223
- const example = examples[exampleIdx];
224
- return {
225
- link: example.link,
226
- title: example.title,
227
- isCurrent: data.filename === example.link,
228
- };
229
- }),
230
- };
231
- });
232
- });
233
-
234
- const pkg = await getPackageInfo();
235
- await Promise.all(
236
- exampleData.map(async (data) => {
237
- const newAssets = await this.render(data, pkg);
238
- for (const file in newAssets) {
239
- assets[file] = new RawSource(newAssets[file]);
240
- }
241
- })
242
- );
243
-
244
- const indexSource = `const info = ${JSON.stringify(info)};`;
245
- assets['examples-info.js'] = new RawSource(indexSource);
246
- }
247
-
248
- async parseExample(dir, name) {
249
- const htmlName = `${name}.html`;
250
- const htmlPath = path.join(dir, htmlName);
251
- const htmlSource = await fse.readFile(htmlPath, {encoding: 'utf8'});
252
- const {attributes: data, body} = frontMatter(
253
- this.ensureNewLineAtEnd(htmlSource)
254
- );
255
- assert(!!data.layout, `missing layout in ${htmlPath}`);
256
- return Object.assign(data, {
257
- contents: body,
258
- filename: htmlName,
259
- dir: dir,
260
- name: name,
261
- // process tags
262
- tags: data.tags ? data.tags.replace(/[\s"]+/g, '').split(',') : [],
263
- });
264
- }
265
-
266
- /**
267
- * @param {string} source A string
268
- * @return {string} Same string without a newline character at end
269
- */
270
- ensureNewLineAtEnd(source) {
271
- if (source[source.length - 1] !== '\n') {
272
- source += '\n';
273
- }
274
- return source;
275
- }
276
-
277
- /**
278
- * @param {string} source Source code
279
- * @return {string} Transformed source
280
- */
281
- transformJsSource(source) {
282
- return (
283
- source
284
- // remove "../src/" prefix to have the same import syntax as the documentation
285
- .replace(/'\.\.\/src\//g, "'")
286
- );
287
- }
288
-
289
- /**
290
- * @param {string} source Source file
291
- * @param {Array<{key: string, value: string}>|undefined} cloak Replacement rules
292
- * @return {string} The source with all keys replaced by value
293
- */
294
- cloakSource(source, cloak) {
295
- if (cloak) {
296
- for (const entry of cloak) {
297
- source = source.replaceAll(entry.key, entry.value);
298
- }
299
- }
300
- return source;
301
- }
302
-
303
- async render(data, pkg) {
304
- const assets = {};
305
- const readOptions = {encoding: 'utf8'};
306
-
307
- // add in script tag
308
- const jsName = `${data.name}.js`;
309
- const jsPath = path.join(data.dir, jsName);
310
- let jsSource = await fse.readFile(jsPath, {encoding: 'utf8'});
311
- jsSource = this.transformJsSource(this.cloakSource(jsSource, data.cloak));
312
- data.js = {
313
- local: [],
314
- remote: [],
315
- source: jsSource,
316
- };
317
-
318
- let jsSources = jsSource;
319
- if (data.sources) {
320
- data.extraSources = await Promise.all(
321
- data.sources.map(async (sourceConfig) => {
322
- const fileName = sourceConfig.path;
323
- const extraSourcePath = path.join(data.dir, fileName);
324
- let source = await fse.readFile(extraSourcePath, readOptions);
325
- let ext = fileName.match(/\.(\w+)$/)[1];
326
- if (ext === 'mjs') {
327
- ext = 'js';
328
- }
329
- if (ext === 'js') {
330
- source = this.transformJsSource(source);
331
- jsSources += '\n' + source;
332
- }
333
- source = this.cloakSource(source, data.cloak);
334
- assets[fileName] = source;
335
- return {
336
- name: sourceConfig.as || fileName,
337
- source: source,
338
- type: ext,
339
- };
340
- })
341
- );
342
- }
343
-
344
- data.olVersion = pkg.version;
345
- data.pkgJson = JSON.stringify(
346
- {
347
- name: data.name,
348
- dependencies: getDependencies(jsSources, pkg),
349
- devDependencies: {
350
- vite: '^3.2.3',
351
- },
352
- scripts: {
353
- start: 'vite',
354
- build: 'vite build',
355
- },
356
- },
357
- null,
358
- 2
359
- );
360
-
361
- data.css = {
362
- local: [],
363
- remote: [],
364
- source: undefined,
365
- };
366
-
367
- // add additional resources
368
- if (data.resources) {
369
- data.resources.forEach((resource) => {
370
- const absoluteUrl = /^https?:\/\//.test(resource)
371
- ? resource
372
- : `https://m-mohr.github.io/ol-stac/en/v${pkg.version}/examples/${resource}`;
373
- if (isJsRegEx.test(resource)) {
374
- if (!isTemplateJs.test(resource)) {
375
- data.js.local.push(resource);
376
- }
377
- data.js.remote.push(absoluteUrl);
378
- } else if (isCssRegEx.test(resource)) {
379
- if (!isTemplateCss.test(resource)) {
380
- data.css.local.push(resource);
381
- }
382
- data.css.remote.push(absoluteUrl);
383
- } else {
384
- throw new Error(
385
- `Invalid resource: '${resource}' is not .js or .css: ${data.filename}`
386
- );
387
- }
388
- });
389
- }
390
-
391
- data.js.local.push(`${this.common}.js`, jsName);
392
-
393
- // check for example css
394
- const cssName = `${data.name}.css`;
395
- const cssPath = path.join(data.dir, cssName);
396
- try {
397
- assets[cssName] = await fse.readFile(cssPath, readOptions);
398
- data.css.local.push(cssName);
399
- data.css.source = this.ensureNewLineAtEnd(assets[cssName]);
400
- } catch (err) {
401
- // pass, no css for this example
402
- }
403
-
404
- const templatePath = path.join(this.templates, data.layout);
405
- const templateSource = await fse.readFile(templatePath, readOptions);
406
-
407
- assets[data.filename] = handlebars.compile(templateSource)(data);
408
- return assets;
409
- }
410
- }
package/site/build.js DELETED
@@ -1,26 +0,0 @@
1
- import Metalsmith from 'metalsmith';
2
- import inPlace from '@metalsmith/in-place';
3
- import layouts from '@metalsmith/layouts';
4
- import markdown from '@metalsmith/markdown';
5
- import {dirname} from 'node:path';
6
- import {env} from 'node:process';
7
- import {fileURLToPath} from 'node:url';
8
-
9
- const baseDir = dirname(fileURLToPath(import.meta.url));
10
-
11
- const builder = Metalsmith(baseDir)
12
- .source('./src')
13
- .destination('./build')
14
- .clean(true)
15
- .metadata({
16
- version: env.OL_VERSION || 'dev',
17
- })
18
- .use(inPlace({transform: 'handlebars'}))
19
- .use(markdown())
20
- .use(layouts());
21
-
22
- builder.build(async (err) => {
23
- if (err) {
24
- throw err;
25
- }
26
- });
@@ -1,78 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name='viewport' content='width=device-width, initial-scale=1.0'>
6
- <title>OL STAC - {{ title }}</title>
7
- <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.28.0/components/prism-core.min.js"></script>
8
- <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.28.0/plugins/autoloader/prism-autoloader.min.js"></script>
9
- <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.28.0/plugins/toolbar/prism-toolbar.min.js"></script>
10
- <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.28.0/plugins/copy-to-clipboard/prism-copy-to-clipboard.min.js"></script>
11
- <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Quattrocento+Sans:400,400italic,700" crossorigin="anonymous">
12
- <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" crossorigin="anonymous">
13
- <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.1.2/css/fontawesome.min.css" crossorigin="anonymous">
14
- <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.1.2/css/solid.css" crossorigin="anonymous">
15
- <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.1.2/css/brands.css" crossorigin="anonymous">
16
- <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/ol/ol.css">
17
- <link rel="stylesheet" type="text/css" href="/ol-stac/theme/site.css">
18
- {{#each head}}
19
- {{{ this }}}
20
- {{/each}}
21
- </head>
22
- <body>
23
- <header class="navbar navbar-expand-md navbar-dark mb-3 px-3 py-0 fixed-top" role="navigation">
24
- <a class="navbar-brand" href="/">OL STAC</a>
25
- <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#olmenu" aria-controls="olmenu" aria-expanded="false" aria-label="Toggle navigation">
26
- <span class="navbar-toggler-icon"></span>
27
- </button>
28
-
29
- <!-- menu items that get hidden below 768px width -->
30
- <nav class="collapse navbar-collapse" id="olmenu">
31
- <ul class="nav navbar-nav ms-auto">
32
- <li class="nav-item dropdown">
33
- <a class="nav-link dropdown-toggle" href="#" id="docdropdown" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Docs</a>
34
- <div class="dropdown-menu dropdown-menu-end mb-3" aria-labelledby="docdropdown">
35
- <a class="dropdown-item" href="/ol-stac/doc/">Docs</a>
36
- <div class="dropdown-divider"></div>
37
- <a class="dropdown-item" href="/ol-stac/doc/quickstart.html"><i class="fa fa-check fa-fw me-2 fa-lg"></i>Quick Start</a>
38
- <a class="dropdown-item" href="/ol-stac/doc/faq.html"><i class="fa fa-question fa-fw me-2 fa-lg"></i>FAQ</a>
39
- <a class="dropdown-item" href="/ol-stac/doc/tutorials/"><i class="fa fa-book fa-fw me-2 fa-lg"></i>Tutorials</a>
40
- </div>
41
- </li>
42
- <li class="nav-item"><a class="nav-link" href="/ol-stac/en/latest/examples/">Examples</a></li>
43
- <li class="nav-item dropdown">
44
- <a class="nav-link dropdown-toggle" href="#" id="apidropdown" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
45
- <i class="fa fa-sitemap me-1"></i>API
46
- </a>
47
- <div class="dropdown-menu dropdown-menu-end mb-3" aria-labelledby="apidropdown">
48
- <a class="dropdown-item" href="/ol-stac/en/latest/apidoc/"><i class="fa fa-sitemap fa-fw me-2 fa-lg"></i>{{ version }} (latest)</a>
49
- </div>
50
- </li>
51
- <li class="nav-item dropdown">
52
- <a class="nav-link dropdown-toggle" href="#" id="codedropdown" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Code</a>
53
- <div class="dropdown-menu dropdown-menu-end mb-3" aria-labelledby="codedropdown">
54
- <a class="dropdown-item" href="https://github.com/m-mohr/ol-stac"><i class="fab fa-github fa-fw me-2 fa-lg"></i>Repository</a>
55
- <a class="dropdown-item" href="/ol-stac/download/"><i class="fa fa-download fa-fw me-2 fa-lg"></i>Download</a>
56
- </div>
57
- </li>
58
- </ul>
59
- </nav>
60
- </header>
61
-
62
- {{#if uncontained}}
63
- {{{ contents }}}
64
- {{else}}
65
- <div class="container">
66
- {{{ contents }}}
67
- </div>
68
- {{/if}}
69
- <footer>
70
- Code licensed under the <a href='https://www.tldrlegal.com/license/apache-license-2-0-apache-2-0'>Apache 2.0</a>.
71
- All documentation <a href='http://creativecommons.org/licenses/by/3.0/'>CC BY 3.0</a>.
72
- </footer>
73
- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js"></script>
74
- {{#each scripts}}
75
- {{{this}}}
76
- {{/each}}
77
- </body>
78
- </html>
@@ -1,8 +0,0 @@
1
- ---
2
- title: Frequently Asked Questions (FAQ)
3
- layout: default.hbs
4
- ---
5
-
6
- # Frequently Asked Questions (FAQ)
7
-
8
- tbd
@@ -1,22 +0,0 @@
1
- ---
2
- title: Documentation
3
- layout: default.hbs
4
- ---
5
-
6
- # Documentation
7
-
8
- If you're eager to get your first OpenLayers map on a page, dive into the [quick start](./quickstart.html).
9
-
10
- For a more in-depth overview of OpenLayers core concepts, check out the [tutorials](./tutorials/).
11
-
12
- Make sure to also check out the [OpenLayers workshop](/workshop/).
13
-
14
- Find additional reference material in the [API docs](/en/latest/apidoc/) and [examples](/en/latest/examples/).
15
-
16
- # Frequently Asked Questions (FAQ)
17
-
18
- We have put together a document that lists [Frequently Asked Questions (FAQ)](./faq.html) and our answers. Common problems that may arise when using OpenLayers are explained there, and chances are you'll find an appropriate solution in this document.
19
-
20
- # More questions?
21
-
22
- If you cannot find an answer in the documentation or the FAQ, you can search [Stack Overflow](https://stackoverflow.com/questions/tagged/openlayers). If you cannot find an answer there, ask a new question there, using the tag 'openlayers'.
@@ -1,121 +0,0 @@
1
- ---
2
- title: Quick Start
3
- layout: default.hbs
4
- ---
5
-
6
- # Quick Start
7
-
8
- This primer shows you how to put a map on a web page. The development setup uses [Node](https://nodejs.org/) (14 or higher) and requires that you have [`git`](https://github.com/git-guides/install-git) installed.
9
-
10
- ## Set up a new project
11
-
12
- The easiest way to start building a project with OpenLayers is to run `npm create ol-app`:
13
-
14
- ```bash
15
- npm create ol-app my-app
16
- cd my-app
17
- npm start
18
- ```
19
-
20
- The first command will create a directory called `my-app` (you can use a different name if you wish), install OpenLayers and a development server, and set up a basic app with `index.html`, `main.js`, and `style.css` files.
21
-
22
- The second command (`cd my-app`) changes the working directory to your new `my-app` project so you can start working with it.
23
-
24
- The third command (`npm start`) starts a development server so you can view your application in a browser while working on it. After running `npm start`, you'll see output that tells you the URL to open. Open http://localhost:5173/ (or whatever URL is displayed) to see your new application.
25
-
26
- ## Exploring the parts
27
-
28
- An OpenLayers application is composed of three basic parts:
29
-
30
- * The HTML markup with an element to contain the map (`index.html`)
31
- * The JavaScript that initializes the map (`main.js`)
32
- * The CSS styles that determine the map size and any other customizations (`style.css`)
33
-
34
- ### The markup
35
-
36
- Open the `index.html` file in a text editor. It should look something like this:
37
-
38
- ```html
39
- <!DOCTYPE html>
40
- <html lang="en">
41
- <head>
42
- <meta charset="UTF-8" />
43
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
44
- <title>Quick Start</title>
45
- </head>
46
- <body>
47
- <div id="map"></div>
48
- <script type="module" src="./main.js"></script>
49
- </body>
50
- </html>
51
- ```
52
-
53
- The two important parts in the markup are the `<div>` element to contain the map and the `<script>` tag to pull in the JavaScript. The map container or target should be a block level element (like a `<div>`) and it must appear in the document before the `<script>` tag that initializes the map.
54
-
55
- ## The script
56
-
57
- Open the `main.js` file in a text editor. It should look something like this:
58
-
59
- ```js
60
- import './style.css';
61
- import Map from 'ol/Map.js';
62
- import OSM from 'ol/source/OSM.js';
63
- import TileLayer from 'ol/layer/Tile.js';
64
- import View from 'ol/View.js';
65
-
66
- const map = new Map({
67
- target: 'map',
68
- layers: [
69
- new TileLayer({
70
- source: new OSM(),
71
- }),
72
- ],
73
- view: new View({
74
- center: [0, 0],
75
- zoom: 2,
76
- }),
77
- });
78
- ```
79
-
80
- OpenLayers is packaged as a collection of [ES modules](https://hacks.mozilla.org/2018/03/es-modules-a-cartoon-deep-dive/). The `import` lines are used to pull in the modules that your application needs. Take a look through the [examples](/en/latest/examples/) and [API docs](/en/latest/apidoc/) to understand which modules you might want to use.
81
-
82
- The `import './style.css';` line might be a bit unexpected. In this example, we're using [Vite](https://vitejs.dev/) as a development server. Vite allows CSS to be imported from JavaScript modules. If you were using a different development server, you might include the `style.css` in a `<link>` tag in the `index.html` instead.
83
-
84
- The `main.js` module serves as an entry point for your application. It initializes a new map, giving it a single layer with an OSM source and a view describing the center and zoom level. Read through the [Basic Concepts tutorial](./tutorials/concepts.html) to learn more about `Map`, `View`, `Layer`, and `Source` components.
85
-
86
- ## The style
87
-
88
- Open the `style.css` file in a text editor. It should look something like this:
89
-
90
- ```css
91
- @import "node_modules/ol/ol.css";
92
-
93
- html,
94
- body {
95
- margin: 0;
96
- height: 100%;
97
- }
98
-
99
- #map {
100
- position: absolute;
101
- top: 0;
102
- bottom: 0;
103
- width: 100%;
104
- }
105
- ```
106
-
107
- The first line imports the `ol.css` file that comes with the `ol` package (OpenLayers is published as the [`ol` package](https://www.npmjs.com/package/ol) in the npm registry). The `ol` package was installed in the `npm create ol-app` step above. If you were starting with an existing application instead of using `npm create ol-app`, you would install the package with `npm install ol`. The `ol.css` stylesheet includes styles for the elements that OpenLayers creates – things like buttons for zooming in and out.
108
-
109
- The remaining rules in the `style.css` file make it so the `<div id="map">` element that contains the map fills the entire page.
110
-
111
- ## Deploying your app
112
-
113
- You can make edits to the `index.html`, `main.js`, or `style.css` files and see the resulting change in your browser while running the development server (with `npm start`). After you have finished making edits, it is time to bundle or build your application so that it can be deployed as a static website (without needing to run a development server like Vite).
114
-
115
- To build your application, run the following:
116
-
117
- ```bash
118
- npm run build
119
- ```
120
-
121
- This will create a `dist` directory with a new `index.html` and assets that make up your application. These `dist` files can be deployed with your production website.
@@ -1,8 +0,0 @@
1
- ---
2
- title: Tutorials
3
- layout: default.hbs
4
- ---
5
-
6
- # Tutorials
7
-
8
- * tbd