@masterportal/masterportalapi 2.1.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 (92) hide show
  1. package/.editorconfig +15 -0
  2. package/.eslintignore +6 -0
  3. package/.eslintrc +184 -0
  4. package/.husky/pre-push +4 -0
  5. package/CHANGELOG.md +217 -0
  6. package/License.txt +21 -0
  7. package/README.md +24 -0
  8. package/babel.config.json +6 -0
  9. package/example/README.md +7 -0
  10. package/example/config/localGeoJSON.js +956 -0
  11. package/example/config/portal.json +35 -0
  12. package/example/config/services.json +79 -0
  13. package/example/index.html +27 -0
  14. package/example/index.js +210 -0
  15. package/example/style.scss +59 -0
  16. package/jest.config.js +18 -0
  17. package/jest.setup.js +5 -0
  18. package/jsdoc.json +15 -0
  19. package/package.json +62 -0
  20. package/public/marker.svg +1 -0
  21. package/public/stringMarker.js +5 -0
  22. package/src/crs.js +122 -0
  23. package/src/defaults.js +38 -0
  24. package/src/index.js +30 -0
  25. package/src/layer/geojson/index.js +109 -0
  26. package/src/layer/geojson/style.js +61 -0
  27. package/src/layer/lib.js +32 -0
  28. package/src/layer/oaf.js +207 -0
  29. package/src/layer/terrain.js +72 -0
  30. package/src/layer/tileset.js +71 -0
  31. package/src/layer/vector.js +48 -0
  32. package/src/layer/vectorBase.js +39 -0
  33. package/src/layer/wfs.js +218 -0
  34. package/src/layer/wms.js +185 -0
  35. package/src/lib/coordsToPairs.js +15 -0
  36. package/src/lib/getInitialLayers.js +22 -0
  37. package/src/lib/load3DScript.js +22 -0
  38. package/src/lib/oafUtil.js +22 -0
  39. package/src/lib/setBackgroundImage.js +23 -0
  40. package/src/lib/wfsUtil.js +75 -0
  41. package/src/lib/zoomTo.js +40 -0
  42. package/src/maps/api.js +5 -0
  43. package/src/maps/map.js +35 -0
  44. package/src/maps/mapView.js +54 -0
  45. package/src/maps/ol/olMap.js +124 -0
  46. package/src/maps/olcs/3dUtils/fixedOverlaySynchronizer.js +39 -0
  47. package/src/maps/olcs/3dUtils/wmsRasterSynchronizer.js +348 -0
  48. package/src/maps/olcs/olcsMap.js +212 -0
  49. package/src/rawLayerList.js +88 -0
  50. package/src/searchAddress/gazetteerUrl.js +22 -0
  51. package/src/searchAddress/index.js +13 -0
  52. package/src/searchAddress/parse.js +196 -0
  53. package/src/searchAddress/search.js +184 -0
  54. package/src/searchAddress/searchGazetteer.js +52 -0
  55. package/src/searchAddress/showGeographicIdentifier.js +20 -0
  56. package/src/searchAddress/types.js +17 -0
  57. package/test/.eslintrc +7 -0
  58. package/test/crs.test.js +109 -0
  59. package/test/layer/geojson/index.test.js +133 -0
  60. package/test/layer/geojson/style.test.js +46 -0
  61. package/test/layer/lib.test.js +83 -0
  62. package/test/layer/oaf.test.js +245 -0
  63. package/test/layer/resources/oafFeatures.js +105 -0
  64. package/test/layer/resources/wfsFeatures.js +26 -0
  65. package/test/layer/resources/wfsFilter.js +17 -0
  66. package/test/layer/terrain.test.js +106 -0
  67. package/test/layer/tileset.test.js +116 -0
  68. package/test/layer/vector.test.js +76 -0
  69. package/test/layer/vectorBase.test.js +48 -0
  70. package/test/layer/wfs.test.js +388 -0
  71. package/test/layer/wms.test.js +256 -0
  72. package/test/lib/coordsToPairs.test.js +9 -0
  73. package/test/lib/getInitialLayers.test.js +28 -0
  74. package/test/lib/oafUtil.test.js +24 -0
  75. package/test/lib/setBackgroundImage.test.js +49 -0
  76. package/test/lib/wfsUtil.test.js +28 -0
  77. package/test/lib/zoomTo.test.js +74 -0
  78. package/test/map.test.js +258 -0
  79. package/test/mapView.test.js +59 -0
  80. package/test/rawLayerList.test.js +48 -0
  81. package/test/searchAddress/gazetteerSearchResults/address.js +175 -0
  82. package/test/searchAddress/gazetteerSearchResults/district.js +71 -0
  83. package/test/searchAddress/gazetteerSearchResults/houseNumber.js +32 -0
  84. package/test/searchAddress/gazetteerSearchResults/index.js +19 -0
  85. package/test/searchAddress/gazetteerSearchResults/parcel.js +44 -0
  86. package/test/searchAddress/gazetteerSearchResults/street.js +46 -0
  87. package/test/searchAddress/gazetteerSearchResults/streetKey.js +51 -0
  88. package/test/searchAddress/gazetteerUrl.test.js +22 -0
  89. package/test/searchAddress/parse.test.js +110 -0
  90. package/test/searchAddress/search.test.js +150 -0
  91. package/test/searchAddress/searchGazetteer.test.js +58 -0
  92. package/test/searchAddress/showGeographicIdentifier.test.js +22 -0
