POST
|
Can you share the CSV you're using to one of the AGOL groups you invited me to?
... View more
03-27-2024
04:30 AM
|
1
|
3
|
148
|
POST
|
@WGIS with SAML enabled, you can still create a built-in Administrator account and use that. An Administrator account is not required, but the tool would have to be re-written in a few places so that a Publisher could execute it successfully. However, it may be worth given some thought if you want a non-admin promoting content to your Production environment.
... View more
03-26-2024
07:06 AM
|
1
|
2
|
385
|
POST
|
Hi @g1omaa, These tools here will do exactly what you're looking for.
... View more
03-26-2024
05:37 AM
|
3
|
0
|
407
|
DOC
|
@Sibe I currently don't have plans to implement this. To do this, you would need to query the manifest.json or manifest.xml files located at \arcgisserver\config-store\services\<service name>\esriinfo\manifest. These files hold information of the feature classes/tables used in the services.
... View more
03-26-2024
05:27 AM
|
0
|
0
|
1201
|
POST
|
@FredMitchell , Try the following: import arcpy, os, uuid
import pandas as pd
import datetime
from datetime import timedelta
from arcgis.features import GeoAccessor, FeatureLayer
from arcgis.gis import GIS
# Variables
url = 'https://kirklandwa.maps.arcgis.com'
username = 'user'
password = 'pw'
hostedTableID = '78e4a92c5c324dd18cc6eee11cb6b2f7'
outputCSVFile = r'local path to CSV'
# get table from AGOL
gis = GIS(url, username, password)
CrimeTrendsTable = gis.content.get(hostedTableID)
CrimeTrendsTableLyr = CrimeTrendsTable.tables[0]
crimeLayer = FeatureLayer(CrimeTrendsTableLyr.url, gis=gis)
# Truncate table
CrimeTrendsTableLyr.manager.truncate()
# import feature class and create slice of the data set in a new dataframe
df = pd.DataFrame.spatial.from_featureclass(r"local path of larger feature class from sde")
df = df.sort_values(['OFFENSES_YEAR', 'CRIME_STAT_TYPE', 'FROM_DATE'], ascending= [True, True, True], ignore_index=True)
df = df.loc[:, ['OFFENSES_YEAR', 'CRIME_STAT_TYPE', 'FROM_DATE']]
# set variables for today and the previous 5 years
today = datetime.datetime.today()
todate1 = today - timedelta(365)
todate2 = today - timedelta(730)
todate3 = today - timedelta(1095)
todate4 = today - timedelta(1460)
todate5 = today - timedelta(1825)
this_year = datetime.datetime.today().year
one_year_ago = this_year - 1
two_years_ago = this_year - 2
three_years_ago = this_year - 3
four_years_ago = this_year - 4
five_years_ago = this_year - 5
# create new dataframes for current and each previous year to date
df0 = df.loc[(df['OFFENSES_YEAR']==this_year) & (df['FROM_DATE'] < today)]
df1 = df.loc[(df['OFFENSES_YEAR']==one_year_ago) & (df['FROM_DATE'] < todate1)]
df2 = df.loc[(df['OFFENSES_YEAR']==two_years_ago) & (df['FROM_DATE'] < todate2)]
df3 = df.loc[(df['OFFENSES_YEAR']==three_years_ago) & (df['FROM_DATE'] < todate3)]
df4 = df.loc[(df['OFFENSES_YEAR']==four_years_ago) & (df['FROM_DATE'] < todate4)]
df5 = df.loc[(df['OFFENSES_YEAR']==five_years_ago) & (df['FROM_DATE'] < todate5)]
# create tables for each current and previous year grouped by crime type, add together previous year tables and average
table0 = df0.groupby('CRIME_STAT_TYPE')['OFFENSES_YEAR'].count().reset_index()\
.rename(columns={"OFFENSES_YEAR" : this_year})
table1 = df1.groupby('CRIME_STAT_TYPE')['OFFENSES_YEAR'].count()
table2 = df2.groupby('CRIME_STAT_TYPE')['OFFENSES_YEAR'].count()
table3 = df3.groupby('CRIME_STAT_TYPE')['OFFENSES_YEAR'].count()
table4 = df4.groupby('CRIME_STAT_TYPE')['OFFENSES_YEAR'].count()
table5 = df5.groupby('CRIME_STAT_TYPE')['OFFENSES_YEAR'].count()
avgtable = pd.concat([table1, table2, table3, table4, table5]).groupby('CRIME_STAT_TYPE').mean().reset_index()\
.rename(columns={"OFFENSES_YEAR" : "previous5yearAverage"})
trendstable = avgtable.join(table0.set_index('CRIME_STAT_TYPE'), on='CRIME_STAT_TYPE').fillna(0)
trendstable.to_csv(outputCSVFile, sep='\t', encoding='utf-8')
# update hosted table from csv file
csvDF = GeoAccessor.from_table(outputCSVFile)
adds_fs = csvDF.spatial.to_featureset()
adds_dict = adds_fs.to_dict()
adds = adds_dict["features"]
crimeLayer.edit_features(adds=adds)
... View more
03-25-2024
04:24 PM
|
1
|
5
|
159
|
POST
|
Hi @AFackler_NAPSG, You can use the group ID and then check if the item is shared with the group based off that. Ex: groupID = 'c901a2470db24abfb92a079f14186c1e'
lyr_item = gis.content.get('db6680d8e14d4f2bba5236752d44efc3')
for group in lyr_item.shared_with['groups']:
if group.id == groupID:
print("Shared with group")
else:
print("Not shared with group")
... View more
03-25-2024
12:33 PM
|
1
|
1
|
209
|
POST
|
@FredMitchell can you share the service to an AGOL group and invite my account (jskinner_rats)? I can take a look to see if anything jumps out at me.
... View more
03-25-2024
12:08 PM
|
1
|
7
|
224
|
POST
|
Hi @GeorgeClark , I use the following script to execute the webgisdr. Windows Task Scheduler executes the script each night, and the script will execute a BAT file to run the webgisdr. You may want to try this to see if it gives successful results.
... View more
03-22-2024
01:50 PM
|
0
|
2
|
402
|
POST
|
@TylerT after adding a field to a referenced service, you will only have to restart the service for the field to appear.
... View more
03-22-2024
01:46 PM
|
1
|
0
|
194
|
POST
|
I can't reproduce this. I'm working with Pro 3.2.2 and a File Geodatabase.
... View more
03-22-2024
03:05 AM
|
0
|
2
|
225
|
POST
|
@kapalczynski you can run the Calculate Field on the feature layer and the edits will be reflected in the service: # Variables
portalURL = 'https://gis.esri.com/portal'
username = 'portaladmin'
password = 'p0rt@l@dmin1'
featureServiceURL = 'https://gis.esri.com/server/rest/services/pipes/FeatureServer/0'
whereClause = "Imported = 'No'"
# Sign into Portal
arcpy.SignInToPortal(portalURL, username, password)
# Make Feature Layer
arcpy.MakeFeatureLayer_management(featureServiceURL, "fLyr", whereClause)
# Calculate Field
arcpy.management.CalculateField(
in_table="fLyr",
field="FLAGFIELD",
expression="'YES'",
expression_type="PYTHON3",
code_block="",
field_type="TEXT",
enforce_domains="NO_ENFORCE_DOMAINS"
)
... View more
03-21-2024
11:42 AM
|
0
|
3
|
268
|
DOC
|
@Tim-Woodfield I can't say for sure why this is occurring, but if you are working with Portal, it may be just as fast to execute ArcGIS Pro's Delete Features and Append tools.
... View more
03-21-2024
09:57 AM
|
0
|
0
|
596
|
POST
|
I tend to stick to arcpy when the functionality is available in both arcpy and ArcGIS API for Python. It minimizes the code you will have to write. For the WHERE clause, you can first create a Feature Layer using the Make Feature Layer tool.
... View more
03-20-2024
11:57 AM
|
0
|
5
|
282
|
DOC
|
@Eliot_Reid I had a feeling this may be the case. SAML is not supported. If you can, create a built-in Administrator account and use that instead.
... View more
03-20-2024
11:33 AM
|
0
|
0
|
1054
|
POST
|
Hi @kapalczynski , An easier approach may be to use arcpy. Ex: # Variables
portalURL = 'https://gis.esri.com/portal'
username = 'portaladmin'
password = 'p0rt@l@dmin1'
featureServiceURL = 'https://gis.esri.com/server/rest/services/pipes/FeatureServer/0'
# Sign into Portal
arcpy.SignInToPortal(portalURL, username, password)
# Calculate Field
arcpy.management.CalculateField(
in_table=featureServiceURL,
field="FLAGFIELD",
expression="'YES'",
expression_type="PYTHON3",
code_block="",
field_type="TEXT",
enforce_domains="NO_ENFORCE_DOMAINS"
)
... View more
03-20-2024
11:20 AM
|
0
|
8
|
291
|
Title | Kudos | Posted |
---|---|---|
1 | 2 weeks ago | |
1 | 2 weeks ago | |
2 | 2 weeks ago | |
1 | 3 weeks ago | |
3 | 3 weeks ago |
Online Status |
Online
|
Date Last Visited |
8 hours ago
|