ol-stac 0.0.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.
Files changed (107) hide show
  1. package/.eslintignore +2 -0
  2. package/.github/workflows/deploy.yml +67 -0
  3. package/.github/workflows/publish.yml +32 -0
  4. package/.github/workflows/release.yml +21 -0
  5. package/.github/workflows/test.yml +85 -0
  6. package/CHANGELOG.md +14 -0
  7. package/DEVELOPING.md +104 -0
  8. package/LICENSE.md +201 -0
  9. package/README.md +43 -0
  10. package/config/jsdoc/api/conf.json +38 -0
  11. package/config/jsdoc/api/index.md +1 -0
  12. package/config/jsdoc/api/readme.md +65 -0
  13. package/config/jsdoc/api/template/README.md +3 -0
  14. package/config/jsdoc/api/template/publish.js +743 -0
  15. package/config/jsdoc/api/template/static/scripts/linenumber.js +11 -0
  16. package/config/jsdoc/api/template/static/scripts/main.js +305 -0
  17. package/config/jsdoc/api/template/static/scripts/prettify/Apache-License-2.0.txt +202 -0
  18. package/config/jsdoc/api/template/static/scripts/prettify/lang-css.js +2 -0
  19. package/config/jsdoc/api/template/static/scripts/prettify/prettify.js +28 -0
  20. package/config/jsdoc/api/template/static/styles/carbon.css +65 -0
  21. package/config/jsdoc/api/template/static/styles/jaguar.css +512 -0
  22. package/config/jsdoc/api/template/static/styles/prettify-jsdoc.css +111 -0
  23. package/config/jsdoc/api/template/static/styles/prettify-tomorrow.css +132 -0
  24. package/config/jsdoc/api/template/static/theme +1 -0
  25. package/config/jsdoc/api/template/tmpl/container.tmpl +205 -0
  26. package/config/jsdoc/api/template/tmpl/details.tmpl +84 -0
  27. package/config/jsdoc/api/template/tmpl/example.tmpl +2 -0
  28. package/config/jsdoc/api/template/tmpl/examples.tmpl +16 -0
  29. package/config/jsdoc/api/template/tmpl/exceptions.tmpl +30 -0
  30. package/config/jsdoc/api/template/tmpl/layout.tmpl +92 -0
  31. package/config/jsdoc/api/template/tmpl/mainpage.tmpl +14 -0
  32. package/config/jsdoc/api/template/tmpl/members.tmpl +38 -0
  33. package/config/jsdoc/api/template/tmpl/method.tmpl +132 -0
  34. package/config/jsdoc/api/template/tmpl/navigation.tmpl +59 -0
  35. package/config/jsdoc/api/template/tmpl/observables.tmpl +39 -0
  36. package/config/jsdoc/api/template/tmpl/params.tmpl +109 -0
  37. package/config/jsdoc/api/template/tmpl/properties.tmpl +85 -0
  38. package/config/jsdoc/api/template/tmpl/returns.tmpl +72 -0
  39. package/config/jsdoc/api/template/tmpl/source.tmpl +8 -0
  40. package/config/jsdoc/api/template/tmpl/stability.tmpl +7 -0
  41. package/config/jsdoc/api/template/tmpl/tutorial.tmpl +19 -0
  42. package/config/jsdoc/api/template/tmpl/type.tmpl +7 -0
  43. package/config/jsdoc/info/conf.json +22 -0
  44. package/config/jsdoc/info/publish.js +175 -0
  45. package/config/jsdoc/package.json +4 -0
  46. package/config/jsdoc/plugins/api.cjs +181 -0
  47. package/config/jsdoc/plugins/default-export.cjs +35 -0
  48. package/config/jsdoc/plugins/define-plugin.cjs +33 -0
  49. package/config/jsdoc/plugins/events.cjs +39 -0
  50. package/config/jsdoc/plugins/inline-options.cjs +102 -0
  51. package/config/jsdoc/plugins/markdown.cjs +119 -0
  52. package/config/jsdoc/plugins/observable.cjs +69 -0
  53. package/config/jsdoc/plugins/virtual-plugin.cjs +16 -0
  54. package/config/rollup-full-build.js +24 -0
  55. package/config/tsconfig-build.json +25 -0
  56. package/examples/.eslintrc +29 -0
  57. package/examples/index.html +100 -0
  58. package/examples/index.js +109 -0
  59. package/examples/planetary-computer.html +14 -0
  60. package/examples/planetary-computer.js +53 -0
  61. package/examples/resources/Jugl.js +15 -0
  62. package/examples/resources/common.js +111 -0
  63. package/examples/stac-collection-webmaplinks.html +9 -0
  64. package/examples/stac-collection-webmaplinks.js +55 -0
  65. package/examples/stac-item-from-object.html +9 -0
  66. package/examples/stac-item-from-object.js +102 -0
  67. package/examples/stac-item-tileserver.html +9 -0
  68. package/examples/stac-item-tileserver.js +34 -0
  69. package/examples/stac-item.html +9 -0
  70. package/examples/stac-item.js +45 -0
  71. package/examples/stac-itemcollection.html +11 -0
  72. package/examples/stac-itemcollection.js +39 -0
  73. package/examples/templates/example.html +206 -0
  74. package/examples/templates/readme.md +3 -0
  75. package/examples/webpack/config.mjs +69 -0
  76. package/examples/webpack/example-builder.js +410 -0
  77. package/package.json +107 -0
  78. package/site/build.js +26 -0
  79. package/site/layouts/default.hbs +78 -0
  80. package/site/src/doc/faq.md +8 -0
  81. package/site/src/doc/index.md +22 -0
  82. package/site/src/doc/quickstart.md +121 -0
  83. package/site/src/doc/tutorials/index.md +8 -0
  84. package/site/src/download/index.hbs +62 -0
  85. package/site/src/favicon.ico +0 -0
  86. package/site/src/index.hbs +71 -0
  87. package/site/src/theme/index.css +26 -0
  88. package/site/src/theme/site.css +531 -0
  89. package/src/ol/events/ErrorEvent.js +25 -0
  90. package/src/ol/layer/STAC.js +780 -0
  91. package/src/ol/layer/stacUtil.js +169 -0
  92. package/src/ol/source/GeoTIFF2.js +47 -0
  93. package/tasks/.eslintrc +5 -0
  94. package/tasks/build-website.sh +90 -0
  95. package/tasks/create-release.js +107 -0
  96. package/tasks/generate-index.js +125 -0
  97. package/tasks/generate-info.js +189 -0
  98. package/tasks/get-latest-release.js +36 -0
  99. package/tasks/newest-tag.js +52 -0
  100. package/tasks/prepare-package.js +46 -0
  101. package/tasks/publish.sh +90 -0
  102. package/test/README.md +56 -0
  103. package/test/browser/.eslintrc +14 -0
  104. package/test/browser/karma.config.cjs +94 -0
  105. package/test/browser/spec/ol/layer/STAC.test.js +18 -0
  106. package/test/browser/test-extensions.js +419 -0
  107. package/tsconfig.json +62 -0
