msul-gis-middleware 0.0.2 → 0.0.4
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "msul-gis-middleware",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@arcgis/core": "^4.34.8",
|
|
22
22
|
"@arcgis/map-components": "^4.34.9"
|
|
23
23
|
},
|
|
24
|
-
"license": "
|
|
24
|
+
"license": "Apache-2.0",
|
|
25
25
|
"contributors": [
|
|
26
26
|
"Nathan Collins <coll372@msu.edu>",
|
|
27
27
|
"Austin Deneau <ad@msu.edu>",
|
package/src/README.MD
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
### GIS Middleware
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install gis-middleware
|
|
7
|
+
```
|
|
8
|
+
## Usage
|
|
9
|
+
* Import the middleware in your HTML file.
|
|
10
|
+
|
|
11
|
+
```javascript
|
|
12
|
+
|
|
13
|
+
<script src="/path/to/arcgis-middleware.iife.js"></script>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
* Create an instance of the ArcGisMiddleware class.
|
|
17
|
+
The ArcGisMiddleware class expects ArcGIS portal url
|
|
18
|
+
and unique id for the webmap as parameters.
|
|
19
|
+
|
|
20
|
+
```javascript
|
|
21
|
+
const arcGisMiddleware = new ArcGisMiddleware(
|
|
22
|
+
'YOUR_GIS_PORTAL_URL',
|
|
23
|
+
'YOUR_MAP_ID'
|
|
24
|
+
);
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
* Set the building id.
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
arcGisMiddleware.setBuildingById('YOUR_BUILDING_ID');
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
* Set the floor id.
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
arcGisMiddleware.setFloorById('YOUR_FLOOR_ID');
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
* Generate the HTML that displays the map.
|
|
40
|
+
|
|
41
|
+
```javascript
|
|
42
|
+
const result = arcGisMiddleware.generate().element;
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The generated HTML returns a result object.
|
|
46
|
+
The result object contains `element` key and
|
|
47
|
+
an `errors` key. The `element` inside the result
|
|
48
|
+
is either a DOM element representing the map
|
|
49
|
+
or null. The `errors` key is a list of errors, if any,
|
|
50
|
+
or empty.
|
|
51
|
+
|
|
52
|
+
```javascript
|
|
53
|
+
// Access the HTML using
|
|
54
|
+
const element = result.element
|
|
55
|
+
|
|
56
|
+
// Access the errors using
|
|
57
|
+
const errors = result.errors
|
|
58
|
+
|
|
59
|
+
// Append that DOM element to the page, for example, a div with the id of arcgis-result
|
|
60
|
+
document.getElementById('arcgis-result').appendChild(element);
|
|
61
|
+
```
|
package/vite.config.js
CHANGED
/package/{README.md → README.MD}
RENAMED
|
File without changes
|
|
File without changes
|