|
| 1 | +datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes" |
| 2 | +default namespace = "http://www.w3.org/1999/xhtml" |
| 3 | +start = mapml-viewer |
| 4 | +mapml-viewer = element mapml-viewer { layer-*, |
| 5 | + attribute lat {text}, |
| 6 | + attribute lon {text}, |
| 7 | + attribute zoom {text}, |
| 8 | + attribute projection { "OSMTILE" | "CBMTILE" | "APSTILE" | "WGS84" }, |
| 9 | + attribute controls {text}?, |
| 10 | + attribute controlslist { text }?, |
| 11 | + attribute height {text}?, |
| 12 | + attribute width {text}?, |
| 13 | + attribute static {text}?, |
| 14 | + map-caption?, |
| 15 | + layer-* |
| 16 | +} |
| 17 | +map-caption = element map-caption { text } |
| 18 | +layer- = element layer- { |
| 19 | + attribute src { xsd:anyURI }?, |
| 20 | + attribute label {text}?, |
| 21 | + attribute checked {text}?, |
| 22 | + attribute hidden {text}?, |
| 23 | + attribute opacity {text}?, |
| 24 | + (headContent?, bodyContent+) |
| 25 | +}* |
| 26 | +map-link = element map-link { |
| 27 | + attribute href { xsd:anyURI }?, |
| 28 | + # can have a tref (when in extent) or an href (but not both) |
| 29 | + attribute tref { text }?, |
| 30 | + # @rel=alternate + @projection=tcrs-name is proposed as a way of negotiating the tcrs of the service: https://github.com/Maps4HTML/MapML/issues/11 |
| 31 | + attribute rel { text }, |
| 32 | + attribute projection { "OSMTILE" | "CBMTILE" | "APSTILE" | "WGS84" }?, |
| 33 | + attribute title { text }?, |
| 34 | + attribute type { text }?, |
| 35 | + attribute hreflang { text }? |
| 36 | + } |
| 37 | +map-links = map-link* |
| 38 | +headContent = |
| 39 | + element map-base { |
| 40 | + attribute href {text} |
| 41 | + }? & |
| 42 | + element map-meta { |
| 43 | + attribute name {text}?, |
| 44 | + attribute charset {text}?, |
| 45 | + attribute content {text}?, |
| 46 | + attribute http-equiv {text}? |
| 47 | + }* & |
| 48 | + element map-style { text }? & |
| 49 | + element map-title { text }? & |
| 50 | + map-links |
| 51 | +bodyContent = map-extent? & map-links & (map-feature | map-tile | map-image)* |
| 52 | +map-extent = element map-extent { |
| 53 | + attribute units { "OSMTILE" | "CBMTILE" | "APSTILE" | "WGS84" }?, |
| 54 | + (map-inputs* & map-links* & select* & label*)? |
| 55 | +} |
| 56 | +map-inputs = (element map-input { |
| 57 | + attribute name { text }, |
| 58 | + # xmin, ymin, xmax, ymax and projection are deprecated. If you need to transmit a projection, use a hidden input/variable |
| 59 | + # for xmin etc, use a input@type=location with appropriate position, units, axis values. |
| 60 | + attribute type { "zoom" | "hidden" | "location" | "datetime" | "width" | "height" }, |
| 61 | + attribute value { text }?, |
| 62 | + attribute rel { "image" | "tile" | "pixel" }?, |
| 63 | + attribute shard { text }?, |
| 64 | + attribute list { text }?, |
| 65 | + # position tokens are based on /composed from the set of keywords used for CSS object-position, but they are obviously unique tokesn and not combinable otherwise |
| 66 | + # https://developer.mozilla.org/en-US/docs/Web/CSS/object-position |
| 67 | + attribute position { "top-left" | "top-right" | "bottom-left" | "bottom-right" | "center-left" | "center-right" | "top-center" | "bottom-center" | "center" }?, |
| 68 | + attribute axis { "latitude" | "longitude" | "easting" | "northing" | "x" | "y" | "row" | "column" | "i" | "j" }?, |
| 69 | + attribute units {"gcrs" | "pcrs" | "tcrs" | "map" | "tilematrix" | "tile" }?, |
| 70 | + attribute required { xsd:boolean }?, |
| 71 | + attribute min { xsd:double }?, |
| 72 | + attribute max { xsd:double }?, |
| 73 | + attribute step { text }? |
| 74 | +}) |
| 75 | +label = element map-label { |
| 76 | + attribute for { text }, |
| 77 | + text |
| 78 | +} |
| 79 | +select = element map-select { |
| 80 | + attribute id { text }, |
| 81 | + attribute name { text }, |
| 82 | + option+ |
| 83 | +} |
| 84 | +option = element map-option { |
| 85 | + attribute value { text }?, |
| 86 | + attribute label { text }?, |
| 87 | + text |
| 88 | +} |
| 89 | +map-feature = element map-feature { |
| 90 | + attribute id { text }?, |
| 91 | + attribute class { text }?, |
| 92 | + attribute zoom { text }?, |
| 93 | + attribute min { text }?, |
| 94 | + attribute max { text }?, |
| 95 | + (map-geometry? & map-properties? & map-featurecaption?) |
| 96 | +} |
| 97 | +map-tile = element map-tile { |
| 98 | + attribute col { xsd:integer }, |
| 99 | + attribute row { xsd:integer }, |
| 100 | + ImageResourceMetadataAttributes |
| 101 | +} |
| 102 | +bbox = element map-bbox { twoPositions } |
| 103 | +map-image = element map-image { ImageModel } |
| 104 | + |
| 105 | +map-geometry = element map-geometry { |
| 106 | + attribute cs { "gcrs" | "pcrs" | "tcrs" | "map" | "tilematrix" | "tile" }?, |
| 107 | + (GeometryContent | map-a) |
| 108 | + } |
| 109 | +map-properties = element map-properties { PropertyContent } |
| 110 | +map-featurecaption = element map-featurecaption { text? } |
| 111 | + |
| 112 | +ImageResourceMetadataAttributes = |
| 113 | + attribute src { text }, |
| 114 | + imageLocation?, |
| 115 | + imageSize?, |
| 116 | + attribute angle { xsd:double }?, |
| 117 | + attribute type { text }? |
| 118 | +ImageModel = ImageResourceMetadataAttributes |
| 119 | +# allow any property/value via simple elements with allowed text content |
| 120 | +# see https://www.oreilly.com/library/view/xml-pocket-reference/9780596100506/re92.html |
| 121 | +PropertyContent = any_element |
| 122 | +any_element = element * { (attribute * { text } | text | any_element)* } |
| 123 | +any_attribute = attribute * { text } |
| 124 | +imageLocation = attribute x { xsd:double }, attribute y { xsd:double } |
| 125 | +imageSize = attribute width { xsd:integer },attribute height { xsd:integer } |
| 126 | + |
| 127 | +GeometryContent = map-point | map-linestring | map-polygon | map-multipoint | map-multilinestring | map-multipolygon | map-geometrycollection |
| 128 | +map-a = element map-a { |
| 129 | + attribute href { text }, |
| 130 | + attribute target { "_self" | "_top" | "_blank" | "_parent" }?, |
| 131 | + attribute type { "text/mapml" | "text/html" }?, |
| 132 | + (GeometryContent | text | span_element | coordinates_mixed)} |
| 133 | +map-point = element map-point { map-a | coordinates_mixed } |
| 134 | +map-linestring = element map-linestring { map-a | coordinates_mixed } |
| 135 | +map-polygon = element map-polygon { map-a* & coordinates_mixed+ } |
| 136 | +map-multipoint = element map-multipoint { map-a | coordinates_mixed } |
| 137 | +map-multilinestring = element map-multilinestring { map-a* & coordinates_mixed+ } |
| 138 | +map-multipolygon = element map-multipolygon { map-a* & map-polygon+ } |
| 139 | +map-geometrycollection = element map-geometrycollection { |
| 140 | + (map-point* & map-linestring* & map-polygon* & map-multipoint* & map-multilinestring* & map-multipolygon*) |
| 141 | +} |
| 142 | +span_element = element map-span { |
| 143 | + mixed { |
| 144 | + attribute * { text }*& |
| 145 | + span_element* & |
| 146 | + map-a* |
| 147 | + } |
| 148 | + } |
| 149 | +coordinates_mixed = element map-coordinates { mixed { span_element* & map-a* } } |
| 150 | +# for bbox content, omits coordinates element |
| 151 | +twoPositions = list { (xsd:double, xsd:double, xsd:double, xsd:double) } |
| 152 | + |
0 commit comments