test_make_geojson.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:Visualflee 作者: cspgdds 项目源码 文件源码
def test_make_gj_points():
    index = pandas.date_range('2015-3-1', periods=100)
    popn = pandas.Series([n * 500 for n in range(100)], index=index)
    loctype = pandas.Series((['city'] * 50) + (['conflict'] * 50), index=index)
    timeseries = pandas.DataFrame({'loctype': loctype, 'population': popn})

    res = make_geojson.make_gj_points((52.0, 0.0), 'Examplecamp', timeseries)

    assert len(res) == 100
    assert res[0]['type'] == 'Feature'
    assert res[0]['properties']['start'] == '2015-03-01'
    assert res[0]['properties']['end'] == '2015-03-02'
    assert res[0]['properties']['loctype'] == 'city'
    assert res[0]['geometry']['coordinates'] == (0.0, 52.0)

    assert res[50]['properties']['loctype'] == 'conflict'
    assert res[50]['properties']['start'] == '2015-04-20'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号