IDEA
|
This is old, but this feature has not been implemented. Are there any plans to do so?
... View more
12-04-2020
11:53 AM
|
0
|
0
|
606
|
POST
|
Hello Everyone, So, I'm a bit confused about why the script here involves updating the service definition and using an ArcPro project map, but the script here does not. Is there guidance concerning when to use one method vs. the other? I tried the linked sample script as a method to overwrite a hosted feature layer I published from ArcPro with a feature class in a file geodatabase. I don't get any errors, but it also doesn't update and I can't find any information on this. I would prefer not to have to maintain an ArcPro Project / map because I'm not the person who'll actually be running the script. Any suggestions appreciated. # Import libraries
from arcgis.gis import GIS
from arcgis import features
from arcgis.features import FeatureLayerCollection
import arcpy
# sign in to portal through ArcPro
gis = GIS("pro")
# new data
data_path =r"C:\path\to\gdb"
gdb = 'relevant.gdb'
arcpy.env.workspace = os.path.join(data_path, gdb)
fcs = arcpy.ListFeatureClasses()
fc = fcs[0]
print(fc)
#fc = "SouthAtlantic"
arcpy.GetCount_management(fcs[0])
# 6955 records at last count.
""" published feature layer
I published this as a hosted feature class;
the feature class name in the gdb
matches the feature layer name in the feature layer collection. (SouthAtlantic)
The name of the gdb also matches the name of the gdb I originally used to upload the feature service in ArcPro, although I don't know if that's important.
"""
# get item from arconline
item = gis.content.get(itemID)
# overwrite feature layer collection with gdb
item_flayer_collection = FeatureLayerCollection.fromitem(item)
item_flayer_collection.manager.overwrite(os.path.join(data_path,gdb))
#{'success': True}
item.layers[0].query(return_count_only=True)
# 6908 records, which means it wasn't actually updated.
... View more
11-20-2020
12:08 PM
|
0
|
0
|
1942
|
POST
|
When I perform a merge on two spatial dataframes, the SHAPE field converts to "object". Is there a way to re-set one of the SHAPE fields as a geometry field after the merge, or is there a way to maintain the SHAPE field as geometry? e.g. def overlapRows(in_sdf, master_sdf, key):
"""
Merge new attributes and point location with old attributes that aren't in the new dataset.
Includes new rows.
"""
join_sdf = pd.merge(left=in_sdf, right=master_sdf , how='outer', on=key, indicator=True)
print("Number of all records: ", len(join_sdf))
print("Number of new records: ", len(join_sdf[join_sdf['_merge']=='left_only']))
# if there's a duplicate, remove old attributes (y) and keep new attributes (x)
for fd in list(join_sdf.columns.values):
if fd.endswith("_x"):
join_sdf.rename(columns = {fd : fd.replace("_x", "")}, inplace=True)
elif fd.endswith("_y"):
del join_sdf[fd]
return(join_sdf)
mergeRows = overlapRows(dwhPt, dwhPl, 'prj_id')
print(mergeRows['SHAPE'])
Out:
1331 {'x': 517459.9827999994, 'y': -1082018.6127000...
1332 {'x': 524068.436499998, 'y': -998965.120000000...
1333 {'x': 600713.8193000033, 'y': -986437.45459999...
Name: SHAPE, dtype: object
... View more
11-02-2020
07:53 AM
|
0
|
1
|
314
|
POST
|
Thank you Kevin! Your post was very helpful and set me on the right path. This is what I ended up doing, in case this is useful to others. from arcgis import GIS
def getDomainNames(itemID, layerNumber):
"""
Returns a set of domain names from a feature layer within a feature layer collection.
:param itemID: identification number for an ArcOnline or Portal item (Feature Layer
Collection or FGDB)
:type itemID: str
:param layerNumber: the integer [0 and up] that calls the feature layer of interest
:type layerNumber: int
"""
# Assumes user is connected to their ArcOnline account in ArcPro.
gis = GIS("pro")
# Get the arcgis item (this would be your hosted FGDB).
item = gis.content.get(itemID)
# Select the layer within the feature layer collection.
fl = item.layers[0]
# Get the properties.
properties = fl.properties
# create an empty set
nameSet = set()
# Loop through properties, get a list of all coded values for the given domain.
for row in properties["fields"]:
# if domain exists for the field and the domain type is codedValue:
if row['domain'] and row['domain']['type'] == 'codedValue':
# add the domain name to the set.
nameSet.add(row['domain']['name'])
return (nameSet)
def getDomainValues(itemID, layerNumber, domName):
"""
Returns a list of domain codes from a specific domain within a feature layer.
:param itemID: identification number for an ArcOnline or Portal item (Feature Layer
Collection or FGDB)
:type itemID: str
:param layerNumber: the integer [0 and up] that calls the feature layer of interest
:type layerNumber: int
:param domName: name of the domain of interest
"""
# Assumes connected to duinc in ArcPro
gis = GIS("pro")
#Get the arcgis item (this would be your hosted FGDB).
item = gis.content.get(itemID)
# Select the layer within the feature layer collection.
fl = item.layers[layerNumber]
# Get the properties.
properties = fl.properties
# Loop through properties, get a list of all coded value domains.
for row in properties["fields"]:
# if domain exists and the domain name is correct:
if row['domain'] and row['domain']['name'] == domName:
# create a list of all codes included in that domain
valueList = [i['code'] for i in row['domain']['codedValues']]
return (valueList)
... View more
10-26-2020
12:57 PM
|
1
|
1
|
3754
|
POST
|
Hi, I'm new to arcgis API for python. I can't figure out how to get a list of domain values from a hosted feature layer. I did read the api-reference, and can see that there is a query_domain method for the FeatureLayerCollection class (here: arcgis.features module — arcgis 1.8.2 documentation ) but I don't understand the syntax well enough to figure out how to actually write the code. Thank you, Jes
... View more
10-23-2020
01:07 PM
|
0
|
3
|
3970
|
POST
|
Sorry, Eduardo, I thought we had responded. Here's the response from our ArcOnline site manager: The issue ended up lying in the Geometry utility. The first thing that can be done is to change the Geometry Utility to point to the ArcOnline utility. In your Portal Settings under Utility Services you can change the URL to https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer and save. That should fix the issue and you can stop their or if you still want to use the Portal geometry service then you will have to ensure that it is shared with everyone (that was our issue, it was not shared). For this, we went to our server manager (make sure you are logged in with the service account that created your portal), then you can go to Services -> Utilities and click the Sharing Properties of the Geometry utility. As long as you are logged in with the right account, you can see/change the sharing settings to either everyone or everyone in your organization. This should fix the issue. This also explains why Administrators could cut/reshape/merge but any user with less than Administrator privileges could not, since an Administrator can do anything regardless of how the content is shared.
... View more
02-25-2020
08:43 AM
|
0
|
1
|
380
|
POST
|
Hi Eduardo, Yes, actually, we just fixed it on Wednesday, with the help of an ESRI technician. Its seems as though the ArcGIS Online geometry utility service was only shared with the gis admin account on portal. Our ESRI technician logged into portal as the admin user, shared the geometry utility to the entire organization, and that allowed everyone to use the split and merge. Best, Jes
... View more
01-10-2020
02:12 PM
|
4
|
3
|
1237
|
POST
|
Hi Eduardo, We talked to an ESRI representative, and they were able to reproduce the error. It's possible that it's a bug with their 10.7.1 environment. I'm not sure if it's been submitted as a bug yet. -Jes
... View more
11-14-2019
08:39 AM
|
1
|
9
|
1237
|
POST
|
We have a hosted polygon feature layer on our internal portal site, shared to the organization and to a specific group. The edit settings allow for tracked editing and disconnected editing. Editors should be able to see all features, and add, update, or delete their own features. The problem is that no one below Administrator user level can actually update a polygon -- that is -- they can neither reshape nor cut a polygon. According to the Member Roles page in portal, folks with a "User Role" should be able to "edit features in editable layers that are not public, based on the edit options enabled on the layer". But we're finding that Users can only create polygons, delete polygons, and edit attributes using an online web map application and the Edit Widget. Administrators can reshape and cut polygons using the same tools. We're at a loss here. Are we doing something wrong, or is this a bug?
... View more
11-08-2019
12:54 PM
|
0
|
11
|
1875
|
Title | Kudos | Posted |
---|---|---|
1 | 10-26-2020 12:57 PM | |
1 | 11-14-2019 08:39 AM | |
1 | 11-14-2019 09:06 AM | |
4 | 01-10-2020 02:12 PM |
Online Status |
Offline
|
Date Last Visited |
02-08-2021
08:43 AM
|