xy's blog

Connect the dots

0%

Power BI中的地点/地图可视化 Geocoding Visualization in Power BI

问题:

  1. Power BI中地图位置的数量限制
  2. 数据图层中地点的层次顺序

Case:地点总数较多(30k+,基本超出了Power BI的地点数量限制),分为不同类别,部分类别的点数量较少,且该类别比较重要。在Power BI Map中由于数据点的数量限制,地图会将临近位置点合并,仅显示“representative points”,导致部分重要类别的位置合并(high density sampling)。比较理想的展示是,地图将重要类别的点全部保留,而其他类别的合并。另一种更合理的做法是,先将地点进行合理的聚类,然后再做地点的可视化展示。

Power BI中有个地图相关的可视化图:Map,Azure Map, ArcGIS Map,分别有不同的地点数量限制。

Map Data-Point Limits

Map

Depending on the configuration, a map can have:

  • Location: Top 3,500
  • Location, Size: Top 3,500
  • Location, Latitude, and Longitude aggregates (+/-Size): Top 3,500
  • Latitude, Longitude: see High density scatter
  • Latitude, Longitude, Size: Top 3,500
  • Legend, Latitude, Longitude: see High density scatter
  • Legend, Latitude, Longitude, Size: Top 233 legends, Top 15 latitude and longitude (could use statistics or dynamic limits)
  • Location, Legend, Latitude, and Longitude as aggregates (+/-Size): Top 233 locations, Top 15 legends (could use statistics or dynamic limits)

High density sampling

  • 普通:divide the rows evenly

  • High-density sampling:

“eliminates overlapping points, and ensures that the points on the visual can be reached when interacting with the visual. “

accurate distribution of the data is the goal, and implied visual density is not the goal.”

注意点的分布不一定反映真实密度,因为一个点可能代表多个数据点

算法:设定半径r,每个点的半径r范围内的点合并成一个,逐渐增加r,直到点的总数达到3500

    [Note](https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-high-density-scatter-charts)
   Data points are grouped or selected by the index. Having a legend does not affect sampling for the algorithm, it only affects the ordering of the visual.

   根据index 进行采样,跟legend无关

Dynamic limits
visuals with two hierarchies of grouping columns (axis and legend, or category and series) use one additional strategy called dynamic limits. Dynamic limits are designed to better balance data points.
会从所有类别中选择数据点

Maps: Azure Maps

  • Max points: 30,000
  • Azure Maps中国区不适用……

See High density sampling

ArcGIS for Power BI

位置 标准(包含在 Power BI 内) ArcGIS 组织帐户
位置字段井位中的地址信息 3,500 个位置/地图
10,000 个位置/月
10,000 个位置/地图
1,000,000 个位置/月
相应字段井位中的纬度经度
• Chrome、Safari、Firefox、Microsoft Edge 30,000 30,000
• Microsoft Internet Explorer 11 10,000 10,000
位置字段井位中的标准行政边界
• Chrome、Safari、Firefox、Microsoft Edge 15,000 个面/地图 15,000 个面/地图
• Microsoft Internet Explorer 11 5,000 个面/地图 5,000 个面/地图

Solutions:

ArcGIS Map使用经纬度的时候点的数量限制是30k,因此先用Bing Map API进行地理编码,获得经纬度,然后用ArcGIS Map做可视化

数据图层中点的层次顺序

  • ArcGIS地图可以包含各种图层,但一幅地图只能包含一个数据图层。位置可以显示为点或面。
  • 数据图层上点的层次顺序是由数据顺序决定,所以需要先将数据按照想要的层次排列
  • ArcGIS中可以添加其他辅助图层:人口建筑密度等,比较好用的功能

例子:

希望按照customer, WH, DC顺序层次(customer在底图),跟首字母顺序不一样,加一列辅助layer列123,sort column by the content of another

注意,有时候重新排序后地图不一定立刻更新,可以将category从color字段(ArcGIS Map)/Legend字段 (map)中移除然后再次添加