package/.editorconfig ADDED
@@ -0,0 +1,15 @@
1
+ # EditorConfig is awesome: http://EditorConfig.org
2
+
3
+ # top-most EditorConfig file
4
+ root = true
5
+
6
+ [*]
7
+ indent_style = space
8
+ indent_size = 4
9
+ end_of_line = crlf
10
+ charset = utf-8
11
+ trim_trailing_whitespace = true
12
+ insert_final_newline = true
13
+
14
+ [*.{json,yaml}]
15
+ indent_size = 2
package/.eslintignore ADDED
@@ -0,0 +1,6 @@
1
+ /node_modules
2
+ /example
3
+ /dist
4
+ /docs
5
+ /.cache
6
+ /coverage
package/.eslintrc ADDED
@@ -0,0 +1,184 @@
1
+ {
2
+ "env": {
3
+ // browser global variables
4
+ "browser": true,
5
+ "node": true,
6
+ "es6": true
7
+ },
8
+ "parserOptions": {
9
+ "ecmaVersion": 2020,
10
+ "sourceType": "module"
11
+ },
12
+ "extends": [
13
+ "eslint:recommended"
14
+ ],
15
+ "rules": {
16
+ "for-direction": "error",
17
+ "getter-return": "error",
18
+ "no-compare-neg-zero": "error",
19
+ "no-cond-assign": ["error", "always"],
20
+ "no-console": ["error", { "allow": ["warn", "error"] }],
21
+ "no-constant-condition": "error",
22
+ "no-debugger": "error",
23
+ "no-dupe-args": "error",
24
+ "no-dupe-keys": "error",
25
+ "no-duplicate-case": "error",
26
+ "no-empty": "error",
27
+ "no-empty-character-class": "error",
28
+ "no-ex-assign": "error",
29
+ "no-extra-boolean-cast": "error",
30
+ "no-extra-parens": ["error", "all", { "nestedBinaryExpressions": false }],
31
+ "no-extra-semi": "error",
32
+ "no-func-assign": "error",
33
+ "no-inner-declarations": "error",
34
+ "no-invalid-regexp": "error",
35
+ "no-irregular-whitespace": "error",
36
+ "no-obj-calls": "error",
37
+ "no-regex-spaces": "error",
38
+ "no-sparse-arrays": "error",
39
+ "no-unexpected-multiline": "error",
40
+ "no-unreachable": "error",
41
+ "no-unsafe-finally": "error",
42
+ "no-unsafe-negation": "error",
43
+ "use-isnan": "error",
44
+ "valid-jsdoc": "error",
45
+ "valid-typeof": "error",
46
+ "accessor-pairs": "error",
47
+ "array-callback-return": "error",
48
+ "block-scoped-var": "error",
49
+ "consistent-return": "error",
50
+ "curly": "error",
51
+ "default-case": "error",
52
+ "dot-notation": "error",
53
+ "eqeqeq": "error",
54
+ "no-alert": "error",
55
+ "no-caller": "error",
56
+ "no-case-declarations": "error",
57
+ "no-div-regex": "error",
58
+ "no-else-return": "error",
59
+ "no-empty-function": "error",
60
+ "no-empty-pattern": "error",
61
+ "no-eq-null": "error",
62
+ "no-eval": "error",
63
+ "no-extra-bind": "error",
64
+ "no-extra-label": "error",
65
+ "no-fallthrough": "error",
66
+ "no-floating-decimal": "error",
67
+ "no-global-assign": "error",
68
+ "no-implicit-coercion": "error",
69
+ "no-implicit-globals": "error",
70
+ "no-implied-eval": "error",
71
+ "no-iterator": "error",
72
+ "no-labels": "error",
73
+ "no-lone-blocks": "error",
74
+ "no-loop-func": "error",
75
+ "no-multi-spaces": "error",
76
+ "no-multi-str": "error",
77
+ "no-new-func": "error",
78
+ "no-new-wrappers": "error",
79
+ "no-octal": "error",
80
+ "no-octal-escape": "error",
81
+ "no-param-reassign": "error",
82
+ "no-proto": "error",
83
+ "no-redeclare": "error",
84
+ "no-restricted-properties": "error",
85
+ "no-return-assign": "error",
86
+ "no-return-await": "error",
87
+ "no-script-url": "error",
88
+ "no-self-assign": "error",
89
+ "no-self-compare": "error",
90
+ "no-sequences": "error",
91
+ "no-throw-literal": "error",
92
+ "no-unmodified-loop-condition": "error",
93
+ "no-unused-expressions": 0,
94
+ "no-unused-labels": "error",
95
+ "no-useless-call": "error",
96
+ "no-useless-concat": "error",
97
+ "no-useless-escape": "error",
98
+ "no-useless-return": "error",
99
+ "no-void": "error",
100
+ "no-with": "error",
101
+ "radix": "error",
102
+ "vars-on-top": "error",
103
+ "yoda": "error",
104
+ "no-delete-var": "error",
105
+ "no-label-var": "error",
106
+ "no-shadow": "error",
107
+ "no-shadow-restricted-names": "error",
108
+ "no-undef": "error",
109
+ "no-undef-init": "error",
110
+ "no-unused-vars": "error",
111
+ "no-use-before-define": "error",
112
+ "callback-return": "error",
113
+ "global-require": "error",
114
+ "handle-callback-err": "error",
115
+ "no-buffer-constructor": "error",
116
+ "no-new-require": "error",
117
+ "no-path-concat": "error",
118
+ "no-process-env": "error",
119
+ "no-process-exit": "error",
120
+ "no-sync": "error",
121
+ "array-bracket-spacing": "error",
122
+ "block-spacing": "error",
123
+ "brace-style": ["error", "stroustrup"],
124
+ "comma-dangle": "error",
125
+ "comma-spacing": "error",
126
+ "comma-style": "error",
127
+ "computed-property-spacing": "error",
128
+ "consistent-this": "error",
129
+ "func-call-spacing": ["error", "never"],
130
+ "func-style": ["error", "declaration"],
131
+ "function-paren-newline": ["error", "never"],
132
+ "implicit-arrow-linebreak": "error",
133
+ "indent": ["error", 4, { "SwitchCase": 1 }],
134
+ "jsx-quotes": "error",
135
+ "key-spacing": "error",
136
+ "keyword-spacing": "error",
137
+ "max-depth": "error",
138
+ "max-nested-callbacks": ["error", 4],
139
+ "max-params": ["warn", 6],
140
+ "max-statements-per-line": "error",
141
+ "new-cap": "error",
142
+ "new-parens": "error",
143
+ "no-array-constructor": "error",
144
+ "no-lonely-if": "error",
145
+ "no-mixed-operators": "error",
146
+ "no-mixed-spaces-and-tabs": "error",
147
+ "no-multiple-empty-lines": ["error", { "max": 2, "maxBOF": 1}],
148
+ "no-nested-ternary": "error",
149
+ "no-new-object": "error",
150
+ "no-tabs": "error",
151
+ "no-trailing-spaces": "error",
152
+ "no-underscore-dangle": "error",
153
+ "no-unneeded-ternary": "error",
154
+ "no-whitespace-before-property": "error",
155
+ "object-curly-spacing": "error",
156
+ "object-property-newline": 0,
157
+ "one-var": "error",
158
+ "one-var-declaration-per-line": "error",
159
+ "quotes": "error",
160
+ "require-jsdoc": 0,
161
+ "semi": "error",
162
+ "semi-spacing": "error",
163
+ "semi-style": "error",
164
+ "space-before-blocks": "error",
165
+ "space-before-function-paren": "error",
166
+ "space-in-parens": "error",
167
+ "space-infix-ops": "error",
168
+ "space-unary-ops": "error",
169
+ "spaced-comment": "error",
170
+ "switch-colon-spacing": "error",
171
+ "wrap-regex": "error",
172
+ "no-useless-computed-key": "error",
173
+ "no-useless-constructor": "error",
174
+ "no-useless-rename": "error",
175
+ "prefer-const": "error",
176
+ "prefer-numeric-literals": "error",
177
+ "prefer-rest-params": "error",
178
+ "padding-line-between-statements": [
179
+ "error",
180
+ {"blankLine": "always", "prev": ["const", "let", "var"], "next": "*"},
181
+ {"blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"]}
182
+ ]
183
+ }
184
+ }
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ npm run prePushHook
package/CHANGELOG.md ADDED
@@ -0,0 +1,217 @@
1
+ # Changelog masterportalAPI
2
+ All important changes in this project are stored in this file.
3
+
4
+ The [Semantic Versioning](https://semver.org/spec/v2.0.0.html) is used.
5
+
6
+ ## Unreleased - in development
7
+ ### Added
8
+
9
+ ### Changed
10
+
11
+ ### Deprecated
12
+
13
+ ### Removed
14
+
15
+ ### Fixed
16
+
17
+ ---
18
+
19
+ ## 2.1.1 - 2022-04-20
20
+
21
+ ### Fixed
22
+ - Allow searchAddress to find street names with a prefix.
23
+
24
+ ---
25
+
26
+ ## 2.1.0 - 2022-04-04
27
+ ### Added
28
+ - Add a new layer type OAf (Open API Features).
29
+
30
+ ### Changed
31
+ - The WMS layer respects crs code at rawlayer. The WMS request now contains the attribute CRS. If not available, projection of the map is used.
32
+ - OAF
33
+ - Changing the OAF attribute "featureType" into "collection"
34
+ - Setting OAF output format only in GeoJSON
35
+ - Removing unnecessary parameters
36
+
37
+ ### Fixed
38
+ - Fix a vulnerability of third party libraries.
39
+
40
+ ---
41
+
42
+ ## 2.0.0 - 2022-03-18
43
+ ### Added
44
+ - 3D functions are added to olcsMap.js.
45
+ - Gazetteer search:
46
+ - Previous gazetteer searches can now be aborted by means of an `AbortController`.
47
+ - Added the possibility to use the `geographicIdentifier` to display the search result.
48
+ - A new layer typ OAF (OGC API features) is implemented and integrated into MaterportalAPI
49
+ - Features as parameter can be parsed as filter
50
+ - A new parameter "doNotLoadInitially" for WFS layer so that for the external filter, the filtering of feature will be first loaded
51
+
52
+ ### Changed
53
+ - Gazetteer search:
54
+ - The search now always returns points as coordinates, since the extent is used for polygons, which is not desired in the rule.
55
+ - For `STREETS`, the point coordinate of the `STREET-AXIS` is now returned.
56
+ - In the `"gazetteerUrl"` attribute the `service`, `request` and `version` URL parameters must now be specified. The default value has been changed from `"https://geodienste.hamburg.de/HH_WFS_GAGES"` to `"https://geodienste.hamburg.de/HH_WFS_GAGES?service=WFS&request=GetFeature&version=2.0.0"`.
57
+ - The following packages have been updated
58
+ - ol: from 6.11.0 to version 6.13.0
59
+ - Changed required node version to `^16.13.2`.
60
+ - Changed required npm version to `^8.1.2`.
61
+
62
+ ### Fixed
63
+ - The createVectorSource function now allows passing features as an argument.
64
+ - Gazetteer search: `strassenname`, `hausnummer` and `hausnummernzusatz ` are now also processed if they are returned by the gazetteer as strings.
65
+
66
+ ---
67
+
68
+ ## 1.10.0 - 2022-02-17
69
+ ### Changed
70
+ - Folder abstraction renamed to maps and moved into src.
71
+ - WFS layer can now be loaded in the versions allowed by `ol`: 1.0.0, 1.1.0 and 2.0.0.
72
+
73
+ ---
74
+
75
+ ## 1.9.0 - 2022-02-10
76
+ ### Added
77
+ - Added 3D tileset-Layer to layers and adapted example.
78
+ - Added 3D terrain-Layer to layers and adapted example.
79
+
80
+ ### Changed
81
+ - The options.beforeLoading function is now only executed once in wfs before loading the features.
82
+
83
+ ---
84
+
85
+ ## 1.8.0 - 2022-01-14
86
+ ### Added
87
+ - An alias is added to the coordinate system. This is required by GeoServer services.
88
+ - Added possibility to add any rawLayer attribute to wms layer request.
89
+ - Added VectorBaseLayer to layers
90
+ - The follow package were added
91
+ - @parcel/transformer-sass version 2.2.0
92
+ - parcel version 2.2.0
93
+ - regenerator-runtime 0.13.9
94
+
95
+ ### Changed
96
+ - The following packages have been updated
97
+ - ol: from 6.9.0 to version 6.11.0
98
+ - @babel/core: from 7.15.0 to version 7.16.7
99
+ - @babel/plugin-transform-modules-commonjs: from 7.15.0 to version 7.16.8
100
+ - jest: from 27.0.6 to version 27.4.0
101
+ - babel.config.js was replaced by babel.config.json. Now it can be watched for changes, and Babel transformations can be cached.
102
+ - The overall script tag needs the attribute type="module" to enable module usage. Look at the index.html in example-folder.
103
+
104
+ ### Removed
105
+ - The follow package were removed
106
+ - @babel/preset-env: because Parcel includes transpilation by default
107
+ - babel-jest
108
+ - babel-polyfill
109
+ - parcel-bundler: replaced by parcel
110
+
111
+ ---
112
+
113
+ ## 1.7.1 - 2022-01-11
114
+ ### Fixed
115
+ - WFS-Layer: the WFS version is taken into account when generating the WFS format.
116
+
117
+ ---
118
+
119
+ ## 1.7.0 - 2021-12-27
120
+ ### Added
121
+ - An alias is added to the coordinate system. This is required by GeoServer services.
122
+ - Added WFS Layer that creates a VectorLayer and a VectorSource. Layer-params and loading-params can be passed as function parameters, options may contain functions to filter and style features. Clustering and WFS-filter are supported.
123
+ - Added possibility to add the parameter TIME to the wms layer request.
124
+ - Examples were extended by WFS-Layer.
125
+
126
+ ### Changed
127
+ - The constructor of createMap in the abstraction layer changed. The order of the parameters (config, settings = {}, mapMode = "2D") changes to (config, mapMode = "2D", settings = {}).
128
+ - abstraction\ol\map.js was renamed to abstraction\ol\olMap.js and abstraction\olcs\map.js was renamed to abstraction\olcs\olcsMap.js
129
+
130
+ ---
131
+
132
+ ## 1.6.1 - 2021-12-07
133
+ ### Changed
134
+ - SessionID from the WMS layer was removed and replaced by the CacheID in order to deal with deegree services.
135
+
136
+ ---
137
+
138
+ ## 1.6.0 - 2021-11-10
139
+ ### Added
140
+ - The library Cesium is loaded on demand to generate a 3D map. Cesium must be provided by the user of this library.
141
+ - A 3D map can be generated. The generation of 2D and 3D maps is controlled by an abstraction layer.
142
+ - The example allows to switch between 2d and 3d map.
143
+ ### Changed
144
+ - OpenLayers package updated from 6.6.1 to 6.9.0
145
+ - The WMS layer has been extended with layerParams and options. The LayerSource now contains a TileGrid if there are resolutions in the options. The source can also contain attributions.
146
+
147
+ ---
148
+
149
+ ## 1.5.0 - 2021-08-16
150
+ ### Added
151
+ - The engine for npm version ">= 6.13.4" was added in the package.json
152
+ - The package "@babel/preset-env" version 7.15.0 was added.
153
+ - The package "core-js" version 3.16.1 was added.
154
+ - The package "husky" version 7.0.1 was added. In this case a pre-push hook to run unit tests and eslint before every git push.
155
+
156
+ ### Changed
157
+ - The engine for node was updated to ">= 10.18.0" in the package.json
158
+ - The follow package were updated and in this case the eslint rules and the babel.config were adjusted
159
+ - ol: from 6.5.0 to version 6.6.1
160
+ - proj4: from 2.5.0 to version 2.7.5
161
+ - xml2js: from 0.4.19 to version 0.4.23
162
+ - @babel/core: from 7.1.6 to version 7.15.0
163
+ - @babel/plugin-transform-modules-commonjs: from 7.1.0 to version 7.15.0
164
+ - babel-jest: from 23.6.0 to version 27.0.6
165
+ - canvas: from 2.1.0 to version 2.8.0
166
+ - eslint: from 5.12.0 to version 7.32.0
167
+ - jest-canvas-mock: from 1.1.0 to version 2.3.1
168
+ - jsdoc: from 3.5.5 to version 3.6.7
169
+ - parcel-bundler: from 1.10.3 to version 1.12.5
170
+ - sass: from 1.14.3 to version 1.37.5
171
+
172
+ ### Removed
173
+ - The package "babel-core" was removed.
174
+ - The package "babel-preset-es2015" was removed.
175
+
176
+ ---
177
+
178
+ ## 1.4.0 - 2021-05-27
179
+ ### Changed
180
+ - OpenLayers package from 6.3.1 to 6.5.0
181
+ - Default backgroundImage is changed to ""
182
+
183
+ ---
184
+
185
+ ## 1.3.0 - 2020-05-25
186
+ ### Added
187
+ - New parameters constrainResolution and constrainOnlyCenter to create the map view
188
+
189
+ ---
190
+
191
+ ## 1.2.0 - 2020-05-14
192
+ ### Changed
193
+ - The dependency on the OL package has been updated to version 6:
194
+ - The function getGetFeatureInfoUrl is changed into getFeatureInfoUrl
195
+ - The function ol/source/Vector#clear() is changed into ol/source/Vector#refresh() to re-render a vector layer
196
+
197
+ ### Fixed
198
+ - Loading layer form separat Layer file in unit test
199
+
200
+ ---
201
+
202
+ ## 1.1.0 - 2020-04-14
203
+ ### Added
204
+ - New function to set the start resolution by resolution or zoom level
205
+ - An error handling during initial loading of the LayerList was added
206
+
207
+ ### Changed
208
+ - The function getMapProjection is now available globally
209
+
210
+ ### Fixed
211
+ - Fixes a timeout problem that occurred when initializing the layerList
212
+ - The projections have delivered duplicates, these are now filtered out
213
+
214
+ ---
215
+
216
+ ## 1.0.0 - 2019-07-29
217
+ - Initial implementation.
package/License.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2018-2020 Freie und Hansestadt Hamburg, Landesbetrieb Geoinformation und Vermessung
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # masterportalapi
2
+
3
+ The masterportalAPI is an API to include and show map-content on your webpage. It's based on OpenLayers and extended with functions to easily use configuration and infrastructure files from the masterportal, a feature-rich mapping app developed by geowerkstatt hamburg. It also provides the creation of a 3d map by using olcs and cesium. Check masterportal.org for further information.
4
+
5
+ ## Usage
6
+
7
+ Install the masterportalAPI in your project with ``npm install masterportalapi``. The project does not have a default export, but various named exports. Generate and check the documentation as described below for details.
8
+
9
+ If you want to create a 3d map, you have to provide the peer dependency cesium.
10
+
11
+ By importing the project by module name like ``import ... from "masterportalAPI"``, most bundlers and bundler configurations will include the whole masterportalAPI. If you only need a subset of the provided functions and want to keep your build clean, directly import the needed functions like ``import {createMap} from "masterportalAPI/src/map.js``.
12
+
13
+ ## Scripts
14
+
15
+ |Script|Effect|
16
+ |-|-|
17
+ |``npm run example``|Starts a dev server with a running example. Please mind that the page seen is _not_ part of the masterportalAPI, but merely an environment for manual testing. Change code within ``./example/index.js`` to try things. Free hot reloading thanks to parcel.|
18
+ |``npm run generate-jsdoc``|Generates the project documentation within the folder ``./docs``.|
19
+ |``npm test``|Runs all tests. Prints code coverage to console.|
20
+ |``npm run test:watch``|Runs all tests in watch mode. Good practive to let this run during development in a separate terminal. |
21
+
22
+ ## About Babel
23
+
24
+ The Babel dev dependencies are purely added for development tests and jest tests. Babel is required for testing since Node does not support ES6 in .js files so far.
@@ -0,0 +1,6 @@
1
+ {
2
+ "presets": [],
3
+ "plugins": [
4
+ "@babel/plugin-transform-modules-commonjs"
5
+ ]
6
+ }
@@ -0,0 +1,7 @@
1
+ # Example
2
+
3
+ The files in this folder do _not_ belong to the masterportalAPI, but are here for
4
+ * manual testing during development
5
+ * checking how to use masterportalAPI
6
+
7
+ Files/code in the folder are not supposed to be included in any product.