Select to view content in your preferred language

Download Feature Service(hosted) without making shp file in AGOL

396
1
08-30-2021 11:45 AM
by Anonymous User
Not applicable

I cant seem to find a way to create a shp file from a AGOL feature service without having to create a shp file first that gets created in AGOL (adding something I dont need)  then I export that shp onto my laptop.  Is there a better way of doing it?  Im looking for best practice.

This is what I have  

###Variables
AGOL_Login = GIS("url", "username", "password", verify_cert=False)
itemToDownload = AGOL_Login.content.get("b6451dd141bbbd89a0e0fc")
exportLoc = r"C:\Users\youknowit\Desktop\PROJECTS\Downloads"
itemExportName_SHP = "test"

itemToDownload.export(itemExportName_SHP, "Shapefile", None, True)

searchForExportedItem = AGOL_Login.content.search(itemExportName_SHP)
exportedItemID = searchForExportedItem[0].id
getTheExportedItems = AGOL_Login.content.get(exportedItemID)

getTheExportedItems.download(exportLoc)
0 Kudos
1 Reply
Kevin_McIntyre
Regular Contributor

Does it need to be a shape file or can it be in another format like json or csv? Exporting to other formats would be much quicker and easier IMO.

If not, you can always just add an extra line of code to delete the resultant shape file that was added to AGOL after its been downloaded.

Regardless, I don't believe there is a way to just download a shape file without having a copy created in AGOL.

0 Kudos