@@ -0,0 +1,121 @@
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.
@@ -0,0 +1,8 @@
1
+ ---
2
+ title: Tutorials
3
+ layout: default.hbs
4
+ ---
5
+
6
+ # Tutorials
7
+
8
+ * tbd
@@ -0,0 +1,62 @@
1
+ ---
2
+ title: 'Get the Code'
3
+ layout: default.hbs
4
+ ---
5
+ <div class="container mt-4 pt-4">
6
+ <div class="row">
7
+ <h3 class="col-sm-12">The <code>ol-stac</code> package</h3>
8
+ <div class="col-sm-12">
9
+ <p>
10
+ The recommended way to use OL STAC is to work with the <a href="https://www.npmjs.com/package/ol"><code>ol-stac</code> package</a>.
11
+ </p>
12
+ <p>
13
+ To add OL STAC to an existing project, install the latest with <code>npm</code>:
14
+ <pre><code class="language-shell-session">npm install ol-stac</code></pre>
15
+ </p>
16
+ <p>
17
+ If you are starting a new project from scratch, see the <a href="../doc/quickstart.html">quick start docs</a> for more information.
18
+ </p>
19
+ </div>
20
+ </div>
21
+ <div class="row">
22
+ <h3 class="col-sm-12">Hosted build for development</h3>
23
+ <div class="col-sm-12">
24
+ <p>
25
+ If you want to try out OpenLayers without downloading anything (<b>not recommended for production</b>), include the following in the head of your html page:
26
+ <pre><code class="language-html">&lt;script src="https://cdn.jsdelivr.net/npm/geotiff"&gt;&lt;/script&
27
+ &lt;script src="https://cdn.jsdelivr.net/npm/ol/dist/ol.js"&gt;&lt;/script&gt;
28
+ &lt;link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol/ol.css"&gt;
29
+ &lt;script src="https://cdn.jsdelivr.net/npm/ol-stac@{{ version }}/dist/ol-stac.js"&gt;&lt;/script&gt;</code></pre>
30
+ </p>
31
+ <p>
32
+ The full build of the library does not include all dependencies: the <code>geotiff</code> package is omitted. If you use these, you'll need to add additional script tags.
33
+ </p>
34
+ </div>
35
+ </div>
36
+ <div class="row">
37
+ <h3 class="col-sm-12">Downloads for the {{ version }} release</h3>
38
+ </div>
39
+ <div class="row">
40
+ <div class="col-sm-12">
41
+ <table class="table table-hover">
42
+ <tbody>
43
+ <tr><th>Archive</th><th>Description</th></tr>
44
+ <tr>
45
+ <td><a href="https://github.com/m-mohr/ol-stac/releases/download/{{ version }}/{{ version }}-site.zip">{{ version }}-site.zip</a></td>
46
+ <td>Includes examples and documentation.</td>
47
+ </tr>
48
+ <tr>
49
+ <td><a href="https://github.com/m-mohr/ol-stac/releases/download/{{ version }}/{{ version }}-package.zip">{{ version }}-package.zip</a></td>
50
+ <td>Includes sources and the full build of the library.</td>
51
+ </tr>
52
+ </tbody>
53
+ </table>
54
+ <p>
55
+ See the <a href="https://github.com/m-mohr/ol-stac/releases/tag/{{ version }}">{{ version }} release page</a> for a changelog and any special upgrade notes.
56
+ </p>
57
+ <p>
58
+ For archives of previous releases, see the <a href="https://github.com/m-mohr/ol-stac/releases/">complete list of releases</a>.
59
+ </p>
60
+ </div>
61
+ </div>
62
+ </div>
Binary file
@@ -0,0 +1,71 @@
1
+ ---
2
+ title: Welcome
3
+ layout: default.hbs
4
+ uncontained: true
5
+ head:
6
+ - <link rel="stylesheet" type="text/css" href="/ol-stac/theme/index.css">
7
+ ---
8
+ <div class='container'>
9
+ <div class='row' id='news'>
10
+ <div class='col-sm-12'>
11
+ <h1 class='topic'><i class='fa fa-rss'></i> Latest</h1>
12
+ <p><strong>OL STAC <a href="/ol-stac/download/">{{ version }}</a> is here!</strong> Check out the <a href="/ol-stac/doc/">docs</a> and the <a href="/ol-stac/en/latest/examples/">examples</a> to get started. The full distribution can be downloaded from the <a href="/ol-stac/download/">release page</a>.</p>
13
+ </div>
14
+ </div>
15
+ <div class='row'>
16
+ <h1 class='topic col-sm-12'>Overview</h1>
17
+ </div>
18
+ <div class='row'>
19
+ <div class='col-sm-12'>
20
+ <p>OL STAC makes it easy to put STAC resources on a dynamic OpenLayers map. It can display geometries, GeoTIFF files, web map layers and more. It is completely free, Open Source JavaScript, released under the Apache 2.0 license.</p>
21
+ </div>
22
+ </div>
23
+ <div class='row'>
24
+ <h1 class='topic col-sm-12'>Learn More</h1>
25
+ </div>
26
+ <div class='row'>
27
+ <div class='col-sm-6'>
28
+ <a href='./doc/quickstart.html'>
29
+ <h3><i class='fa fa-check'></i> Quick Start</h3>
30
+ </a>
31
+ <p>Seen enough already? Go here to get started.</p>
32
+ </div>
33
+ <div class='col-sm-6'>
34
+ <a href='/ol-stac/download/'>
35
+ <h3><i class='fa fa-download'></i> Get the Code</h3>
36
+ </a>
37
+ <p>Get the latest release or dig through the archives.</p>
38
+ </div>
39
+ </div>
40
+ <div class='row'>
41
+ <div class='col-sm-6'>
42
+ <a href='/ol-stac/doc/tutorials/'>
43
+ <h3><i class='fa fa-book'></i> Tutorials</h3>
44
+ </a>
45
+ <p>Spend time learning the basics and graduate up to advanced mapping techniques.</p>
46
+ </div>
47
+ </div>
48
+ <div class='row'>
49
+ <div class='col-sm-6'>
50
+ <a href='/ol-stac/en/latest/apidoc/'>
51
+ <h3><i class='fa fa-sitemap'></i> API Docs</h3>
52
+ </a>
53
+ <p>Browse through the API docs for details on code usage.</p>
54
+ </div>
55
+ </div>
56
+ <div class='row'>
57
+ <h1 class='topic col-sm-12'>Get Involved</h1>
58
+ </div>
59
+ <div class='row'>
60
+ <div class='col-sm-4'>
61
+ <a href='https://github.com/m-mohr/ol-stac'>
62
+ <h3><i class="fa fa-code-fork"></i> Fork the repo</h3>
63
+ </a>
64
+ </div>
65
+ <div class='col-sm-4'>
66
+ <a href='https://github.com/m-mohr/ol-stac/issues'>
67
+ <h3><i class="fa fa-bug"></i> Open a ticket</h3>
68
+ </a>
69
+ </div>
70
+ </div>
71
+ </div>
@@ -0,0 +1,26 @@
1
+ #news {
2
+ background-color: var(--ol-accent-background-color);
3
+ border-radius: 4px;
4
+ padding: 1rem 0 0;
5
+ }
6
+
7
+ #news h1 {
8
+ margin: 0;
9
+ }
10
+
11
+ img.thumb {
12
+ float: right;
13
+ margin-left: 10px;
14
+ }
15
+
16
+ /* ol customizations */
17
+
18
+ .ol-overlaycontainer-stopevent {
19
+ opacity: 0;
20
+ transition: opacity 300ms ease;
21
+ }
22
+
23
+ /* not done with :hover because the overlay blocks events and has no height */
24
+ .over .ol-overlaycontainer-stopevent {
25
+ opacity: 1;
26
+ }