Kartograph - 交互式地图构建库


AGPL
跨平台
Python

软件简介

Kartograph 是个构建交互式地图的简单、轻量级类库。

它包含两个库,一个用Python写的,用于产生漂亮和压缩的SVG地图,另一个是js类库用于前端展示地图用。

示例代码:

// cities is a list of dictionaries such as
cities = [{ city_name: "Berlin", nb_visits: 1496, lon: 13.4, lat: 52.517 }, ...];

// create a scale for radii
var scale = $K.scale.sqrt(cities, 'nb_visits').range([0, 40]);

// add bubbles to the map
map.addSymbols({
    type: $K.Bubble,
    data: cities,
    location: function(city) {
        return [city.lon, city.lat];
    },
    radius: function(city) {
        return scale(city.nb_visits);
    },
    tooltip: function(city) {
        return '<h3>'+city.city_name+'</h3>'+city.nb_visits+' visits';
    },
    sortBy: 'radius desc',
    style: 'fill:#800; stroke: #fff; fill-opacity: 0.5;',
});