Closed jmk201 closed 9 years ago
That sample uses ArcRest helper, can you verify it was also install?
Running python setup.py install did not build the hostedservices folder in site packages. I had to manually copy it over and my own error went away.
Hey Mike, Something is not right . When I download the ArcREST3 , the samples that get downloaded looks like the samples from ArcREST1 . WHich probably means that the security handler codes are not installed either. How do I get to the correct download? Please help.
Not all the samples have been updated. Could you manually copy the arcrest and arcresthelper folders to here - C:\Python27\ArcGIS10.3\Lib\site-packages.
where should I copy this from? I don't see it anywhere here.
Mike, Just right clicking doesn't let me download the folder. Looks like I need Subversion to download a subfolder from Github. Is there any other way? as I don't have subversion. Please let me know.
just download the entire package and then copy those folders from the zip.
yes, that worked for me. Thanks a lot!! Hopefully the script will work now.
hey Mike , I get the following error 'must declare the scalar variable'
{'updateResults': [{'objectId': -1, 'globalId': None, 'success': False, 'error': {'code': 1000, 'description': 'Must declare the scalar variable "@OBJECTID".'}}]}
I am working on the update feature sample. not sure where to declare the objectID . Here is an extract to get a better picture of what I am doing:
shh = securityhandlerhelper.securityhandlerhelper(securityinfo=securityinfo) if shh.valid == False: print shh.message else: fl= FeatureLayer( url=url, securityHandler=shh.securityhandler, proxy_port=proxy_port, proxy_url=proxy_url, initialize=True)
out_fields = ['objectid']
for fld in fieldInfo:
out_fields.append(fld['FieldName'])
resFeats = fl.query(where=sql,
out_fields="OBJECTID,SUITE,BUSINESS_NAME,TYPE,STATUS,COMMENTS".join(out_fields))
for feat in resFeats:
for fld in fieldInfo:
feat.set_value(fld["FieldName"],fld['ValueToSet'])
print fl.updateFeature(features=resFeats)
any idea where to declare the OBJECTID? please help!
Could you share the url to your service? Can you verify the OBJECTID field is being sent in the post/get?
It's a secured service but I think error is probably when I am defining the sql statement.
id = 44081 url = 'http://services1.arcgis.com/MxjRokvPm7bjslyR/ArcGIS/rest/services/CollectBizNames/FeatureServer/1'
dt = local_time_to_online(datetime.datetime.now())
fieldInfo =[
{
'FieldName':'BUSINESS_NAME',
'ValueToSet':'TEST',
'objectid':'OBJECTID'
}
]
sql = 'OBJECTID = ' + str(id)
proxy_port = None
proxy_url = None
securityinfo = {}
securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI, ArcGIS
securityinfo['username'] = "zdsczdzd"
securityinfo['password'] = "zczczc"
securityinfo['org_url'] = "http://loudoungis.maps.arcgis.com/"
securityinfo['proxy_url'] = proxy_url
securityinfo['proxy_port'] = proxy_port
securityinfo['referer_url'] = None
securityinfo['token_url'] = None
securityinfo['certificatefile'] = None
securityinfo['keyfile'] = None
securityinfo['client_id'] = None
securityinfo['secret_id'] = None
shh = securityhandlerhelper.securityhandlerhelper(securityinfo=securityinfo)
if shh.valid == False:
print shh.message
else:
fl= FeatureLayer(
url=url,
securityHandler=shh.securityhandler,
proxy_port=proxy_port,
proxy_url=proxy_url,
initialize=True)
out_fields = ['objectid']
for fld in fieldInfo:
out_fields.append(fld['FieldName'])
resFeats = fl.query(where=sql,
out_fields="OBJECTID,SUITE,BUSINESS_NAME,TYPE,STATUS,COMMENTS".join(out_fields))
for feat in resFeats:
for fld in fieldInfo:
feat.set_value(fld["FieldName"],fld['ValueToSet'])
print fl.updateFeature(features=resFeats)
think your issue is with this line ="OBJECTID,SUITE,BUSINESS_NAME,TYPE,STATUS,COMMENTS".join(out_fields
you are using this string as your joining delimiter OBJECTID,SUITE,BUSINESS_NAME,TYPE,STATUS,COMMENTS"
you need to use this to join your out fields as a comma delimited list ",".join(out_fields)
yes, you are correct. Looks like, I created that error myself:( I have a question, If I have an array of ids and array of values for the fields. what is the most efficient way to go about each value in the array? any thoughts?
okay, thanks a lot Mike!!
wov this looks way complex. All I want to do is to update more than one feature. can I not update more than one feature at a time using ArcREST?
You would need to construct a featureset, which contains a set of features https://github.com/Esri/ArcREST/blob/master/samples/update_features.py
Mike, yes, I am working on the same sample and I am able to update one feature successfully. Now that I want to update more than one feature, can I not create a list of ids and list of field values and pass it in this sample?
I will look at construction a featureset option too. thanks!
Hello, I installed ArcREST ver 3 and tried the updatefeature sample but I keep getting this error. Any help would be appreciated. thanks, Julie