It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center。
7年前关闭。
是否有人使用过kartograph.js和'kartograph.py'库?
你知道我是否需要'kartograph.py'才能运行吗?如何在不安装python的情况下使用'kartograph.py'库?因为在“ kartograph.js”中构建“ BBOX”时遇到“ kartograph.js”问题
kartograph.js中的错误:
谢谢您的帮助
HTML页面。错误在我生成$ K.map时出现
7年前关闭。
是否有人使用过kartograph.js和'kartograph.py'库?
你知道我是否需要'kartograph.py'才能运行吗?如何在不安装python的情况下使用'kartograph.py'库?因为在“ kartograph.js”中构建“ BBOX”时遇到“ kartograph.js”问题
kartograph.js中的错误:
....
if (height === 0) height = width * .5;
alert(width);
me.viewport = new kartograph.BBox(0, 0, width, height);
**Uncaught TypeError: undefined is not a function**
me.paper = me.createSVGLayer();
me.markers = [];
me.pathById = {};
me.container.addClass('kartograph');
}
....
谢谢您的帮助
HTML页面。错误在我生成$ K.map时出现
<html lang="en">
<head>
<meta charset="utf-8" />
<title>GEOFRANCE</title>
<link href="/Styles/Site.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/script/js/script.min.js"></script>
$script(['/script/js/jquery.min.js','/script/js/raphael.min.js', '/script/js/kartograph.js', '/script/js/chroma.min.js'], 'kartograph');
$script(['/script/js/jquery.qtip.min.js'], 'qtip');
</head>
<body>
<div id="main">
<link rel="stylesheet" type="text/css" href="/Styles/jquery.qtip.css">
<script type="text/javascript">
$script.ready(['kartograph', 'qtip'], function () {
$(function () {
var map,
colorscale,
dep_data = {},
w = $('#map').parent().width();
$.fn.qtip.defaults.style.classes = 'ui-tooltip-bootstrap';
$.fn.qtip.defaults.style.def = false;
$.ajax({
url: 'departments.json',
dataType: 'json',
success: function (data) {
alert("test : " + w);
$.each(data, function (i, r) {
dep_data[r.id] = r;
})
map = $K.map('#map', w, w);
alert("test2 : " +w);
map.loadMap('france-departments.svg', function () {
map.addLayer('departments', {
titles: function (d) { return d.id },
styles: {
stroke: '0.5px'
},
tooltips: function (d) {
return [d.name, dep_data[d.id].density + '/km<sup>2</sup>'];
}
});
updateMap();
});
}
});
/*
* update map colors
*/
function updateMap() {
var prop = 'density', // $('.measure.btn-custom').data('value'),
scale = 'quantiles', // $('.scale.btn-custom').data('value'),
colors = $('#colors').get(0).value;
colorscale = new chroma.ColorScale({
colors: chroma.brewer[colors],
limits: chroma.limits(dep_data, scale, 7, prop)
});
map.getLayer('departments').style({
fill: function (d) {
return colorscale.getColor(dep_data[d.id][prop]);
}
});
}
// init user interface
$('.btn').click(function (event) {
var tgt = $(event.target), par = tgt.parent();
$('.btn', par).removeClass('btn-custom');
tgt.addClass('btn-custom');
updateMap();
});
$('#colors').change(updateMap);
$('#colors').keyup(updateMap);
});
});
</script>
<div id="map">
</div>
</div>
</body>
</html>
最佳答案
您需要生成要与kartograph.py一起使用的地图,因此这可以直接回答您的下一个问题,是的,您需要安装Python才能使用它。没有Python解释器,您将无法运行用Python编写的内容。
我不太确定您从哪里读到了有关BBox方法的信息,但是文档说的却有些不同:http://kartograph.org/docs/kartograph.js/
09-30 22:04