@dataforsyningen/saul 3.2.0 → 3.3.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.
package/README.md CHANGED
@@ -39,6 +39,11 @@ From within `node_modules/@dataforsyningen/saul` you can run the `test` command
39
39
  npm run test
40
40
  ```
41
41
 
42
+ ## Publish NPM
43
+
44
+ Create a new release in Github to publish an updated NPM package.
45
+ Details are available in the "Npm" section of SDFI ITU's wiki.
46
+
42
47
  ## Acknowledgements
43
48
 
44
49
  SAUL is made available under the MIT license by
package/config.js.example CHANGED
@@ -1,12 +1,12 @@
1
1
  export default {
2
2
 
3
3
  // STAC TOKEN can be aquired from https://dataforsyningen.dk/
4
- API_STAC_TOKEN: "",
5
- API_STAC_BASEURL: "https://api.dataforsyningen.dk/skraafoto_api_test/v1.0",
4
+ API_STAC_TOKEN: "", // Dataforsyningen token
5
+ API_STAC_BASEURL: "https://api.dataforsyningen.dk/rest/skraafoto_api_test/v1.0",
6
6
 
7
7
  // DHM URL and auth can be aquired from https://datafordeler.dk/dataoversigt/danmarks-hoejdemodel-dhm/koter/
8
8
  API_DHM_WCS_BASEURL: "https://services.datafordeler.dk/DHMNedboer/dhm_wcs/1.0.0/WCS",
9
9
  API_DHM_BASEURL: "https://services.datafordeler.dk/DHMTerraen/DHMKoter/1.0.0/GEOREST/HentKoter",
10
- API_DHM_USERNAME: "",
11
- API_DHM_PASSWORD: ""
10
+ API_DHM_TOKENA: "", // DHM API service username
11
+ API_DHM_TOKENB: "" // DHM API service password
12
12
  }
package/example.html CHANGED
@@ -17,7 +17,7 @@
17
17
 
18
18
  <script type="module">
19
19
 
20
- // You should add your own config.js with proper tokens, passwords, etc.
20
+ // You should add your own config.js with proper tokens, etc.
21
21
  // Check config.js.example for info on how to set it up
22
22
  import auth from './config.js'
23
23
 
package/index.js CHANGED
@@ -5,7 +5,7 @@ export {
5
5
  world2image, // Deprecated. Use getImageXY
6
6
  getWorldXYZ,
7
7
  getImageXY,
8
- getZ, // Deprecated. Use getElevation
8
+ getZ,
9
9
  iterate // Deprecated. Use getWorldXYZ
10
10
  } from './modules/saul-core.js'
11
11
 
package/modules/api.js CHANGED
@@ -154,11 +154,11 @@ function post(url, requestbody, token) {
154
154
  /**
155
155
  * API method to fetch data from DHM
156
156
  * @param {string} query - DHM API query. Find details at https://datafordeler.dk/dataoversigt/danmarks-hoejdemodel-dhm/koter/
157
- * @param {{API_DHM_BASEURL: string, API_DHM_USERNAME: string, API_DHM_PASSWORD: string}} auth - API autentication data. See ../config.js.example for reference.
157
+ * @param {{API_DHM_BASEURL: string, API_DHM_TOKENA: string, API_DHM_TOKENB: string}} auth - API autentication data. See ../config.js.example for reference.
158
158
  * @returns {object} Response data
159
159
  */
160
160
  function getDHM(query, auth) {
161
- const auth_params = `&username=${auth.API_DHM_USERNAME}&password=${auth.API_DHM_PASSWORD}`
161
+ const auth_params = `&username=${auth.API_DHM_TOKENA}&password=${auth.API_DHM_TOKENB}`
162
162
  return get(encodeURI(auth.API_DHM_BASEURL + query + auth_params))
163
163
  .then((data) => data)
164
164
  }
@@ -197,7 +197,7 @@ async function consumeGeoTIFF(raw_data) {
197
197
 
198
198
  /** Fetches a GeoTIFF with elevation data matching the bounding box of a STAC API item (image)
199
199
  * @param {object} stac_item - STAC API item from a featureCollection request
200
- * @param {{API_DHM_WCS_BASEURL: string, API_DHM_USERNAME: string, API_DHM_PASSWORD: string}} auth - API autentication data. See ../config.js.example for reference.
200
+ * @param {{API_DHM_WCS_BASEURL: string, API_DHM_TOKENA: string, API_DHM_TOKENB: string}} auth - API autentication data. See ../config.js.example for reference.
201
201
  * @param {number} [resolution] - Resolution (1 - 0.01). Higher number means more pixels and better precision.
202
202
  * @returns {object} GeoTiff data
203
203
  */
@@ -210,7 +210,7 @@ function getTerrainGeoTIFF(stac_item, auth, resolution = 0.05) {
210
210
  // GET request for DHM WCS data
211
211
  let url = auth.API_DHM_WCS_BASEURL
212
212
  url += '?SERVICE=WCS&COVERAGE=dhm_terraen&RESPONSE_CRS=epsg:25832&CRS=epsg:25832&FORMAT=GTiff&REQUEST=GetCoverage&VERSION=1.0.0'
213
- url += `&username=${ auth.API_DHM_USERNAME }&password=${ auth.API_DHM_PASSWORD }` // TODO: Should be auth stuff
213
+ url += `&username=${ auth.API_DHM_TOKENA }&password=${ auth.API_DHM_TOKENB }`
214
214
  url += `&height=${ height }`
215
215
  url += `&width=${ width }`
216
216
  url += `&bbox=${ bbox[0]},${ bbox[1]},${ bbox[2]},${ bbox[3]}`
@@ -217,6 +217,7 @@ async function compareZ(options) {
217
217
  * @param {array} options.xy - image coordinates
218
218
  * @param {object} options.image - STAC API item
219
219
  * @param {object} options.terrain - GeoTIFF object from getTerrainGeoTIFF() output
220
+ * @param {number} precision - Precision in meters for "good enough"
220
221
  * @returns {array} Array with world coordinates (indexes 0 and 1) and elevation (index 2). Coordinates are EPSG:25832 format.
221
222
  */
222
223
  async function getWorldXYZ(options, precision = 0.3) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataforsyningen/saul",
3
- "version": "3.2.0",
3
+ "version": "3.3.1",
4
4
  "description": "This is a collection of stand-alone methods for photogrammetry calculations and API interactions for 'Danske Skråfotos'.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -17,14 +17,18 @@
17
17
  "SDFI",
18
18
  "saul"
19
19
  ],
20
- "author": "Styrelsen for Dataforsyning og Infrastruktur (https://sdfi.dk/)",
20
+ "author": {
21
+ "name": "Styrelsen for Dataforsyning og Infrastruktur",
22
+ "email": "support@sdfi.dk",
23
+ "url": "https://sdfi.dk/"
24
+ },
21
25
  "license": "MIT",
22
26
  "bugs": {
23
27
  "url": "https://github.com/SDFIdk/saul/issues"
24
28
  },
25
29
  "homepage": "https://github.com/SDFIdk/saul#readme",
26
30
  "devDependencies": {
27
- "jsdoc": "^3.6.10"
31
+ "jsdoc": "^4.0.2"
28
32
  },
29
33
  "dependencies": {
30
34
  "geotiff": "^2.0.5",
@@ -1,7 +1,6 @@
1
- // You should add your own config.js with proper tokens, passwords, etc.
1
+ // You should add your own config.js with proper tokens, etc.
2
2
  // Check config.js.example for info on how to set it up
3
3
  import auth from '../config.js'
4
- import assert from 'assert'
5
4
  import { getSTAC, getTerrainGeoTIFF,getZ, getWorldXYZ, getImageXY } from '../index.js'
6
5
 
7
6
 
@@ -1,6 +1,6 @@
1
1
  // Testing saul-core methods
2
2
 
3
- // You should add your own config.js with proper tokens, passwords, etc.
3
+ // You should add your own config.js with proper tokens, etc.
4
4
  // Check config.js.example for info on how to set it up
5
5
  import auth from '../config.js'
6
6
 
@@ -1,4 +1,4 @@
1
- // You should add your own config.js with proper tokens, passwords, etc.
1
+ // You should add your own config.js with proper tokens, etc.
2
2
  // Check config.js.example for info on how to set it up
3
3
  import auth from '../config.js'
4
4