|
POST
|
Have you examined the returned json before inserting it into your database to verify the global IDs? Response on the request from Dev Tools Response tab is: "features" : [ { "attributes" : { "objectid" : 2, "globalid" : "9667a224-a732-49f3-b3c2-3eafb17a482d",
... View more
02-20-2018
06:46 AM
|
0
|
0
|
4158
|
|
POST
|
Good call, Randy. I did as you suggested and set a search cursor on the FeatureSet() after .load() to see what the GlobalID values are at that point (before converting to fgdb Feature Classes / tables). You're test validates that they are {00000000-0000-0000-0000-000000000000} When queried on the REST endpoint (WHERE 1=1, Fields = *) I see the globalid and parentglobalid values as expected. with arcpy.da.SearchCursor(fs, ['objectid','globalid']) as fscur:
for fsrow in fscur:
print fsrow[1]
##result:
globalid
{00000000-0000-0000-0000-000000000000}
{00000000-0000-0000-0000-000000000000}
{00000000-0000-0000-0000-000000000000}
... View more
02-20-2018
06:20 AM
|
0
|
0
|
4158
|
|
POST
|
Thanks again, I ran the script from a client with ArcGIS Desktop10.4 installed but has the same issue with GlobalID -- it creates the feature class without error including all of the fields specified, but the globalId column is populated with {00000000-0000-0000-0000-000000000000} Also: this is a hosted feature service on AGOL that I'm working with. From the Feature Service end point: globalid (type: esriFieldTypeGlobalID, alias: GlobalID, SQL Type: sqlTypeGUID, length: 38, nullable: false, editable: false)
... View more
02-19-2018
06:36 AM
|
0
|
2
|
4158
|
|
POST
|
ArcGIS Server 10.4 (maybe 10.4.1) ArcGIS Desktop 10.3.1 Good point -- I do have a 10.4 client I use to publish GP services but I didn't run this particular script on that box. I only ran (with my issues) on the 10.3 install. I'll check that out! Thank you.
... View more
02-17-2018
05:21 AM
|
0
|
0
|
4158
|
|
POST
|
I'm not having luck with the GlobalID and ParentGlobalID columns when attempting to populate Feature Classes and Tables in a FGDB from a hosted feature service. It's all fairly straight forward and seems to work just fine, except for when specifying these two fields. Issues: 1. The GlobalId field does not seem to throw any error, however the feature classes get populated with the value: {00000000-0000-0000-0000-000000000000} 2. There's also related feature classes that contain a ParentGlobalID column as well, these throw an error when attempting to load the feature set "RuntimeError: RecordSetObject: Cannot open table for Load". If I remove the "ParentGlobalID" column from my list of fields to download, then the process works fine without error (minus the ParentGlobalID column of course). This is the important section: fields = """objectid,globalid,SurveyStartTime,SurveyEndTime,CreationDate,Creator,EditDate,Editor"""
taburl = <URLtoHostedFeatureService>/query/0
where = '1=1'
query = "?where={}&outFields={}&returnGeometry=true&f=json&token={}".format(where, '*', token)
queryfsURL = taburl + query
#try to convert the hosted service to a fgdb table
fs = arcpy.FeatureSet()
fs.load(queryfsURL)
fs.save(r'<pathToDirectory>\downloadTab.gdb\HostedFsNameHere)
#also attempted this
#arcpy.CopyRows_management(fs, r'<pathToDirectory>\downloadTab.gdb\HostedFsNameHere)
... View more
02-16-2018
01:25 PM
|
0
|
22
|
9989
|
|
DOC
|
We ran into an issue with downloading of .json file types on some computers because there was no file association set for that file type. We changed our webservice to return a .zip file containing the .json file rather than returning the actual .json file.
... View more
02-15-2018
07:45 AM
|
0
|
0
|
17602
|
|
POST
|
I think you are going to have to be much more specific. Are you talking about PostgREST or PostgreSQL? It sounds like the first if you're wanting to use an API with token authentication, but again, you'll need to provide more detail I think. (also: I don't claim to be informed on postgre, but noticed the language you used might help others to provide input).
... View more
02-13-2018
06:26 AM
|
0
|
1
|
1443
|
|
POST
|
Please start HERE to get an add-in setup. Also, you'll probably have to be more specific to what database you are working with and what you hope to accomplish to get best responses.
... View more
02-07-2018
01:42 PM
|
1
|
5
|
1443
|
|
POST
|
Then wouldn't your initial reference to layer be out of scope if it's an entirely different gp tool processing what is selected?
... View more
02-06-2018
12:13 PM
|
0
|
1
|
3201
|
|
POST
|
Doesn't look like new_layer will be enough to perform the selection and needs to reset a reference to the desired layer in the dataframe to apply a SelectByAttribute_management on the feature class that is loaded programmatically. Code below generates desired result on a single pass. path = r'somepath\somfeaureclass'
mxd = arcpy.mapping.MapDocument('CURRENT')
df = arcpy.mapping.ListDataFrames(mxd)[0]
new_layer_name = os.path.basename(path)
arcpy.MakeFeatureLayer_management(path, new_layer_name)
new_layer = arcpy.mapping.Layer(new_layer_name)
arcpy.mapping.AddLayer(mxd.activeDataFrame, new_layer, 'BOTTOM')
# reset the referenc to the "new_layer" by way of arcpy.mapping.ListLayers()
lyr = arcpy.mapping.ListLayers(mxd, "Adminbndy3_Clip", df)[0]
sql = 'OBJECTID=2'
arcpy.SelectLayerByAttribute_management(new_layer, "NEW_SELECTION", sql)
arcpy.RefreshActiveView()
del new_layer
... View more
02-06-2018
11:55 AM
|
1
|
3
|
3201
|
|
POST
|
I missed where you described the selection process (assuming it was a manual process by the user performing a selection on the layer that was loaded). Likely issue is that you'll have to reset the lyr reference after added to the TOC but I'll try to programmatically select some features after it's added to see if I can produce your issue.
... View more
02-06-2018
11:44 AM
|
0
|
0
|
3201
|
|
POST
|
If possible, implement arcpy.GetCount on the layer in the TOC rather than the desc.FIDSet. mxd = arcpy.mapping.MapDocument('CURRENT')
df = arcpy.mapping.ListDataFrames(mxd)[0]
lyr = arcpy.mapping.ListLayers(mxd, "SomeLayerName", df)[0]
getCountMethod = int(arcpy.GetCount_management(lyr).getOutput(0))
arcpy.AddMessage("getCountMethod: {}".format(getCountMethod)) That seems to work just fine, even after the layer was added programmatically from another GP tool.
... View more
02-06-2018
11:16 AM
|
0
|
20
|
3069
|
|
POST
|
It looks like you are trying to get the count on the feature class, not what is loaded in the mxd document. feature_count = int(arcpy.GetCount_management(input_feature_class).getOutput(0) This is working for a layer loaded in the TOC: mxd = arcpy.mapping.MapDocument('CURRENT')
df = arcpy.mapping.ListDataFrames(mxd)[0]
lyr = arcpy.mapping.ListLayers(mxd, "SomeLayerInTOC", df)[0]
desc = arcpy.Describe(lyr)
feature_count = desc.FIDSet
print("Number of selected features: {}".format(len(feature_count.split(";"))))
... View more
02-06-2018
05:48 AM
|
1
|
34
|
4185
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-17-2020 10:47 AM | |
| 1 | 10-25-2022 11:46 AM | |
| 1 | 08-08-2022 01:40 PM | |
| 1 | 02-15-2019 08:21 AM | |
| 2 | 08-14-2023 07:14 AM |
| Online Status |
Offline
|
| Date Last Visited |
01-22-2025
02:28 PM
|