Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set sharing level using new ItemProperties object of gis.content.folder.add() function #2138

Open
sogunsemi opened this issue Oct 23, 2024 · 2 comments
Labels

Comments

@sogunsemi
Copy link

sogunsemi commented Oct 23, 2024

Describe the bug
I recently upgraded my arcgis python library from 2.3.0 -> 2.4.0 and noticed the deprecation warning on the function gis.content.add(). According to the message, that function should still be available until 3.0.0 but it throws a confusing error instead. My goal is to add a GeoJSON item into the root of my account with the Organization sharing level.

To save time I updated my code to the recommended function gis.content.folder.add(). To use the new Folder.add() function I created an ItemProperties object. The issue is that I don't see a way to replicate the access parameter of the previous item_properties dictionary. I would like to set whatever the corresponding parameter is in the ItemProperties object to org but the closest thing I can find in the parameter list is access_information but that does not seem to do anything.

To Reproduce
Steps to reproduce the behavior:

def upload(data: str) -> Item:
        item_props = ItemProperties(
            title="My Title",
            item_type=ItemTypeEnum.GEOJSON.value,
            file_name="myfile.geojson",
            access_information="org",
        )
        LOGGER.info("publishing item")
        folders_obj = gis.content.folders
        item_folder = folders_obj.get()  # root folder of logged-in user is returned
        add_job = item_folder.add(item_properties=item_props, file=io.StringIO(data))
        return add_job.result()

error:

The GeoJSON item is added at the Owner sharing level instead of Organization in ArcGIS Online.

Deprecation warning for gis.content.add():

DeprecatedWarning: add is deprecated as of 2.3.0 and has been removed in 3.0.0. Use `Folder.add()` instead.

Error message I get when I try to use the gis.content.add() function:

AttributeError: module 'arcgis.features.geo' has no attribute '_is_geoenabled'

Screenshots
After I call the gis.content.add() function, the GeoJSON item should have the org icon (the one in the red box) next to it in the UI but it instead has the "person" icon indicating the Owner sharing level.
Screenshot 2024-10-23 at 9 53 34 AM

Expected behavior
For my GeoJSON item to be created with the org sharing level

Platform (please complete the following information):

  • OS: MacOS Sonoma
  • Browser: Google Chrome
  • Python API Version: 2.4.0
@sogunsemi sogunsemi added the bug label Oct 23, 2024
@sogunsemi sogunsemi changed the title Cannot set sharing level using new ItemProperties object of gis.folder.add() function Cannot set sharing level using new ItemProperties object of gis.content.folder.add() function Oct 23, 2024
@achapkowski
Copy link
Contributor

What is data?

@sogunsemi
Copy link
Author

sogunsemi commented Oct 23, 2024

What is data?

It's a GeoJSON string that was generated using GeoPandas like this:

gdf = gpd.GeoDataFrame(
            result_df, geometry=result_df["centroid"].apply(wkt.loads), crs="EPSG:4326"
        )
data = gdf.to_json()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants