Shape in Geojson

6463
31
09-08-2022 08:32 AM
torkildv
New Contributor II

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

0 Kudos
31 Replies
by Anonymous User
Not applicable

We do not support GeoJSON at this time, and the support for 'EsriJSON' comes from users who use the REST connector in Power BI with ArcGIS Services to query the data from the service and pull it into Power BI, or those who use the ArcGIS connector in Power Automate to do it for them.

0 Kudos
torkildv
New Contributor II

Thanks voor your answer. Nevertheless, if I try to connect to a rest service, I get a standard column, and I don't see how I could retrieve the Shape field in order to "drag it into the location field".

torkildv_0-1663331769098.png

then i get this

torkildv_1-1663331794592.png

Do you have  more detailed information or documentation how to connect in a way it works?

0 Kudos
simoxu
by MVP Regular Contributor
MVP Regular Contributor

To get the geometry, In your query to ArcGIS online / Enterprise endpoint, you need to set the specific parameter returnGeometry to true.

0 Kudos
torkildv
New Contributor II

@simoxu: I've tried a zillion things, (e.g. returNGeometry=true) but the problem is that the documentation tells you:"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." and I do noet find a way in visualising my Shape column. That's where it gets stuck

RudolfdeMunnik
New Contributor III

@torkildv @Anonymous User @simoxu I am also struggling with the same problem to parse the EsriJSON in Power Query to get to the Shape column - it just does not work - unless i am doing something wrong. Must the Geometry be in GCS? The only reference to the method is: https://doc.arcgis.com/en/power-bi/get-started/prepare-your-data.htm

@Anonymous UserCan you please provide more detailed steps on how this can be accomplished - I don't want to use Shape Map Visualizer, because it is static, no background and also non-Esri. It will be a big selling point to our users if we can add custom polygons with rendering - not through reference layers and joins.

Thank you

TimMinter
Occasional Contributor III

Yep, me too.  I need to use an off-menu feature class of an organization's administrative boundaries that are not in the list of recognized boundary types that the geocoders can find and supply.  I can query the hosted map service in ArcGIS online and return EsriJSON in WGS84 with all fields like this:

I'll note that there is no such thing as a "Shape" column in that EsriJSON above, so I'm guessing that the help documentation is referring to what Power BI perceives as the Column1.attribute.geometry column.

I can tell Power BI to load JSON, then get Power Query Editor to convert it to a table thingy from which I can load that Column1.attribute.geometry (or "Shape" when I rename it) into the Location well for an "ArcGIS Maps for Power BI" visualization, which then erases the basemap, creates a white canvas, and tells me "The accuracy of your locations can be improved (hint - not by any existing Power BI map visualizations, they can't) and presents a "Go to Location Type and learn more." button.  I click the button and fill out this thing, which does not seem to understand what's happening:

TimMinter_0-1665442153986.png

Clicking that "OK" button results in a briefly spinning spinner.  Any pointers on how to get Power BI to use an EsriJSON file (or any approach, really) for using off-menu boundaries and columns like what one would find in a SQL Server enterprise geodatabase feature class that Tableau or ArcGIS can use (i.e. WGS84, SQL Server geography spatial type) would be greatly appreciated.

I'm adding this little movie that I made to show the situation and provide the trickery necessary to get EsriJSON into Power BI as a data resource.

AnneTetley
Occasional Contributor

We're also struggling with this and would love a solution as the join in ArcGIS for Power Bi is also not working for us so we need to be able to import JSON boundary layers to visualise the data we want to use in our report.

 

Thanks

Anne

0 Kudos
RudolfdeMunnik
New Contributor III

Hi @AnneTetley, @TimMinter,

I am fortunate that i got the procedures from @SeanKMcGinnis  and @AnthonyLatini. Thanks Guys.

Prerequisite: You need to have a Power Automate Premium subscription. I used a trial license to test.

There are two methods using ArcGIS for Power Automate to extract custom geometries and attributes from ArcGIS Online or ArcGIS Enterprise Feature Services.

1. Basic Method - Limited to 150 features (also see NOTE for complex Geometries)

2. Advanced Method - Iterate through all features in batches to get all features. (also see NOTE for complex Geometries)

Basic Method:

Overview: Using ArcGIS for Power Automate functions to extract Feature Geometries and Attributes from a Feature Service and convert it into a EsriJson CSV file. The CSV file is then imported into Power BI as a normal table. Add the ArcGIS for Power BI Visualizer. Drag the Geometry field of the CSV into the " Location" field well. Custom Features are displayed and can be used with other Visualizers.

You can run this process once if the Feature Geometries do not change. If they change you can schedule to run the process regularly or create a Power Automate button in Power BI Desktop to execute manually - I used the button method for testing.

1. Power BI Desktop - Add a New Page, Add the ArcGIS for Power BI Visualizer. Sign in to ArcGIS Online or Enterprise.

2. Add a Power Automate for Power BI Visualizer next to the Map.

RudolfdeMunnik_1-1673381010806.png

3. Edit the Power Automate to create a new flow. Click on "New"

RudolfdeMunnik_2-1673381188407.png

Select the "Instant Cloud Flow" option

4. Add flow steps to the "Power BI Button clicked" button

- Click on "New Step" and search for the "ArcGIS" functions

- Select "Get data from Feature Layer" action

- After the step is added - use the ...(3 dots/ellipses) on the step to create a ArcGIS connection - important for authentication.

- After login you should be able to use the dropdowns to select the "Layers in" and the "Feature layer" you want to use.

- Select "Output Format" as CSV

- To ensure all features (up to 150) are extracted set OBJECTID field, Greater than, 0

RudolfdeMunnik_3-1673382326197.png

5. Write CSV content to a File and folder location

- I added a OneDrive - Create File action

- Add Location of the file

- Add the name and extension of the file

- Add content type - Select CSV from the list

RudolfdeMunnik_4-1673382702218.png

6. Save the Power Automate Flow

- Save and Apply

7. Return the report and Run the flow by pressing the button (use CTRL)

- You have to use the CTRL and Left mouse to execute the button (in edit mode)

- Button will show "Triggered"

- Browse to your folder to locate the CSV file was created from the flow

- Open the file in Excel to inspect content and format

8. Load the CSV file in Power BI

9. Expand the table to locate the "geometry" field

10. Make the ArcGIS visualizer active and drop the "geometry" field in the Location field well

11. View your custom geometries

12. If there are missing polygons the content of the "geometry" field may be larger than 32,767 characters - a Power BI limitation. See the NOTE & Workaround below

Advanced Method

Here is a link to the article by @SeanKMcGinnis. Thanks Sean.

https://community.esri.com/t5/arcgis-for-power-automate-blog/using-arcgis-connectors-for-power-autom...

NOTE: The Geometry field is limited to 32,767 characters - This is a Power BI limitation.

Workaround:

Check for multi-part polygons and convert to single part and generalize complex geometries to a new Feature Class for use in ArcGIS for Power BI

I hope the above steps helps.

Rudolf

PS: Thanks again to @AnthonyLatini and @SeanKMcGinnis from the ArcGIS for Power BI Team

AnneTetley
Occasional Contributor

Thanks for the solution, that's really helpful.

We have some Power Automate Premium licenses and could set up a scheduled process perhaps, I wonder if FME would be able to do the same conversion, might also look into that as an option.