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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
js1
New Member

"Unexpected Error" when attempting to load topojson for shape map

In the July version of the 32-bit desktop product, I am attempting to create a map of school districts in my state. I ran a shape file through mapshaper.org (and it rendered correctly on that site) to produce a topojson file. I then imported an Excel file with the school district names and a bunch of other columns (like population). I added the name column to the "Location" bucket, and a population column to the "Saturation" bucket (I also experimented with adding it to the "Legend" bucket, with the same result).

 

When I attempt to load in the map, PowerBI renders a small square image that looks like something Picasso would have drawn, and when I click on it, after a very long delay (on the order of a minute, on this fast desktop machine with 16 gigs of memory), it comes back with "Unexpected Error", and it creates logfiles that I'm not competent to interpret.

 

Again, this shape file renders accurately on the mapshaper site, and it came from a reliable government source, so it seems unlikely to be corrupted.

 

I didn't see a way to upload a file with this message, but I'd be happy to somehow share a file with anyone who might be able to help me debug this situation.

 

Thank you!

Jim

1 ACCEPTED SOLUTION

Thanks for the file link. I was able to replicate the "Picasso" distortion issue, and my initial and final Shape Map views appear below. Hopefully this new topojson file will also rid you of the unexpected error: https://www.dropbox.com/s/0i2s401sipkz6xr/WA-school-districts.json?dl=0

 

Here are a few thoughts on the process when using mapshaper:

  • Import the entire shapefile .zip rather than just the .shp. The shp only has the polygons while the dbf has data, and mapshaper uses both when exporting as topojson that includes the keys required for Power BI. You can test this out using the "i"/Info button in mapshaper and then hovering over a polygon. You should see data when hovering and not a message stating it's missing attribute data.
  • The topojson was initially slow to load in Power BI. I simplified it to 10% with no appreciable distortion and exported to topojson. I've found that's fairly common as well when converting files found online. If it takes more than a few seconds to view the map in Power BI, or it takes a long time to resize it, try simplifying in mapshaper and re-exporting.

 

For many shapefiles found online, the following process will not be required. For the Picasso effect though, the school district file required first importing it into QGIS (or ArcGIS), correcting the projection, and saving it as a new shapefile. Much like Power BI offers Mercator, Ortho, etc., there are hundreds of alternative projections. The new file with the adjusted projection was then imported into mapshaper. I'll have to blog about the process in the near future as you're not the first Power BI user to see the Picasso visual after converting a shapefile and won't be the last.

 

Power BI Shape Map Projection Issue.PNGPower BI Corrected Shape Map.PNG

View solution in original post

7 REPLIES 7

Can you post a link to the original shapefile wherever you obtained it from, or place it on OneDrive/Google Drive/Dropbox, etc? I can take a quick look into it if I can get the original file.

 

The Picasso rendering is likely due to a coordinate reference system in the original that will not work with either the mercator, orthographic, or equirectangular options available in PBI. See this other thread where another user had a similar problem, and the solution involved converting it to a compatible projection using a different tool and then converting it to topojson using mapshaper: http://community.powerbi.com/t5/Desktop/Problem-using-custom-shape-map/m-p/55795

 

For the unexpected error, it is probably an issue due to the combination of a very high resolution shapefile plus a large number of district polygons. You can test this out using the "Simplify" tool in mapshaper. Simplify it to 5% and see if you encounter much of a noticeable difference. Alternatively, just look at the original file size, and if it's more than a few MBs, it's too much detail.

 

 

Thank you for the quick reply!  Maybe the simplest way to transmit the shape file to you is to point you to the original source of the file: http://ofm.wa.gov/pop/geographic/tiger.asp  There is an item in the list called simply "School Districts". If you click on the "GIS shapefile", you'll get a little bundle of files that will include a .shp file (as well as a DBF file with a bunch of columns related to school districts. I brought the DBF file in through ).

 

It is that .shp file that I ran through mapshaper.org. The process ran without incident, and produced a JSON file that is 999 KB in size.

 

I opened the DBF file in Excel, treating it as a dbase file.

 

I hope this is easy for you to deal with, but if you would prefer that I put these files in dropbox, I'd be happy to. If you are willing to help, I want to make it easy for you!

 

Thanks again,

Jim

Thanks for the file link. I was able to replicate the "Picasso" distortion issue, and my initial and final Shape Map views appear below. Hopefully this new topojson file will also rid you of the unexpected error: https://www.dropbox.com/s/0i2s401sipkz6xr/WA-school-districts.json?dl=0

 

Here are a few thoughts on the process when using mapshaper:

  • Import the entire shapefile .zip rather than just the .shp. The shp only has the polygons while the dbf has data, and mapshaper uses both when exporting as topojson that includes the keys required for Power BI. You can test this out using the "i"/Info button in mapshaper and then hovering over a polygon. You should see data when hovering and not a message stating it's missing attribute data.
  • The topojson was initially slow to load in Power BI. I simplified it to 10% with no appreciable distortion and exported to topojson. I've found that's fairly common as well when converting files found online. If it takes more than a few seconds to view the map in Power BI, or it takes a long time to resize it, try simplifying in mapshaper and re-exporting.

 

For many shapefiles found online, the following process will not be required. For the Picasso effect though, the school district file required first importing it into QGIS (or ArcGIS), correcting the projection, and saving it as a new shapefile. Much like Power BI offers Mercator, Ortho, etc., there are hundreds of alternative projections. The new file with the adjusted projection was then imported into mapshaper. I'll have to blog about the process in the near future as you're not the first Power BI user to see the Picasso visual after converting a shapefile and won't be the last.

 

Power BI Shape Map Projection Issue.PNGPower BI Corrected Shape Map.PNG

I have tried for weeks to convert to the correct projection, but it does not work...  could someone convert this shape to topojson please? I have tried with QGIS, ARCMAP, used http://mapshaper.org/ but it continues showing in powerbi the Picaso Effect, The link of the shape is this : https://drive.google.com/file/d/1kbY_HkCulQzWD8SgJkP9nHu9bjmILY3U/view?usp=sharing

I have tried for weeks to convert to the correct projection, but it does not work...  could someone convert this shape to topojson please? I have tried with QGIS, ARCMAP, used http://mapshaper.org/ but it continues showing in powerbi the Picaso Effect, The link of the shape is this : https://drive.google.com/file/d/1kbY_HkCulQzWD8SgJkP9nHu9bjmILY3U/view?usp=sharing

 

 

 

@deldersveld Looking forward to your blog explaining the process. Smiley Very Happy

 

Hmmm, where exactly will your blog be -- possibly http://community.powerbi.com/t5/Community-Blog/bg-p/community_blog ?

I can't thank you enough! Your reworking of the file does indeed work, and I'm able to plot various attributes of school districts using it.

 

And I understand everything you suggest except the part about importing it into QDIS to correct the projection -- I would have no idea how to do that except by pure trial and error (because I don't know what a "correct" projection would be, except "one that seems to work"). But it sounds like you will be blogging about that. If you do, perhaps you wouldn't mind replying to this with a link, so that I, and others, could take a look at your post.

 

Again, thank you very much for your help.

 

Jim

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.