In ArcGIS online (AGOL), is it possible to load data (shapefile or geodatabase) into an existing layer? The map layer is shared and editable.
3 Answers
In ArcGIS Online You can bring it into ArcMap and Create Local Copy and merge your data into the local copy and sync that back to the service.
Or if the data you want to merge with the existing service, you first will have to publish the shapefile or feature class up as a feature service in AGOL and then bring both services into a web map and then run the merge GP service (under analysis in the map viewer) which will output a new service.
ArcGIS Pro gives you the ability to edit features services directly from ArcGIS Online. Check out the documentation here. You could use the Append tool to load your existing data into the ArcGIS Online feature service.
Note that the feature service doesn't have to be shared once you log into your ArcGIS Online account through ArcGIS Pro. Tokens are automatically appended to edits, etc. once you do this.
Make use of python and ArcREST, specifically this sample. This is useful if you plan on having this as a repeated task and can schedule it to happen perhaps nightly. However if it is a one off job, Russ answer (1st paragraph) would be my choice.
Pasting here in case link dies:
import arcrest, json
from arcresthelper import featureservicetools
from arcresthelper import common
def trace():
"""
trace finds the line, the filename
and error message and returns it
to the user
"""
import traceback, inspect
tb = sys.exc_info()[2]
tbinfo = traceback.format_tb(tb)[0]
filename = inspect.getfile(inspect.currentframe())
# script name + line number
line = tbinfo.split(", ")[1]
# Get Python syntax error
#
synerror = traceback.format_exc().splitlines()[-1]
return line, filename, synerror
if __name__ == "__main__":
proxy_port = None
proxy_url = None
securityinfo = {}
securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI
securityinfo['username'] = ""#<UserName>
securityinfo['password'] = ""#<Password>
securityinfo['org_url'] = "http://www.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
itemId = ""#<Item ID>
layerName=''#Name of layer in the service
fc=r''#Path to Feature Class
atTable=None
try:
fst = featureservicetools.featureservicetools(securityinfo)
if fst.valid == False:
print fst.message
else:
fs = fst.GetFeatureService(itemId=itemId,returnURLOnly=False)
if not fs is None:
fl = fst.GetLayerFromFeatureService(fs=fs,layerName=layerName,returnURLOnly=False)
if not fl is None:
results = fl.addFeatures(fc=fc,attachmentTable=atTable)
print json.dumps(results)
else:
print "Layer %s was not found, please check your credentials and layer name" % layerName
else:
print "Feature Service with id %s was not found" % fsId
except:
line, filename, synerror = trace()
print "error on line: %s" % line
print "error in file name: %s" % filename
print "with error message: %s" % synerror