0

I have been trying to use a custom shape map in Power BI and I can not get it to work. The idea behind all this is to start from a .shp file, .dbf file and a .prj file and export it to a TopoJson file that actually works in Power BI in order to show the difference between County through color saturation.

I have been using the https://mapshaper.org site in order to do this.

This are the files that I have started from:

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

This is what I would like it to work in Power BI with:

Map Shaper .shp file without .dbf file

I found this information that may have helped me if I could understand it

Power BI. Using custom map as base map

https://moriartynaps.org/

2 Answers2

0

From using mapshaper you should be left with a topojson file, this json file I'm going to assume you have already imported into Power BI in the shape map visual.

Within the topojson file, each of the individual sections of that map "should" be assigned an ID or identifier. So view the json file in a text/scripting editor to identify these.

Import your dataset into Power BI and then you will need to map each of the datavalues to the identifier. Obviously, how you do this is up to you...You could write a huge "if/else" dax formula if you wanted to, but the key thing is that each row of imported data has another column with an equivalent ID for the json file.

sirdoug9
  • 94
  • 5
0

You can get the shape map keys directly from json file. Here is an example: 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
Przemyslaw Remin
  • 6,276
  • 25
  • 113
  • 191