This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require([ | |
"esri/Map", | |
"esri/views/MapView", | |
"esri/PopupTemplate", | |
"esri/layers/FeatureLayer", | |
"esri/widgets/Popup", | |
"esri/tasks/support/Query", | |
"https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.js", | |
"dojo/domReady!" | |
], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arcgis | |
from arcgis.gis import GIS | |
import arcpy | |
import os | |
def createSDFiles(): | |
workSpace = 'C:/sdFiles/' | |
arcpy.env.workspace = workSpace | |
fileList = os.listdir(workSpace) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arcgis | |
from arcgis.gis import GIS | |
from arcgis.features import FeatureLayerCollection | |
# Log into AGOL account [admin level] | |
gis = GIS(None,'username', 'password', verify_cert=False) | |
# Grab the feature layer item by id | |
featureLayerItem = gis.content.get('feature layer id') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arcgis | |
import json | |
from arcgis.gis import GIS | |
from arcgis.features import FeatureLayerCollection | |
# Log into AGOL account [admin level] | |
gis = GIS(None,'username', 'password', verify_cert=False) | |
# Grab the feature layer item by id | |
featureLayerItem = gis.content.get('feature layer id') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arcgis | |
import json | |
from arcgis.gis import GIS | |
gis = GIS(None,'username', 'password', verify_cert=False) | |
#This function takes in a username and a item [type] for deletion | |
def deleteContent(owner, itemType): | |
try: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arcgis | |
import json | |
from arcgis.gis import GIS | |
gis = GIS(None,'username', 'password', verify_cert=False) | |
# Download all data from a user | |
def downloadUserItems(owner, downloadFormat): | |
try: | |
#Search items by username |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arcgis | |
from arcgis.gis import GIS | |
import requests | |
gis = GIS(None,'username', 'password', verify_cert=False) | |
try: | |
featureLayerItem = gis.content.get('item id') | |
r = requests.post('https://{0}/sharing/rest/content/items/{1}/setContentStatus'.format('org domain',featureLayerItem.id), data= {'status': 'org_authoritative','clearEmptyFields': 'false', 'f':'json', 'token': 'token'}) | |
print(r) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Using a feature layer | |
import arcgis | |
from arcgis.gis import GIS | |
from arcgis.features import FeatureLayer | |
gis = GIS() | |
# Use the FeatureLayer class to get item from an service endpoint | |
url = 'https://idpgis.ncep.noaa.gov/arcgis/rest/services/NWS_Climate_Outlooks/cpc_6_10_day_outlk/MapServer' | |
layer = FeatureLayer(url) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This sample uses the server to find if any points are within a certain polygon. | |
// This option only uses one for loop to go through each polygon and then uses a spatial filter as input to the query for the points. | |
// For this option your points would need to be on the server either through a map service or a feature layer. | |
require(["esri/map", | |
"esri/layers/FeatureLayer", | |
"esri/tasks/query", | |
"esri/tasks/QueryTask", | |
"esri/geometry/geometryEngine", | |
"esri/graphic", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Adding an item to AGOL and publishing it | |
csv = r'path to csv' | |
csvItem = gis.content.add({}, csv) | |
csvFeatureLayer = csvItem.publish() | |
#Overwriting a service | |
#Search for the FeatureService by name | |
MyFeatureService = gis.content.search(query='title:SampleTest AND owner:owner') | |
#Get the id related to the Feature Service |