切罗普思地图未显示我想要的

时间:2019-01-29 05:26:41

标签: python json numpy folium

function __construct()
{
    parent::__construct();
    $this->load->model('user');//sql querys to store data
    if(!$this->session->userdata('aId') && $this->router->class != 'Login')
    {
        redirect('Login/index');
    }else if($this->session->userdata('aId') && $this->router->class =='Login' && $this->router->method!='shutdown')
    {

        redirect('user/index');
    }
}

我得到这样的图像: enter image description here

但是我需要有这样的图像: enter image description here

1 个答案:

答案 0 :(得分:1)

问题出在key_on='feature.properties.name'

应为key_on='feature.properties.DISTRICT'

查看JSON文件,查看纬度/经度坐标所映射到的位置。 在世界地图示例中,在其JSON文件中为“名称”,而在旧金山为“ DISCTRICT”

# download countries geojson file
!wget --quiet https://cocl.us/sanfran_geojson -O san_francisco_nh.json

print('GeoJSON file downloaded!')

sf_geo = r'san_francisco_nh.json'

sanfran_map.choropleth(
    geo_data=sf_geo,
    data=nh_countindex,
    columns=['Neighborhood','Count'],
    key_on='feature.properties.DISTRICT',
    fill_color='YlOrRd',
    fill_opacity=0.7,
    line_opacity=0.2,
    legend_name="Neighborhood Crime"
)

sanfran_map

http://docs.celeryproject.org/en/latest/tutorials/task-cookbook.html#ensuring-a-task-is-only-executed-one-at-a-time