小编Hou*_*daF的帖子

类型“(err:any,data:any)=> void”与类型“RequestInit”没有共同的属性

我按照这个示例https://www.mapbox.com/mapbox-gl-js/example/timeline-animation/创建基于时间的可视化。我正在使用这个版本“d3”:“^5.4.0”代码是:

d3.json('http://127.0.0.1:5000', function (err, data) {
        if (err) throw err;

        // Create a month property value based on time
        // used to filter against.
        data.features = data.features.map(function (d) {
          d.properties.month = new Date(d.properties.time).getMonth();
          return d;
        });

        map.addSource('visits', {
          'type': 'geojson',
          'data': data
        });

        map.addLayer({
          'id': 'visits-circles',
          'type': 'circle',
          'source': 'visits',
          'paint': {
            'circle-color': [
              'interpolate',
              ['linear'],
              ['get', 'name'],
              6, '#FCA107',
              8, '#7F3121'
            ],
            'circle-opacity': 0.75,
            'circle-radius': [
              'interpolate',
              ['linear'],
              ['get', 'name'],
              6, 20,
              8, 40
            ]
          }
        }); …
Run Code Online (Sandbox Code Playgroud)

mapbox typescript angular

6
推荐指数
1
解决办法
1万
查看次数

AttributeError: 'str' 对象没有属性 'Substr'

我正在编写一个 python 脚本来将数据从 csv 转换为 geojson,这是有效的。我有一个日期格式的字段(“2017-07-14 17:01:00”),但是对于这些数据,我只需要小时部分(仅 17),所以我试图将其子串化以仅获取该部分,我添加了该功能:

def substr(strtime):
    strtime = strtime.Substr(strtime, 0, 3)
    return substr(strtime)
Run Code Online (Sandbox Code Playgroud)

我得到了那个错误测量 AttributeError: 'str' object has no attribute 'Substr'

有没有人知道如何解决它?

python

2
推荐指数
1
解决办法
6251
查看次数

标签 统计

angular ×1

mapbox ×1

python ×1

typescript ×1