Widget:PlaceNamesNavigationMapEnglish: Difference between revisions
From International Robin Hood Bibliography
mNo edit summary |
mNo edit summary |
||
Line 268: | Line 268: | ||
var mp = get(m.curMap); | var mp = get(m.curMap); | ||
var width = 496, height = 550; | var width = 496, height = 550; | ||
var projection = d3.geo.conicEqualArea().scale(5165.269352442655).center([-1.4602454263940616,52.55675714793008]).parallels([49.95898294542323,55.81107189358492]).rotate([1.4602454263940616]).translate([202.798519176517,306.70813464248357]); | var projection = d3.geo.conicEqualArea() | ||
.scale(5165.269352442655).center([-1.4602454263940616,52.55675714793008]) | |||
.parallels([49.95898294542323,55.81107189358492]).rotate([1.4602454263940616]) | |||
.translate([202.798519176517,306.70813464248357]); | |||
var path = d3.geo.path().projection(projection); | var path = d3.geo.path().projection(projection); | ||
var svg = d3.select("div#" + m.curMap).append("svg").attr("width", width).attr("height", height); | var svg = d3.select("div#" + m.curMap).append("svg").attr("width", width) | ||
.attr("height", height); | |||
if (mp.childNodes.length > 1) { | if (mp.childNodes.length > 1) { | ||
mp.firstChild.nextSibling.style.display = "none"; | mp.firstChild.nextSibling.style.display = "none"; | ||
Line 278: | Line 282: | ||
d3.json("/wiki/geo/england/country/England.json",function(error,geodata) { | d3.json("/wiki/geo/england/country/England.json",function(error,geodata) { | ||
if (!error) { | if (!error) { | ||
features.selectAll("path").data(geodata.features).enter().append("path").attr("d",path).on("mouseover",showTooltip).on("mousemove",moveTooltip).on("mouseout",hideTooltip).on("click",clicked); | features.selectAll("path").data(geodata.features).enter().append("path") | ||
.attr("d",path).on("mouseover",showTooltip).on("mousemove",moveTooltip) | |||
.on("mouseout",hideTooltip).on("click",clicked); | |||
if (m.curMap === "navMap" || m.curMap === "choroMap") { | if (m.curMap === "navMap" || m.curMap === "choroMap") { | ||
w.choro.choropleth(); | w.choro.choropleth(); | ||
Line 292: | Line 298: | ||
}); | }); | ||
tooltipOffset = {x: 5, y: -25}; | tooltipOffset = {x: 5, y: -25}; | ||
console.log(window); | |||
} | } | ||
m.initMap = function() { | m.initMap = function() { | ||
d.calcStats(); | d.calcStats(); | ||
}; | }; | ||
Line 313: | Line 319: | ||
function clicked(d, i) { | function clicked(d, i) { | ||
location.href = encodeURIComponent(d.properties.name) + " place-names"; | location.href = encodeURIComponent(d.properties.name) + " place-names"; | ||
} | } | ||
Revision as of 19:44, 22 May 2019
This widget displays the navigation map on country and administrative division landing pages in the place-names section of IRHB. It takes no parameters.