Skip to content

Commit

Permalink
Rename MapML <layer-> to <map-layer>
Browse files Browse the repository at this point in the history
  • Loading branch information
prushforth committed Oct 21, 2024
1 parent 59dba01 commit e903384
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 31 deletions.
8 changes: 4 additions & 4 deletions schema/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ evolve as the concept of MapML evolves.
mapml.rnc (a [RelaxNG](http://www.relaxng.org/compact-tutorial-20030326.html) compact syntax schema)
and mapml.sch (post-schema validation MapML schematron rules) are intended to be
applied in that order, to validate a "stand-alone" MapML document. Such a document
would be loaded into an HTML document by the <layer-> custom element, via a URL
reference in the src attribute: `<layer- src="URL to MapML document goes here"></layer->`.
would be loaded into an HTML document by the <map-layer> custom element, via a URL
reference in the src attribute: `<map-layer src="URL to MapML document goes here"></map-layer>`.

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

I couldn't get a version of an rnc schema for xhtml to work, so I have to be satisfied
with validating a document that contains only a `<mapml-viewer>` element, with the
Expand Down
2 changes: 1 addition & 1 deletion schema/mapml-document.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- validate with mapml.rnc, then mapml.sch. Use via <layer- src="..."> attribute -->
<!-- validate with mapml.rnc, then mapml.sch. Use via <map-layer src="..."> attribute -->
<mapml- xmlns="http://www.w3.org/1999/xhtml">
<map-head>
<map-title>Canada Base Map - Geometry</map-title>
Expand Down
6 changes: 3 additions & 3 deletions schema/mapml-viewer.rnc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes"
default namespace = "http://www.w3.org/1999/xhtml"
start = mapml-viewer
mapml-viewer = element mapml-viewer { layer-*,
mapml-viewer = element mapml-viewer { map-layer*,
attribute lat {text},
attribute lon {text},
attribute zoom {text},
Expand All @@ -12,10 +12,10 @@ mapml-viewer = element mapml-viewer { layer-*,
attribute width {text}?,
attribute static {text}?,
map-caption?,
layer-*
map-layer*
}
map-caption = element map-caption { text }
layer- = element layer- {
map-layer = element map-layer {
attribute src { xsd:anyURI }?,
attribute label {text}?,
attribute checked {text}?,
Expand Down
10 changes: 5 additions & 5 deletions schema/mapml-viewer.sch
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
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">
<sch:ns uri="http://www.w3.org/1999/xhtml" prefix="h"/>
<sch:pattern>
<sch:rule context="h:layer-">
<sch:assert test="local-name(parent::*) eq 'mapml-viewer'">The layer- element must be a child of the mapml-viewer element</sch:assert>
<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>
<sch:rule context="h:map-layer">
<sch:assert test="local-name(parent::*) eq 'mapml-viewer'">The map-layer element must be a child of the mapml-viewer element</sch:assert>
<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>
</sch:rule>
<sch:rule context="h:layer-[child::h:map-title]/@label">
<sch:rule context="h:map-layer[child::h:map-title]/@label">
<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>
</sch:rule>
<sch:rule context="h:layer">
<sch:assert test="false()">The layer- element MUST have a trailing hyphen: layer-</sch:assert>
<sch:assert test="false()">The map-layer element MUST have a trailing hyphen: map-layer</sch:assert>
</sch:rule>
</sch:pattern>
<sch:pattern>
Expand Down
8 changes: 4 additions & 4 deletions schema/mapml-viewer.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
custom element that goes in the <body> element of an HTML document -->
<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">
<map-caption>A pleasing map of Canada</map-caption>
<layer- src=""></layer->
<layer- label="CBMT" src="https://geogratis.gc.ca/mapml/en/cbmtile/cbmt/" checked="foo"></layer->
<layer- label="Hat Guy" checked="foo">
<map-layer src=""></map-layer>
<map-layer label="CBMT" src="https://geogratis.gc.ca/mapml/en/cbmtile/cbmt/" checked="foo"></map-layer>
<map-layer label="Hat Guy" checked="foo">
<map-meta name="foo" content="CBMTILE"></map-meta>
<map-feature id="twohats" zoom="15" class="twohats">
<map-properties>
Expand Down Expand Up @@ -55,5 +55,5 @@ custom element that goes in the <body> element of an HTML document -->
</map-point>
</map-geometry>
</map-feature>
</layer->
</map-layer>
</mapml-viewer>
4 changes: 2 additions & 2 deletions spec/examples/cbmt.mapml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<map-title>Canada Base Map - Transportation</map-title>
<map-meta charset="utf-8" ></map-meta>
<map-meta content="text/mapml" http-equiv="Content-Type" ></map-meta>
<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>
<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>
</map-head>
<map-body>
<map-extent units="CBMTILE" checked="">
<map-input name="z" type="zoom" value="17" min="0" max="17"></map-input>
<map-input name="y" type="location" units="tilematrix" axis="row" min="29750" max="34475"></map-input>
<map-input name="x" type="location" units="tilematrix" axis="column" min="26484" max="32463"></map-input>
<map-link rel="tile" tref="https://geoappext.nrcan.gc.ca/arcgis/rest/services/BaseMaps/CBMT3978/MapServer/tile/{z}/{y}/{x}?m4h=t"></map-link>
<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>
</map-extent>
</map-body>
</mapml->
Expand Down
12 changes: 6 additions & 6 deletions spec/examples/map-1.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Authoring example 1</title>
<script type="module" src="https://maps4html.org/web-map-doc/dist/mapml-viewer.js" crossorigin></script>
<script type="module" src="https://unpkg.com/@maps4html/mapml@latest/dist/mapml.js" crossorigin></script>
<link rel="preconnect" href="https://geogratis.gc.ca" crossorigin>
<style>
html {
Expand All @@ -20,23 +20,23 @@
height: 150px;
max-width: 100%;
}
/* Pre-style to avoid FOUC of inline layer- and fallback content. */
/* Pre-style to avoid FOUC of inline map-layer and fallback content. */
mapml-viewer:not(:defined) > * {
display: none;
}
/* Ensure inline layer content is hidden if custom elements isn't supported,
or if javascript is disabled. This needs to be defined separately from the above,
because the `:not(:defined)` selector invalidates the entire declaration
in browsers that do not support it. */
layer- {
map-layer {
display: none;
}
</style>
<noscript>
<style>
/* Ensure fallback content (children of the map element) is displayed if
custom elements is supported but javascript is disabled. */
mapml-viewer:not(:defined) > :not(layer-) {
mapml-viewer:not(:defined) > :not(map-layer) {
display: initial;
}
</style>
Expand All @@ -45,15 +45,15 @@
<body>
<mapml-viewer projection="OSMTILE" zoom="11" lat="48.8566" lon="2.3522">
<map-caption>Paris, the City of Lights</map-caption>
<layer- label="OpenStreetMap" checked>
<map-layer label="OpenStreetMap" checked>
<link rel="license" title="© OpenStreetMap contributors CC BY-SA" href="https://www.openstreetmap.org/copyright"></link>
<map-extent units="OSMTILE" checked>
<map-input name="z" type="zoom" value="18" min="0" max="18"></map-input>
<map-input name="x" type="location" units="tilematrix" axis="column" min="0" max="262144" ></map-input>
<map-input name="y" type="location" units="tilematrix" axis="row" min="0" max="262144" ></map-input>
<map-link rel="tile" tref="https://tile.openstreetmap.org/{z}/{x}/{y}.png" ></map-link>
</map-extent>
</layer->
</map-layer>
</mapml-viewer>
</body>
</html>
10 changes: 5 additions & 5 deletions spec/examples/map-2.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Authoring example 2</title>
<script type="module" src="https://maps4html.org/web-map-doc/dist/mapml-viewer.js" crossorigin></script>
<script type="module" src="https://unpkg.com/@maps4html/mapml@latest/dist/mapml.js" crossorigin></script>
<link rel="preconnect" href="https://geogratis.gc.ca" crossorigin>
<style>
html {
Expand All @@ -20,31 +20,31 @@
height: 350px;
max-width: 100%;
}
/* Pre-style to avoid FOUC of inline layer- and fallback content. */
/* Pre-style to avoid FOUC of inline map-layer and fallback content. */
mapml-viewer:not(:defined) > * {
display: none;
}
/* Ensure inline layer content is hidden if custom elements isn't supported,
or if javascript is disabled. This needs to be defined separately from the above,
because the `:not(:defined)` selector invalidates the entire declaration
in browsers that do not support it. */
layer- {
map-layer {
display: none;
}
</style>
<noscript>
<style>
/* Ensure fallback content (children of the map element) is displayed if
custom elements is supported but javascript is disabled. */
mapml-viewer:not(:defined) > :not(layer-) {
mapml-viewer:not(:defined) > :not(map-layer) {
display: initial;
}
</style>
</noscript>
</head>
<body>
<mapml-viewer projection="CBMTILE" zoom="15" lat="45.4215" lon="-75.6972" controls controlslist="geolocation">
<layer- label="Canada Base Map - Transportation (CBMT)" src="cbmt.mapml" checked></layer->
<map-layer label="Canada Base Map - Transportation (CBMT)" src="cbmt.mapml" checked></map-layer>
</mapml-viewer>
</body>
</html>
3 changes: 2 additions & 1 deletion spec/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ <h3>Changes</h3>
<li><time>2023-06-29</time>: Update Authoring section. Include definitions of local and remote content.
<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>.
<li><time>2024-08-21</time>: Rename Web-Map-Custom-Element repo to MapML.js polyfill
<li><time>2024-10-18</time>: Rename &lt;layer-&gt; custom element to &lt;map-layer&gt;
</ol>
</details>
</section>
Expand Down Expand Up @@ -1136,7 +1137,7 @@ <h4>Remote content</h4>
<pre>
&lt;mapml-viewer projection="CBMTILE" zoom="15" lat="45.4215" lon="-75.6972" width="600" height="350" controls controlslist="geolocation"&gt;
&lt;map-caption&gt;A map of downtown Ottawa, Canada&lt;/map-caption&gt;
&lt;layer- label="Canada Base Map - Transportation (CBMT)" src="https://example.com/mapml/cbmt/" checked crossorigin&gt;&lt;/layer-&gt;
&lt;map-layer label="Canada Base Map - Transportation (CBMT)" src="https://example.com/mapml/cbmt/" checked crossorigin&gt;&lt;/map-layer&gt;
&lt;/mapml-viewer&gt;
</pre>
<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>
Expand Down

0 comments on commit e903384

Please sign in to comment.