You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/api/geojson-api.mdx
+12-12
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ The **GeoJSON API** is provided as a library to convert GeoJSON to and from MapM
29
29
30
30
| Function | Returns | Description |
31
31
|----------|---------|-------------|
32
-
|<code>geojson2mapml(\<Object \| String\> json, \<Object\>options)</code> | A MapML `<layer->` element. | Convert a GeoJSON feature or feature collection string or object to MapML `<layer->` containing one or more `<map-feature>` elements.|
32
+
|<code>geojson2mapml(\<Object \| String\> json, \<Object\>options)</code> | A MapML `<map-layer>` element. | Convert a GeoJSON feature or feature collection string or object to MapML `<map-layer>` containing one or more `<map-feature>` elements.|
33
33
34
34
:::tip
35
35
@@ -143,7 +143,7 @@ let output = geojson2mapml(json, {label: "Example 1", projection: "CBMTILE", cap
143
143
<summary>Click to view the output HTMLElement</summary>
@@ -269,7 +269,7 @@ let output = geojson2mapml(json);
269
269
</table>
270
270
</map-properties>
271
271
</map-feature>
272
-
</layer->
272
+
</map-layer>
273
273
```
274
274
275
275
</details>
@@ -280,7 +280,7 @@ let output = geojson2mapml(json);
280
280
281
281
| Function | Returns | Description |
282
282
|----------|---------|-------------|
283
-
| <code>mapml2geojson(\<HTMLLayerElement\> element, \<Object\> options)</code> | A JavaScript (GeoJSON) feature collection object | This function transforms the `<feature>` element children of a `<layer->` element to a GeoJSON FeatureCollection object. You supply [options](#options-1) to control the transformation. This function must be used inside a windows.onload event.
283
+
| <code>mapml2geojson(\<HTMLLayerElement\> element, \<Object\> options)</code> | A JavaScript (GeoJSON) feature collection object | This function transforms the `<feature>` element children of a `<map-layer>` element to a GeoJSON FeatureCollection object. You supply [options](#options-1) to control the transformation. This function must be used inside a windows.onload event.
284
284
285
285
:::caution
286
286
@@ -298,7 +298,7 @@ window.onload = (event) => {
298
298
299
299
| Parameter | Description |
300
300
|------|--------------|
301
-
|\<HTMLLayerElement\> element | A `<layer->` element. |
301
+
|\<HTMLLayerElement\> element | A `<map-layer>` element. |
302
302
|\<Object\> options | You supply parameters via an options object with [predefined option names](#options-1). |
303
303
304
304
### Options
@@ -327,7 +327,7 @@ the layer.
327
327
#### Default options
328
328
An example showcasing default GeoJSON output when no options are provided.
Copy file name to clipboardexpand all lines: docs/api/layer-api.md
+24-24
Original file line number
Diff line number
Diff line change
@@ -19,14 +19,14 @@ The checked property can't be changed if the disabled property is set.
19
19
To set the checked state of a layer to on:
20
20
21
21
```js
22
-
let layer =document.querySelector('layer-');
22
+
let layer =document.querySelector('map-layer');
23
23
layer.checked=true; // valid values are true | false
24
24
```
25
25
26
26
To read the checked state of the layer:
27
27
28
28
```js
29
-
let layer =document.querySelector('layer-');
29
+
let layer =document.querySelector('map-layer');
30
30
let isChecked =layer.checked;
31
31
```
32
32
---
@@ -43,14 +43,14 @@ user interface.
43
43
To set/update whether the layer is "hidden":
44
44
45
45
```js
46
-
let layer =document.querySelector('layer-');
46
+
let layer =document.querySelector('map-layer');
47
47
layer.hidden=true; // valid values are true | false
48
48
```
49
49
50
-
To get the `<layer->`'s hidden value:
50
+
To get the `<map-layer>`'s hidden value:
51
51
52
52
```js
53
-
let layer =document.querySelector('layer-');
53
+
let layer =document.querySelector('map-layer');
54
54
let isHidden =layer.hidden;
55
55
```
56
56
---
@@ -71,20 +71,20 @@ map viewport.
71
71
### label
72
72
`HTMLLayerElement.label` reflects the `label` content attribute, and specifies a
73
73
fallback accessible name for the layer, if the accessible name is not provided
74
-
via a local `<map-title>` element child of the `<layer->` element, or in the
74
+
via a local `<map-title>` element child of the `<map-layer>` element, or in the
75
75
`<map-head>` of a remote MapML document, loaded via the `src` URL value, respectively.
76
76
77
-
To set/update the `<layer->`'s label:
77
+
To set/update the `<map-layer>`'s label:
78
78
79
79
```js
80
-
let layer =document.querySelector('layer-');
80
+
let layer =document.querySelector('map-layer');
81
81
layer.label="New Title";
82
82
```
83
83
84
-
To get the `<layer->`'s label value:
84
+
To get the `<map-layer>`'s label value:
85
85
86
86
```js
87
-
let layer =document.querySelector('layer-');
87
+
let layer =document.querySelector('map-layer');
88
88
let label =layer.label;
89
89
```
90
90
---
@@ -94,34 +94,34 @@ let label = layer.label;
94
94
MapML document for the layer. The src property may be undefined if the layer
95
95
contains inline content. If the src property returns a value, any inline content
96
96
will be ignored.
97
-
To set/update the `<layer->`'s src:
97
+
To set/update the `<map-layer>`'s src:
98
98
99
99
```js
100
-
let layer =document.querySelector('layer-');
100
+
let layer =document.querySelector('map-layer');
101
101
layer.src="https://example.org";
102
102
```
103
103
104
-
To get the `<layer->`'s src value (URL):
104
+
To get the `<map-layer>`'s src value (URL):
105
105
106
106
```js
107
-
let layer =document.querySelector('layer-');
107
+
let layer =document.querySelector('map-layer');
108
108
let url =layer.src;
109
109
```
110
110
---
111
111
### opacity
112
112
`HTMLLayerElement.opacity` provides read/write access to the `opacity` value, and is reflected in the layer control for each layer, under "Opacity".
113
113
114
-
To set/update the `<layer->`'s opacity:
114
+
To set/update the `<map-layer>`'s opacity:
115
115
116
116
```js
117
-
let layer =document.querySelector('layer-');
117
+
let layer =document.querySelector('map-layer');
118
118
layer.opacity=0.5; // valid values from 0 to 1
119
119
```
120
120
121
-
To get the `<layer->`'s opacity value:
121
+
To get the `<map-layer>`'s opacity value:
122
122
123
123
```js
124
-
let layer =document.querySelector('layer-');
124
+
let layer =document.querySelector('map-layer');
125
125
let opacity =layer.opacity;
126
126
```
127
127
@@ -133,7 +133,7 @@ let opacity = layer.opacity;
133
133
zoom level in which the extent fits completely.
134
134
135
135
```js
136
-
let layer =document.querySelector('layer-');
136
+
let layer =document.querySelector('map-layer');
137
137
layer.zoomTo();
138
138
```
139
139
@@ -145,15 +145,15 @@ layer.zoomTo();
145
145
146
146
| Function | Returns | Description |
147
147
|----------|---------|-------------|
148
-
| <code>mapml2geojson(\<Object\> options)</code> | A JavaScript (GeoJSON) feature collection object | This function transforms the `<feature>` element children of a `<layer->` element to a GeoJSON FeatureCollection object. You supply [options](#options) to control the transformation. This function must be used inside a windows.onload event.
148
+
| <code>mapml2geojson(\<Object\> options)</code> | A JavaScript (GeoJSON) feature collection object | This function transforms the `<feature>` element children of a `<map-layer>` element to a GeoJSON FeatureCollection object. You supply [options](#options) to control the transformation. This function must be used inside a windows.onload event.
149
149
150
150
:::caution
151
151
152
152
`mapml2geojson` must be called inside a windows.onload event to work properly. i.e.
153
153
154
154
```js
155
155
window.onload= (event) => {
156
-
let layer =document.querySelector('layer-');
156
+
let layer =document.querySelector('map-layer');
157
157
layer.mapml2geojson();
158
158
};
159
159
```
@@ -202,7 +202,7 @@ so the resulting JSON SHOULD (somehow, tbd) be tagged with the datum in use by t
202
202
#### Default options
203
203
An example showcasing default GeoJSON output when no options are provided.
0 commit comments