0

我一直在尝试在 Power BI 中使用自定义形状图,但无法使其正常工作。这一切背后的想法是从 .shp 文件、.dbf 文件和 .prj 文件开始,然后将其导出到在 Power BI 中实际工作的 TopoJson 文件,以便通过颜色饱和度显示 County 之间的差异。

为了做到这一点,我一直在使用https://mapshaper.org网站。

这是我开始的文件:

https://drive.google.com/open?id=17EtWd5YqEV4k5ctuJIFI9JDJIK8joCnG

这就是我希望它在 Power BI 中使用的功能:

没有 .dbf 文件的 Map Shaper .shp 文件

我发现如果我能理解这些信息可能会对我有所帮助

电源 BI。使用自定义地图作为底图

https://moriartynaps.org/

4

2 回答 2

0

从使用 mapshaper 开始,您应该留下一个 topojson 文件,我将假设您已经在形状地图视觉对象中导入到 Power BI 中的这个 json 文件。

在 topojson 文件中,该地图的每个单独部分“应该”分配一个 ID 或标识符。因此,在文本/脚本编辑器中查看 json 文件以识别这些文件。

将数据集导入 Power BI,然后您需要将每个数据值映射到标识符。显然,您如何做到这一点取决于您...如果您愿意,您可以编写一个巨大的“if/else”dax 公式,但关键是导入数据的每一行都有另一列,其 ID 为json 文件。

于 2020-02-18T10:22:49.930 回答
0

您可以直接从 json 文件中获取形状映射键。这是一个例子:NZ.json

let
    Source = Json.Document(File.Contents("C:\NZ.json")),
    #"Converted to Table" = Record.ToTable(Source),
    Value1 = #"Converted to Table"{3}[Value],
    #"Converted to Table1" = Record.ToTable(Value1),
    Value2 = #"Converted to Table1"{0}[Value],
    geometries = Value2[geometries],
    #"Converted to Table2" = Table.FromList(geometries, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table2", "Column1", {"arcs", "type", "properties"}, {"arcs", "type", "properties"}),
    #"Removed Other Columns" = Table.SelectColumns(#"Expanded Column1",{"properties"}),
    ColumnNames = Record.FieldNames(#"Removed Other Columns"[properties]{0}),
    ExpandProperties = Table.ExpandRecordColumn(#"Removed Other Columns", "properties", ColumnNames, ColumnNames)
in 
    ExpandProperties
于 2021-04-27T15:31:40.557 回答