Actions

Widget

Map: Difference between revisions

From Dragon Eye Atlas

No edit summary
No edit summary
Line 23: Line 23:
<div style="clear:right"></div>
<div style="clear:right"></div>
<div id='map' style='width: <!--{$width|escape:'html'|default:'50%'}-->; height: <!--{$height|escape:'html'|default:'400px'}-->; float:right; margin: 0.5em 0 1em 0.5em; border: 1px solid black'></div>
<div id='map' style='width: <!--{$width|escape:'html'|default:'50%'}-->; height: <!--{$height|escape:'html'|default:'400px'}-->; float:right; margin: 0.5em 0 1em 0.5em; border: 1px solid black'></div>
<div style="width: <!--{$width|escape:'html'|default:'50%'}-->; float:right; text-align:center">
<div style="width: <!--{$width|escape:'html'|default:'50%'}-->; float:right">
Biome: <span id="mapinfo-biome"></span>
<div style="width: 20%">Biome: <span id="mapinfo-biome"></span></div>
Realm: <span id="mapinfo-realm"></span>
<div style="width: 20%">Realm: <span id="mapinfo-realm"></span></div>
Culture: <span id="mapinfo-culture"></span>
<div style="width: 20%">Province: <span id="mapinfo-province"></span></div>
Religion: <span id="mapinfo-religion"></span>
<div style="width: 20%">Culture: <span id="mapinfo-culture"></span></div>
<div style="width: 20%">Religion: <span id="mapinfo-religion"></span></div>
</div>
</div>
<script>
<script>
Line 70: Line 71:
   map.on('mousemove', 'overlay', function(e) {
   map.on('mousemove', 'overlay', function(e) {
       e.features.forEach(function(feature) {
       e.features.forEach(function(feature) {
console.log(feature.properties.class);
         switch (feature.properties.class) {
         switch (feature.properties.class) {
             case 'realm':   $("#mapinfo-realm").html(feature.properties.name); break;
             case 'realm':   $("#mapinfo-realm").html(feature.properties.name); break;
            case 'province': $("#mapinfo-province").html(feature.properties.name); break;
            case 'culture':  $("#mapinfo-culture").html(feature.properties.name); break;
            case 'religion': $("#mapinfo-religion").html(feature.properties.name); break;
         }
         }
       });
       });

Revision as of 16:45, 11 October 2019

Map Widget

Parameters

  • lon, lat, zoom - longitude, latitude and zoom for the map (defaults: 1, 30, 4)
  • width, height - dimensions of the map itself on the page, in px or % (defaults: 50%, 400px)
  • bounds - optional bounds array, replaces lon,lat,zoom
  • show, filter = show must be one of "realm", "culture", "religion" or "province" and filter must be the (short) name of the entity to highlight

Examples

  • {{#widget:Mapbox|bounds=[[0, 25], [8, 31]]}}
  • {{#Widget:Mapbox|lat=31|lon=-15.5|zoom=3}}