Select to view content in your preferred language

item.groupDesignations and item.url (for web maps) not pulling information

741
4
Jump to solution
11-17-2023 02:16 PM
SFM_TravisBott
Frequent Contributor

I am having trouble pulling specific set of properties from various items via the api. 

I have a script that ingests a lists of jurisdictions and then creates a group, view layer, web map, and application (based on templates) for each jurisdiction. As part of the process I am also including an output table of all created items with their ids, url's, ownerFolder, title, etc. 

All properties can be pulled successfully with the exception of 'groupDesignations' and the 'url' for web maps. 

 

Group Designations

It appears that however Esri has intended this to function the groups that an item is shared with is not recorded in the item's properties. 

See the item's JSON via the assistant below, where there are no values for groupDesignations (even though this is in fact shared). 

SFM_TravisBott_1-1700259165026.png

And below, where there is a workaround to call it via .shared_with(), but it requires pulling it out of a list. 

SFM_TravisBott_0-1700259079507.png

Web Map URL

How else can one pull the web map's URL? item.url pulls nothing. And scanning the item's JSON it doesn't appear that the URL that it lives at is stored anywhere. What other methods are there to capture and store the map's url in a table? (Calling .url for the other item types works just fine). 

SFM_TravisBott_2-1700259312689.png

 

 

Tags (2)
1 Solution

Accepted Solutions
EarlMedina
Esri Regular Contributor

I observe the same thing on my end. Perhaps the best course of action might be to open a case with Technical Support to gain a better understanding of when the groupDesignations and url property values are populated and what they are supposed to be. My guess is this functionality may just be broken and a defect should be logged.

 

For the groups, maybe you can do:

", ".join([group.Title for group in item.shared_with["groups"]])

And this would handle cases where the an item is shared to multiple groups.

 

As for the WebMap url, if you're okay with linking to the Item Details page, then you can get that from "item.homepage". This will return something like: 

'https://www.arcgis.com/home/item.html?id=d4d5c81e0ejkt4f68ac1aa77452a3338'

 

If, however, you're after a direct link to the map I think you'll need to do some string interpolation/concatenation. Something like this if you are using the new Map Viewer:

map_url = f"{gis.url}/apps/mapviewer/index.html?webmap={item.id}"

 

Hope this helps.

 

View solution in original post

0 Kudos
4 Replies
EarlMedina
Esri Regular Contributor

I observe the same thing on my end. Perhaps the best course of action might be to open a case with Technical Support to gain a better understanding of when the groupDesignations and url property values are populated and what they are supposed to be. My guess is this functionality may just be broken and a defect should be logged.

 

For the groups, maybe you can do:

", ".join([group.Title for group in item.shared_with["groups"]])

And this would handle cases where the an item is shared to multiple groups.

 

As for the WebMap url, if you're okay with linking to the Item Details page, then you can get that from "item.homepage". This will return something like: 

'https://www.arcgis.com/home/item.html?id=d4d5c81e0ejkt4f68ac1aa77452a3338'

 

If, however, you're after a direct link to the map I think you'll need to do some string interpolation/concatenation. Something like this if you are using the new Map Viewer:

map_url = f"{gis.url}/apps/mapviewer/index.html?webmap={item.id}"

 

Hope this helps.

 

0 Kudos
SFM_TravisBott
Frequent Contributor

Thanks, @EarlMedina . Those are perfectly good workarounds and I'll use them instead. 

I have a follow-up question, just out of curiosity around Esri as an organization. You work for them. You've observed the problem and acknowledge it as an issue. Why, then, is there not a more direct line to getting it fixed internally, seeing as you're part of the team? It doesn't make sense that I should now work with my administrator to open a case, wait to get a call back, maybe get assigned a competent tech, just to log a bug that sits around and is never resolved. You're asking a customer who pays for this service to spend their time helping fix the thing that, based on the company's documentation, should already work.

0 Kudos
EarlMedina
Esri Regular Contributor

Hey, glad those workarounds help.

That's a fair question! The truth is, I'm just an enthusiast and I am in no way affiliated with the ArcGIS API for Python team. I understand your frustration - that's why I'm on these boards answering the questions I can as my time allows. Generally, it is preferable to open a case with Technical Support so the issue can be tracked both externally and internally. You may not be the only person running into this problem, so it is helpful to everyone to be able to add additional cases onto the defect log. Alternatively, you could post an issue on the public-facing github: https://github.com/Esri/arcgis-python-api

You may or may not be able to get some more direct information on the expected behavior. In any case, it's still a good idea to log a formal defect and/or enhancement as the case may be.

 

 

0 Kudos
NicholasGiner1
Esri Contributor

Hi @SFM_TravisBott - thanks for the great question and thank you @EarlMedina for the workarounds.   For questions about the Python API and for help writing/using the code, this Esri Community is probably the best place to go.  As you might observe, the Community is very active in helping answer questions and has contributions both Esri internal staff and our customers.  

With that said, if you identify a bug or have an enhancement request, we do encourage you to submit it to our public facing github repo.  This is actively monitored by the team and we appreciate your ideas and feedback!

https://github.com/Esri/arcgis-python-api/issues

thank you,

Nick Giner, Product Manager - ArcGIS API for Python