Hi,
maybe a stupid question, but: quoting https://doc.arcgis.com/en/power-bi/get-started/prepare-your-data.htm
"EsriJSON—If your data contains location information formatted using EsriJSON, it should appear in a Shape column. Drag the Shape field value into the Location field well to draw EsriJSON locations on the map. EsriJSON supports points, lines, and polygons." (my highlight)
Anyone who knows how to ma
@TaylorWillow and @TimMinter I hope i can assist with the following explanation that worked for me using the REST API to generate a EsriJSON format that works in the location fieldwell. Please find the steps below:
Step 1: Get the REST Endpoint: https://services1.arcgis.com/bKDOijB8sneN5004/arcgis/rest/services/AGRIC_GIS_DATA/FeatureServer/1/qu...
Step 2: Add "Web" data to Power BI using the Get Data tool
Copy the REST Endpoint into the URL space
Step 3: Open Power Query
Power Query opens, scroll to the end of the record.
Step 4: Expand features
First expand the "features" column by clicking on the "expand" icon
Select "Expand to New Rows"
Step 5: Expand features
Un-tick "Use original....."
Step 6: Expand attributes
Un-tick "Use original....."
After expanding - scroll to the last "geometry column"
Step 7: Add custom column to format EsriJSON geometry and add Spatial reference to each record
The critical step is to add a "Custom" column from the Power Query "Add Column" main menu
Apply and Close the Power Query changes
Test:
Step 8 (optional): Add geometry length field to view large geometries over 32 000 characters
You can add an additional "Custom Column" to count the Length of the geometry characters. This is to see which records exceed the 32 000 character limit of Power BI. You can then identify missing geometries.
Geometries under 32 000 characters will have the "Spatial Reference" at the end - see sample below
Geometries above 32 000 characters will not end correctly and therefore not appear on the map.
Workarounds to prevent this issue:
Hope this helps.
Acknowledgements to Derck Vonck @DerckVonck, from Esri South Africa, who assisted me with custom column "formulas". Thanks Derck
Hi @RudolfdeMunnik ,
I was wondering if there is a way to create custom polygons (not existing boundaries like country, or region...) And add it to Power Bi? I managed to do it using the "join layer" in power bi, the issue is that is not connected to my power bi data... What I mean is I can only visualise the polygons and clic on it. But I would like to add colors on it depending on a status column I have in my data...
Here is an example of someone having the same issue.
Hi @NasreddineD,
Please find the links to my proposed solutions as posted previously.
- The methods does not use the existing/standard boundaries
- The methods does not use "join layer"
- It uses the true geometry of your custom geometries linked to Power BI visualisers
- You can change symbology/styling based on a field for color or size
1. Using Power Automate procedure - Basic and Advanced Method (from @SeanKMcGinnis )
2. Using REST API (without Power Automate)
Hope this helps.
Hi @RudolfdeMunnik ,
I am trying the REST API solution, but I don't understand the step 1.
Should I take the link you shared? It doesn't work or something happened when you copied pasted it.
Or should I find my own link? If yes, where and how?
@NasreddineD Apologies for replying only now. For some reason the URL that i copied in Step 1 did not copy correctly. So i created a screenshot of the URL. See below.
I hope this helps
@RudolfdeMunnik Nice! One quick thought on dealing with the 32k character constraint is that the REST service request can specify an appropriately lower precision. So, going from 7 in your example to a lower precision that is appropriate for use in Power BI may be some good trickery. I'm thinking that Power BI doesn't know or care about topology and is happiest with cartoon geometries anyway, so it kind of doesn't matter as long as the area looks ok to the eye.
@TimMinterThank you for the feedback, Yes, I have tested the precision in the REST request. If you are using DD with 6 decimals it helps to "generalize" the polys, but if you use Web Mercator it does not really help because the coordinate numbers are big, even if you remove all decimals you still have 1m accuracy - maybe i am missing something with the precision parameters?
@RudolfdeMunnik I just got a chance to follow your lead and got it to work with our data. It looks to me like you've tested it thoroughly. I'm forcing WGS84 decimal degrees (WKID 4326) in my REST request like this:
https://services1.arcgis.com/bKDOijB8sneN5004/arcgis/rest/services/AGRIC_GIS_DATA/FeatureServer/1/query?where=1=1&outFields=*&geometryPrecision=4&outSR=4326&f=json
Then, I adjust the "Shape" custom field code like this:
Text.Replace(Text.FromBinary(Json.FromValue([geometry])), "]]]" ,"]]], ""spatialReference"":{""wkid"":4326,""latestWkid"":4326}")
Then, finally, I add your optional ShpTxtLen so I can see how things worked out and tweak the coordinate precision if needed.
Thanks again!
tim
This is brilliant, you are an absolute lifesaver.
I can also confirm that the procedure works for an Esri JSON file exported from ArcGIS Pro using the "Features to JSON" tool. Once you have exported the json file you can then import it into Power BI as a JSON source. Then continue from step 3 above.
@PaddyFurlong - Nice! Maybe we can string that up with a little ModelBuilder thing to generalize the geometry for detailed polygons, export to JSON, then use the resulting graphic art in Power BI. Ideally, the REST service would have a generalize capability built in, but it seems a bit more complex than that.