Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
BBIUser
Helper IV
Helper IV

Shape Map in Power BI: Can I use Shapefile (TopoJSON) file as my data source?

Hi,

 

I am aware how the maps are built using shape maps but my question here is -

 

For example: I use a Shapefile to create maps and I have converted that Shapefile to TopoJSON file using mapshaper.org, Is it possible to use this TopoJSON file as a source in Power BI Desktop? Is this possible in Power BI? Is it the correct way to do it?

 

Why do we need a source file (such as Excel, CSV, SQL, etc..) on top of the TopoJSON file since the TopoJSON file itself has data in it?

 

Please apologize me if the questions are not sensible, I am trying to understand how this process works?

 

Thanks in advance.

 

 

 

1 ACCEPTED SOLUTION
deldersveld
Resident Rockstar
Resident Rockstar

The TopoJSON used for the Shape Map visual is not part of the data model. It's unique to the visual and meant to map data in the data model to shapes on the map. *Why* the product team chose to do it that way is not something I can answer. 

 

You can grab the data from the TopoJSON file using the JSON connector in Power BI Desktop, then expand through a series of columns to get the data. I have a sample M script from another post where I answered a similar question: 

let
    Source = Json.Document(File.Contents("C:\[...]\icitw_wgs84.json")),
    objects = Source[objects],
    icitw_wgs1 = objects[icitw_wgs84],
    geometries = icitw_wgs1[geometries],
    #"Converted to Table" = Table.FromList(geometries, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"arcs", "type", "properties"}, {"Column1.arcs", "Column1.type", "Column1.properties"}),
    #"Expanded Column1.properties" = Table.ExpandRecordColumn(#"Expanded Column1", "Column1.properties", {"GEO_ID", "CREATE_ID", "NAME", "SCODE_NAME", "LCODE_NAME", "TYPE_DESC", "TYPE_CODE", "OBJECTID", "SHAPE_AREA", "SHAPE_LEN"}, {"Column1.properties.GEO_ID", "Column1.properties.CREATE_ID", "Column1.properties.NAME", "Column1.properties.SCODE_NAME", "Column1.properties.LCODE_NAME", "Column1.properties.TYPE_DESC", "Column1.properties.TYPE_CODE", "Column1.properties.OBJECTID", "Column1.properties.SHAPE_AREA", "Column1.properties.SHAPE_LEN"}),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Column1.properties",{"Column1.arcs", "Column1.type", "Column1.properties.GEO_ID", "Column1.properties.CREATE_ID"}),
    #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Column1.properties.NAME", "Ward Name"}, {"Column1.properties.SCODE_NAME", "SCODE NAME"}, {"Column1.properties.LCODE_NAME", "LCODE NAME"}, {"Column1.properties.TYPE_DESC", "TYPE CODE"}}),
    #"Removed Columns1" = Table.RemoveColumns(#"Renamed Columns",{"TYPE CODE", "Column1.properties.TYPE_CODE", "Column1.properties.SHAPE_AREA", "Column1.properties.SHAPE_LEN"}),
    #"Renamed Columns1" = Table.RenameColumns(#"Removed Columns1",{{"Column1.properties.OBJECTID", "Object ID"}})
in
    #"Renamed Columns1 

 

View solution in original post

2 REPLIES 2
deldersveld
Resident Rockstar
Resident Rockstar

The TopoJSON used for the Shape Map visual is not part of the data model. It's unique to the visual and meant to map data in the data model to shapes on the map. *Why* the product team chose to do it that way is not something I can answer. 

 

You can grab the data from the TopoJSON file using the JSON connector in Power BI Desktop, then expand through a series of columns to get the data. I have a sample M script from another post where I answered a similar question: 

let
    Source = Json.Document(File.Contents("C:\[...]\icitw_wgs84.json")),
    objects = Source[objects],
    icitw_wgs1 = objects[icitw_wgs84],
    geometries = icitw_wgs1[geometries],
    #"Converted to Table" = Table.FromList(geometries, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"arcs", "type", "properties"}, {"Column1.arcs", "Column1.type", "Column1.properties"}),
    #"Expanded Column1.properties" = Table.ExpandRecordColumn(#"Expanded Column1", "Column1.properties", {"GEO_ID", "CREATE_ID", "NAME", "SCODE_NAME", "LCODE_NAME", "TYPE_DESC", "TYPE_CODE", "OBJECTID", "SHAPE_AREA", "SHAPE_LEN"}, {"Column1.properties.GEO_ID", "Column1.properties.CREATE_ID", "Column1.properties.NAME", "Column1.properties.SCODE_NAME", "Column1.properties.LCODE_NAME", "Column1.properties.TYPE_DESC", "Column1.properties.TYPE_CODE", "Column1.properties.OBJECTID", "Column1.properties.SHAPE_AREA", "Column1.properties.SHAPE_LEN"}),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Column1.properties",{"Column1.arcs", "Column1.type", "Column1.properties.GEO_ID", "Column1.properties.CREATE_ID"}),
    #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Column1.properties.NAME", "Ward Name"}, {"Column1.properties.SCODE_NAME", "SCODE NAME"}, {"Column1.properties.LCODE_NAME", "LCODE NAME"}, {"Column1.properties.TYPE_DESC", "TYPE CODE"}}),
    #"Removed Columns1" = Table.RemoveColumns(#"Renamed Columns",{"TYPE CODE", "Column1.properties.TYPE_CODE", "Column1.properties.SHAPE_AREA", "Column1.properties.SHAPE_LEN"}),
    #"Renamed Columns1" = Table.RenameColumns(#"Removed Columns1",{{"Column1.properties.OBJECTID", "Object ID"}})
in
    #"Renamed Columns1 

 

Thank You. Much appreciate your response.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors