Skip to content

Commit e903384

Browse files
committedOct 21, 2024
Rename MapML <layer-> to <map-layer>
1 parent 59dba01 commit e903384

File tree

9 files changed

+32
-31
lines changed

9 files changed

+32
-31
lines changed
 

‎schema/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ evolve as the concept of MapML evolves.
2121
mapml.rnc (a [RelaxNG](http://www.relaxng.org/compact-tutorial-20030326.html) compact syntax schema)
2222
and mapml.sch (post-schema validation MapML schematron rules) are intended to be
2323
applied in that order, to validate a "stand-alone" MapML document. Such a document
24-
would be loaded into an HTML document by the <layer-> custom element, via a URL
25-
reference in the src attribute: `<layer- src="URL to MapML document goes here"></layer->`.
24+
would be loaded into an HTML document by the <map-layer> custom element, via a URL
25+
reference in the src attribute: `<map-layer src="URL to MapML document goes here"></map-layer>`.
2626

2727
Another scenario that is conceptually supported is to have an (X)HTML document that
28-
contains a <mapml-viewer> element that contains one or more <layer-> elements that
28+
contains a <mapml-viewer> element that contains one or more <map-layer> elements that
2929
in turn contain 'inline' MapML content, i.e. MapML vocabulary elements contained
30-
within the <layer-></layer-> begin and end tags.
30+
within the <map-layer></map-layer> begin and end tags.
3131

3232
I couldn't get a version of an rnc schema for xhtml to work, so I have to be satisfied
3333
with validating a document that contains only a `<mapml-viewer>` element, with the

‎schema/mapml-document.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- validate with mapml.rnc, then mapml.sch. Use via <layer- src="..."> attribute -->
1+
<!-- validate with mapml.rnc, then mapml.sch. Use via <map-layer src="..."> attribute -->
22
<mapml- xmlns="http://www.w3.org/1999/xhtml">
33
<map-head>
44
<map-title>Canada Base Map - Geometry</map-title>

‎schema/mapml-viewer.rnc

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes"
22
default namespace = "http://www.w3.org/1999/xhtml"
33
start = mapml-viewer
4-
mapml-viewer = element mapml-viewer { layer-*,
4+
mapml-viewer = element mapml-viewer { map-layer*,
55
attribute lat {text},
66
attribute lon {text},
77
attribute zoom {text},
@@ -12,10 +12,10 @@ mapml-viewer = element mapml-viewer { layer-*,
1212
attribute width {text}?,
1313
attribute static {text}?,
1414
map-caption?,
15-
layer-*
15+
map-layer*
1616
}
1717
map-caption = element map-caption { text }
18-
layer- = element layer- {
18+
map-layer = element map-layer {
1919
attribute src { xsd:anyURI }?,
2020
attribute label {text}?,
2121
attribute checked {text}?,

‎schema/mapml-viewer.sch

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
xmlns:sqf="http://www.schematron-quickfix.com/validator/process" xmlns:xs="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://www.w3.org/1999/xhtml">
44
<sch:ns uri="http://www.w3.org/1999/xhtml" prefix="h"/>
55
<sch:pattern>
6-
<sch:rule context="h:layer-">
7-
<sch:assert test="local-name(parent::*) eq 'mapml-viewer'">The layer- element must be a child of the mapml-viewer element</sch:assert>
8-
<sch:assert test="((exists(@src) and not(exists(./*))) or (not(exists(@src)) and exists(./*)))">The &lt;layer-&gt; element must have either a src attribute or inline content</sch:assert>
6+
<sch:rule context="h:map-layer">
7+
<sch:assert test="local-name(parent::*) eq 'mapml-viewer'">The map-layer element must be a child of the mapml-viewer element</sch:assert>
8+
<sch:assert test="((exists(@src) and not(exists(./*))) or (not(exists(@src)) and exists(./*)))">The &lt;map-layer&gt; element must have either a src attribute or inline content</sch:assert>
99
</sch:rule>
10-
<sch:rule context="h:layer-[child::h:map-title]/@label">
10+
<sch:rule context="h:map-layer[child::h:map-title]/@label">
1111
<sch:assert test="false()">In the case that a label attribute exists and a map-title element is present, the map-title will be preferred.</sch:assert>
1212
</sch:rule>
1313
<sch:rule context="h:layer">
14-
<sch:assert test="false()">The layer- element MUST have a trailing hyphen: layer-</sch:assert>
14+
<sch:assert test="false()">The map-layer element MUST have a trailing hyphen: map-layer</sch:assert>
1515
</sch:rule>
1616
</sch:pattern>
1717
<sch:pattern>

‎schema/mapml-viewer.xhtml

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
custom element that goes in the <body> element of an HTML document -->
33
<mapml-viewer lat="45" lon="180" projection="CBMTILE" zoom="11" controls="controls" height="240" controlslist="nofullscreen geolocation noscale" xmlns="http://www.w3.org/1999/xhtml">
44
<map-caption>A pleasing map of Canada</map-caption>
5-
<layer- src=""></layer->
6-
<layer- label="CBMT" src="https://geogratis.gc.ca/mapml/en/cbmtile/cbmt/" checked="foo"></layer->
7-
<layer- label="Hat Guy" checked="foo">
5+
<map-layer src=""></map-layer>
6+
<map-layer label="CBMT" src="https://geogratis.gc.ca/mapml/en/cbmtile/cbmt/" checked="foo"></map-layer>
7+
<map-layer label="Hat Guy" checked="foo">
88
<map-meta name="foo" content="CBMTILE"></map-meta>
99
<map-feature id="twohats" zoom="15" class="twohats">
1010
<map-properties>
@@ -55,5 +55,5 @@ custom element that goes in the <body> element of an HTML document -->
5555
</map-point>
5656
</map-geometry>
5757
</map-feature>
58-
</layer->
58+
</map-layer>
5959
</mapml-viewer>

‎spec/examples/cbmt.mapml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
<map-title>Canada Base Map - Transportation</map-title>
44
<map-meta charset="utf-8" ></map-meta>
55
<map-meta content="text/mapml" http-equiv="Content-Type" ></map-meta>
6-
<map-link xmlns="http://www.w3.org/1999/xhtml" rel="license" href="https://www.nrcan.gc.ca/earth-sciences/geography/topographic-information/free-data-geogratis/licence/17285" title="Canada Base Map © Natural Resources Canada"></map-link>
6+
<map-link rel="license" href="https://www.nrcan.gc.ca/earth-sciences/geography/topographic-information/free-data-geogratis/licence/17285" title="Canada Base Map © Natural Resources Canada"></map-link>
77
</map-head>
88
<map-body>
99
<map-extent units="CBMTILE" checked="">
1010
<map-input name="z" type="zoom" value="17" min="0" max="17"></map-input>
1111
<map-input name="y" type="location" units="tilematrix" axis="row" min="29750" max="34475"></map-input>
1212
<map-input name="x" type="location" units="tilematrix" axis="column" min="26484" max="32463"></map-input>
13-
<map-link rel="tile" tref="https://geoappext.nrcan.gc.ca/arcgis/rest/services/BaseMaps/CBMT3978/MapServer/tile/{z}/{y}/{x}?m4h=t"></map-link>
13+
<map-link rel="tile" tref="https://maps-cartes.services.geo.ca/server2_serveur2/rest/services/BaseMaps/CBMT3978/MapServer/tile/{z}/{y}/{x}?m4h=t"></map-link>
1414
</map-extent>
1515
</map-body>
1616
</mapml->

‎spec/examples/map-1.html

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1">
66
<title>Authoring example 1</title>
7-
<script type="module" src="https://maps4html.org/web-map-doc/dist/mapml-viewer.js" crossorigin></script>
7+
<script type="module" src="https://unpkg.com/@maps4html/mapml@latest/dist/mapml.js" crossorigin></script>
88
<link rel="preconnect" href="https://geogratis.gc.ca" crossorigin>
99
<style>
1010
html {
@@ -20,23 +20,23 @@
2020
height: 150px;
2121
max-width: 100%;
2222
}
23-
/* Pre-style to avoid FOUC of inline layer- and fallback content. */
23+
/* Pre-style to avoid FOUC of inline map-layer and fallback content. */
2424
mapml-viewer:not(:defined) > * {
2525
display: none;
2626
}
2727
/* Ensure inline layer content is hidden if custom elements isn't supported,
2828
or if javascript is disabled. This needs to be defined separately from the above,
2929
because the `:not(:defined)` selector invalidates the entire declaration
3030
in browsers that do not support it. */
31-
layer- {
31+
map-layer {
3232
display: none;
3333
}
3434
</style>
3535
<noscript>
3636
<style>
3737
/* Ensure fallback content (children of the map element) is displayed if
3838
custom elements is supported but javascript is disabled. */
39-
mapml-viewer:not(:defined) > :not(layer-) {
39+
mapml-viewer:not(:defined) > :not(map-layer) {
4040
display: initial;
4141
}
4242
</style>
@@ -45,15 +45,15 @@
4545
<body>
4646
<mapml-viewer projection="OSMTILE" zoom="11" lat="48.8566" lon="2.3522">
4747
<map-caption>Paris, the City of Lights</map-caption>
48-
<layer- label="OpenStreetMap" checked>
48+
<map-layer label="OpenStreetMap" checked>
4949
<link rel="license" title="© OpenStreetMap contributors CC BY-SA" href="https://www.openstreetmap.org/copyright"></link>
5050
<map-extent units="OSMTILE" checked>
5151
<map-input name="z" type="zoom" value="18" min="0" max="18"></map-input>
5252
<map-input name="x" type="location" units="tilematrix" axis="column" min="0" max="262144" ></map-input>
5353
<map-input name="y" type="location" units="tilematrix" axis="row" min="0" max="262144" ></map-input>
5454
<map-link rel="tile" tref="https://tile.openstreetmap.org/{z}/{x}/{y}.png" ></map-link>
5555
</map-extent>
56-
</layer->
56+
</map-layer>
5757
</mapml-viewer>
5858
</body>
5959
</html>

‎spec/examples/map-2.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1">
66
<title>Authoring example 2</title>
7-
<script type="module" src="https://maps4html.org/web-map-doc/dist/mapml-viewer.js" crossorigin></script>
7+
<script type="module" src="https://unpkg.com/@maps4html/mapml@latest/dist/mapml.js" crossorigin></script>
88
<link rel="preconnect" href="https://geogratis.gc.ca" crossorigin>
99
<style>
1010
html {
@@ -20,31 +20,31 @@
2020
height: 350px;
2121
max-width: 100%;
2222
}
23-
/* Pre-style to avoid FOUC of inline layer- and fallback content. */
23+
/* Pre-style to avoid FOUC of inline map-layer and fallback content. */
2424
mapml-viewer:not(:defined) > * {
2525
display: none;
2626
}
2727
/* Ensure inline layer content is hidden if custom elements isn't supported,
2828
or if javascript is disabled. This needs to be defined separately from the above,
2929
because the `:not(:defined)` selector invalidates the entire declaration
3030
in browsers that do not support it. */
31-
layer- {
31+
map-layer {
3232
display: none;
3333
}
3434
</style>
3535
<noscript>
3636
<style>
3737
/* Ensure fallback content (children of the map element) is displayed if
3838
custom elements is supported but javascript is disabled. */
39-
mapml-viewer:not(:defined) > :not(layer-) {
39+
mapml-viewer:not(:defined) > :not(map-layer) {
4040
display: initial;
4141
}
4242
</style>
4343
</noscript>
4444
</head>
4545
<body>
4646
<mapml-viewer projection="CBMTILE" zoom="15" lat="45.4215" lon="-75.6972" controls controlslist="geolocation">
47-
<layer- label="Canada Base Map - Transportation (CBMT)" src="cbmt.mapml" checked></layer->
47+
<map-layer label="Canada Base Map - Transportation (CBMT)" src="cbmt.mapml" checked></map-layer>
4848
</mapml-viewer>
4949
</body>
5050
</html>

‎spec/index.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ <h3>Changes</h3>
328328
<li><time>2023-06-29</time>: Update Authoring section. Include definitions of local and remote content.
329329
<li><time>2023-11-05</time>: Correct error in contexts in which <code>extent</code> is found. Add opacity attribute to layer. Update editors. Add WebIDL for <code>layer</code> <code>opacity</code>; Add or update <code>extent</code> attributes for <code>label</code>, <code>checked</code>, <code>hidden</code>, <code>opacity</code> and <code>disabled</code>. Update <code>extent</code> content model to add allowed metadata content for <code>zoom</code> and <code>extent</code>.
330330
<li><time>2024-08-21</time>: Rename Web-Map-Custom-Element repo to MapML.js polyfill
331+
<li><time>2024-10-18</time>: Rename &lt;layer-&gt; custom element to &lt;map-layer&gt;
331332
</ol>
332333
</details>
333334
</section>
@@ -1136,7 +1137,7 @@ <h4>Remote content</h4>
11361137
<pre>
11371138
&lt;mapml-viewer projection="CBMTILE" zoom="15" lat="45.4215" lon="-75.6972" width="600" height="350" controls controlslist="geolocation"&gt;
11381139
&lt;map-caption&gt;A map of downtown Ottawa, Canada&lt;/map-caption&gt;
1139-
&lt;layer- label="Canada Base Map - Transportation (CBMT)" src="https://example.com/mapml/cbmt/" checked crossorigin&gt;&lt;/layer-&gt;
1140+
&lt;map-layer label="Canada Base Map - Transportation (CBMT)" src="https://example.com/mapml/cbmt/" checked crossorigin&gt;&lt;/map-layer&gt;
11401141
&lt;/mapml-viewer&gt;
11411142
</pre>
11421143
<p>The document that is found at the <code>src</code> URL above has content MIME media type "text/mapml" and is as follows:</p>

0 commit comments

Comments
 (0)