Map | AIUI | Rokid

map renders a map from MVT vector tiles and can overlay GPX tracks and waypoints.

Map

map renders a map from MVT vector tiles and can overlay GPX tracks and waypoints.

Display a Specific Area

<map
  tile-url="https://tiles.example.com/{z}/{x}/{y}.mvt"
  longitude="116.397"
  latitude="39.908"
  zoom="12"
  style="width: 640px; height: 360px;"
></map>

The tile URL must contain {z}, {x}, and {y} placeholders. The map uses its final layout size, falling back to 300 × 200 when no layout size is available.

Overlay a GPX Track

<map tile-url="https://tiles.example.com/{z}/{x}/{y}.mvt" style="width: 640px; height: 360px;">
  <map-gpx slot="overlays" src="https://example.com/route.gpx" stroke-color="#2563eb" />
</map>

When longitude, latitude, or zoom is omitted, the component fills the missing viewport values from loaded GPX content. map-gpx can also receive inline GPX XML through data.

Properties

PropertyTypeDefaultDescription
tile-urlString""MVT tile template; aliases are url and src.
longitudeNumberAutoCenter longitude clamped to -180 through 180; aliases are lng and center-longitude.
latitudeNumberAutoCenter latitude clamped to the valid Web Mercator range; aliases are lat and center-latitude.
zoomNumberAutoRounded zoom level clamped to 0 through 22.
pitchNumber0Pitch clamped to 0 through 60.
bearingNumber0Rotation angle; alias is rotation.
map-styleJSON StringBuilt inMap colors and stroke sizing; alias is style-json.

map-style supports background, land, water, road, building, boundary, labelPoint, lineWidth, and pointRadius. Map styling is also available through --map-* CSS custom properties.

When no GPX content is available for automatic fitting, omitted center coordinates and zoom fall back to 0.

map-gpx Properties

PropertyTypeDefaultDescription
srcString-GPX file URL; alias is url.
dataString-Inline GPX XML; alias is content, and it takes precedence over src.
visibleBooleantrueWhether to display the overlay.
stroke-colorString#2563ebTrack color.
stroke-widthNumber3Track width with a minimum of 1.
waypoint-colorString#0f172aWaypoint color.
start-colorString#16a34aStart-point color.
end-colorString#dc2626End-point color.
point-radiusNumber4Point radius with a minimum of 2.
label-visibleBooleantrueWhether waypoint labels are visible.
label-colorString#0f172aLabel color.