|
POST
|
I've searched the forums but I can't find any python examples to change field order for layers in the ArcGIS Desktop 10.6 Table of Contents. Is there another way to automate this process?
... View more
04-11-2018
06:24 AM
|
1
|
3
|
2294
|
|
POST
|
We created a form in survey123 and we'd like to use that form on our IPhones. In relation to the form, we'd like to link it to a feature service where data from certain fields are sent to the object. Would it be possible for Survey123 to create an object on the map and reference only certain fields back to the object? Most of the fields on the form will not have an associated field to the feature service but we'd still like to capture the information.
... View more
04-04-2018
05:03 AM
|
0
|
1
|
464
|
|
POST
|
I created a new survey using a Feature Service and I am getting the following error when I try to publish the survey. I assume the error is asking me to add additional characters to the field name but if I do that it won't capture the data back to the correct field. Error: The Custom feature service submission url is not compatible with the survey (Field ODERCOMPLAINTNUMBER in NEO Gas Leak length is too short 20.) Img attached:
... View more
03-20-2018
08:30 AM
|
1
|
12
|
7491
|
|
POST
|
I created a version called GIS.GIS Data so that operators out in the field could GPS data and I could review it and post the edits to my own version before reaching the Default. My only concern is that our current reconcile and post scripts is grabbing data from each of the child versions under the Default each night. Is there a command in python that would exclude any child versions created underneath another child version from being reconciled and posted to the default? I am very new to the workflow and I would really appreciate some guidance. Thanks import arcpy, time, smtplib, os
deleteVersions = False
arcpy.env.overwriteOutput = True
reconcileLog = r'C:\temp\Daily_Reconcile_Log\Reconcile_Log.txt'
# set the workspace
arcpy.env.workspace = 'C:\Users\jnmiller\AppData\Roaming\ESRI\Desktop10.6\ArcCatalog\SDE.sde'
# Set a variable for the workspace
adminConn = arcpy.env.workspace
# Block new connections to the database.
#print("The database is no longer accepting connections")
#arcpy.AcceptConnections(adminConn, False)
# Wait 15 minutes
#time.sleep(900)
# Disconnect all users from the database.
print("Disconnecting all users")
arcpy.DisconnectUser(adminConn, "ALL")
# Get a list of versions to pass into the ReconcileVersions tool.
print("Getting list of all versions")
versionList = arcpy.ListVersions(adminConn)
for version in versionList:
if 'default' in version.lower():
if 'dbo' in version.lower():
defaultVersion = 'dbo.DEFAULT'
elif 'sde' in version.lower():
defaultVersion = 'sde.DEFAULT'
# Execute the ReconcileVersions tool.
print("Reconciling/posting/deleting all versions")
if deleteVersions:
try:
arcpy.ReconcileVersions_management(adminConn, "ALL_VERSIONS", defaultVersion, versionList, "LOCK_ACQUIRED", "NO_ABORT", "BY_OBJECT", "FAVOR_EDIT_VERSION", "POST", "DELETE_VERSION", reconcileLog)
except:
reconcileMessage = "Reconcile failed: " + arcpy.GetMessages() + ". Check reconcilelog.txt file in the " + str(reconcileLog)
arcpy.AddWarning(reconcileMessage)
pass
else:
try:
arcpy.ReconcileVersions_management(adminConn, "ALL_VERSIONS", defaultVersion, versionList, "LOCK_ACQUIRED", "NO_ABORT", "BY_OBJECT", "FAVOR_EDIT_VERSION", "POST", "KEEP_VERSION", reconcileLog)
except:
reconcileMessage = "Reconcile failed: " + arcpy.GetMessages() + ". Check reconcilelog.txt file in the " + str(reconcileLog)
arcpy.AddWarning(reconcileMessage)
pass
print("Completed Reconcile & Post")
# Run the compress tool.
print("Running compress")
arcpy.Compress_management(adminConn)
print("Compress Completed")
# Allow the database to begin accepting connections again
#print("Allow users to connect to the database again")
#arcpy.AcceptConnections(adminConn, True)
print("Starting Rebuild Indexes")
# Get a list of all the datasets the user has access to.
# First, get all the stand alone tables, feature classes and rasters.
dataList = arcpy.ListTables() + arcpy.ListFeatureClasses() + arcpy.ListRasters()
# Next, for feature datasets get all of the datasets and featureclasses
# from the list and add them to the master list.
for dataset in arcpy.ListDatasets("", "Feature"):
arcpy.env.workspace = os.path.join(adminConn,dataset)
dataList += arcpy.ListFeatureClasses() + arcpy.ListDatasets()
# Get the user name for the workspace
userName = arcpy.Describe(adminConn).connectionProperties.user.lower()
# remove any datasets that are not owned by the connected user.
userDataList = [ds for ds in dataList if ds.lower().find(".%s." % userName) > -1]
# Execute rebuild indexes
# Note: to use the "SYSTEM" option the workspace user must be an administrator.
arcpy.RebuildIndexes_management(adminConn, "SYSTEM", userDataList, "ALL")
print('Rebuild Complete')
# Update statistics on the system tables
# print("Updating statistics on the system tables")
# Execute analyze datasets
# Note: to use the "SYSTEM" option the workspace user must be an administrator.
arcpy.AnalyzeDatasets_management(adminConn, "SYSTEM", userDataList, "ANALYZE_BASE","ANALYZE_DELTA","ANALYZE_ARCHIVE")
print("Analyze Complete")
print("Finished.")
... View more
03-13-2018
05:50 AM
|
1
|
4
|
2629
|
|
POST
|
When I hash out those line it seems to create EGAS\JNMILLER when I run the script the first time. If I run the script again it generates the same error. First run: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
================ RESTART: C:\Users\jnmiller\Desktop\test 3.py ================
Empty Workspace Cache
Done
Target: jnmiller
Found - "EGAS\JMEESE"
Found - "EGAS\SCRAWFORD"
Found - "EGAS\MWETZEL"
Found - sde
Found - DBO
Found - "EGAS\CCOON"
Version Created: \jnmiller
>>> Second run: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
================ RESTART: C:\Users\jnmiller\Desktop\test 3.py ================
Empty Workspace Cache
Done
Target: jnmiller
Found - "EGAS\JMEESE"
Found - "EGAS\SCRAWFORD"
Found - "EGAS\MWETZEL"
Found - sde
Found - "EGAS\JNMILLER"
Found - DBO
Found - "EGAS\CCOON"
Executing: CreateVersion "Database Connections\NEO_1.sde" sde.DEFAULT jnmiller PROTECTED
Start Time: Wed Feb 21 14:12:56 2018
ERROR 001148: Cannot create a version with the specified name.
Version already exists [jnmiller][STATE_ID = 100173]
Failed to execute (CreateVersion).
Failed at Wed Feb 21 14:12:57 2018 (Elapsed Time: 0.80 seconds)
>>>
... View more
02-21-2018
11:14 AM
|
0
|
0
|
6304
|
|
POST
|
Here's the results: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
================ RESTART: C:\Users\jnmiller\Desktop\test 3.py ================
Empty Workspace Cache
Done
Target: jnmiller
Found - "EGAS\JMEESE"
Found - "EGAS\SCRAWFORD"
Found - "EGAS\MWETZEL"
Found - DBO
Found - "EGAS\CCOON"
Found - sde
Executing: CreateVersion "Database Connections\NEO_1.sde" sde.DEFAULT jnmiller PROTECTED
Start Time: Wed Feb 21 13:36:42 2018
ERROR 001148: Cannot create a version with the specified name.
Version already exists [jnmiller][STATE_ID = 100173]
Failed to execute (CreateVersion).
Failed at Wed Feb 21 13:36:43 2018 (Elapsed Time: 0.68 seconds)
>>>
... View more
02-21-2018
10:45 AM
|
0
|
2
|
6304
|
|
POST
|
The versionName variable is in line 15. It's supposed to be getting the users windows credentials. Sorry for the confusion with the userVersion variable. I changed the name with existingVersion on my script and I didn't think to change it before replying. I'll update the first post.
... View more
02-21-2018
10:14 AM
|
0
|
0
|
6304
|
|
POST
|
Is there a reason why the CreateVersion_management keeps running if it's outside the for loop? Inside the for loop if the users version exists it's supposed to skip. And since the version exist it's supposed to set versionFound = True. Once versionFound = True the CreateVersion_management shouldn't run. ERROR 001148: Cannot create a version with the specified name.
Version already exists [jnmiller][STATE_ID = 99940]
Failed to execute (CreateVersion).
Failed at Wed Feb 21 12:36:53 2018 (Elapsed Time: 0.68 seconds) try:
for version in arcpy.da.ListVersions(sdeConnection):
if version.name.split(".")[0] == versionName:
print(userVersion)
versionFound = True
break
# Execute CreateVersion
if not versionFound:
arcpy.CreateVersion_management(sdeConnection, parentVersion, versionName, "PROTECTED")
print(createVersion)
except arcpy.ExecuteError:
print(arcpy.GetMessages())
... View more
02-21-2018
09:39 AM
|
0
|
6
|
6304
|
|
POST
|
I am trying to use the Try Except statement and I was wondering if I set it up correctly because I get an error when I run the script. I'm not sure if the error is due to the try Except or bad scripting on my part. The script checks for a connection to NEO_1. If the connection exists then it checks all the versions name. This is where I seem to get an error. Since the user already exists the break should stop the script before prompting an error? Empty Workspace Cache
Done
Connections Exists: NEO_1
Searching for User Credentials..
Windows Credentials: EGAS\jnmiller
Checking SDE for existing Credentials..
Executing: CreateVersion "Database Connections\NEO_1.sde" sde.DEFAULT jnmiller PROTECTED
Start Time: Wed Feb 21 11:38:41 2018
ERROR 001148: Cannot create a version with the specified name.
Version already exists [jnmiller][STATE_ID = 99689]
Failed to execute (CreateVersion).
Failed at Wed Feb 21 11:38:42 2018 (Elapsed Time: 0.72 seconds) # Name: SDE_CreateVersion
# Description: Creates a new SDE version
import arcpy, time, smtplib, os
from arcpy import env
arcpy.env.overwriteOutput = True
arcpy.env.workspace = "Database Connections/NEO_1.sde"
connection = arcpy.env.workspace
# Set local variables
sdeConnection = "Database Connections\NEO_1.sde"
parentVersion = "sde.DEFAULT"
versionName = os.environ.get( "USERNAME" )
fullPath = os.path.join("Windows Credentials: EGAS", versionName)
userVersion = os.path.join("Version Currently Exists: ",versionName)
createVersion = os.path.join("Version Created: ",versionName)
# Clear Workspace Cache
print("Empty Workspace Cache")
arcpy.ClearWorkspaceCache_management()
print("Done")
# Database Connection: NEO_1 = True
if arcpy.Exists(connection):
versionFound = False
try:
for version in arcpy.da.ListVersions(sdeConnection):
if version.name.split(".")[0] == versionName:
print(userVersion)
versionFound = True
break
# Execute CreateVersion
if not versionFound:
arcpy.CreateVersion_management(sdeConnection, parentVersion, versionName, "PROTECTED")
print(createVersion)
except arcpy.ExecuteError:
print(arcpy.GetMessages())
# Database Connection: NEO_1 = False
if not arcpy.Exists(connection):
print("Creating Database Connection: NEO_1")
arcpy.CreateDatabaseConnection_management(out_folder_path="Database Connections",
out_name="NEO_1.sde",
database_platform="SQL_SERVER",
instance="lan-svr-sql",
account_authentication="OPERATING_SYSTEM_AUTH",
database="NEO_1",
version_type="TRANSACTIONAL",
version="sde.DEFAULT")
arcpy.env.workspace = r"Database Connections\NEO_1.sde"
if arcpy.Exists(connection):
versionFound = False
try:
for version in arcpy.da.ListVersions(sdeConnection):
if version.name.split(".")[0] == versionName:
print(existingVersion)
versionFound = True
break
#Execute CreateVersion
if not versionFound:
arcpy.CreateVersion_management(sdeConnection, parentVersion, versionName, "PROTECTED")
print(createVersion)
except arcpy.ExecuteError:
print(arcpy.GetMessages())
... View more
02-21-2018
08:46 AM
|
0
|
8
|
9253
|
|
POST
|
I don't understand how fields w/ Date data types could possibly generate a time.. " ,7:00" time at the end. See the img below. We're using the Portal dashboard. How do I prevent a time from showing?
... View more
02-20-2018
11:50 AM
|
1
|
11
|
8925
|
|
POST
|
Would I have to republish the feature service after the version gets deleted and recreated?
... View more
02-16-2018
10:27 AM
|
0
|
1
|
1280
|
|
POST
|
I am trying to figure out the best way to create web maps with editing capabilities for our operators out in the field. Similar to a QA/QC type of situation. From what I've read and tried the only way to allow our operators editing access is by creating a version called [Operators] and publishing it with full editing capabilities. Please correct me if there is a better way to do it. And the other thing is the reconcile / post maintenance script we have. The script does a full compression every 2 weeks. Essentially it's deleting all the versions. If it's deleting the version [Operator] does that mean the web map will not work? Does anyone happen to know a workflow that will be useful? Software: ArcGIS Enterprise 10.6 Portal 10.6 ArcMap 10.5 import arcpy, time, smtplib, os
deleteVersions = True
arcpy.env.overwriteOutput = True
reconcileLog = r'C:\temp\Weekly_Reconcile_Log\Reconcile_Log.txt'
# set the workspace
arcpy.env.workspace = 'C:\Users\jnmiller\AppData\Roaming\ESRI\Desktop10.5\ArcCatalog\SDE.sde'
# Set a variable for the workspace
adminConn = arcpy.env.workspace
# Block new connections to the database.
print("The database is no longer accepting connections")
arcpy.AcceptConnections(adminConn, False)
# Wait 15 minutes
#time.sleep(900)
# Disconnect all users from the database.
print("Disconnecting all users")
arcpy.DisconnectUser(adminConn, "ALL")
# Get a list of versions to pass into the ReconcileVersions tool.
print("Getting list of all versions")
versionList = arcpy.ListVersions(adminConn)
for version in versionList:
if 'default' in version.lower():
if 'dbo' in version.lower():
defaultVersion = 'dbo.DEFAULT'
elif 'sde' in version.lower():
defaultVersion = 'sde.DEFAULT'
# Execute the ReconcileVersions tool.
print("Reconciling/posting/deleting all versions")
if deleteVersions:
try:
arcpy.ReconcileVersions_management(adminConn, "ALL_VERSIONS", defaultVersion, versionList, "LOCK_ACQUIRED", "NO_ABORT", "BY_OBJECT", "FAVOR_EDIT_VERSION", "POST", "DELETE_VERSION", reconcileLog)
except:
reconcileMessage = "Reconcile failed: " + arcpy.GetMessages() + ". Check reconcilelog.txt file in the " + str(reconcileLog)
arcpy.AddWarning(reconcileMessage)
pass
else:
try:
arcpy.ReconcileVersions_management(adminConn, "ALL_VERSIONS", defaultVersion, versionList, "LOCK_ACQUIRED", "NO_ABORT", "BY_OBJECT", "FAVOR_EDIT_VERSION", "POST", "KEEP_VERSION", reconcileLog)
except:
reconcileMessage = "Reconcile failed: " + arcpy.GetMessages() + ". Check reconcilelog.txt file in the " + str(reconcileLog)
arcpy.AddWarning(reconcileMessage)
pass
print("Completed Reconcile & Post")
# Run the compress tool.
print("Running compress")
arcpy.Compress_management(adminConn)
print("Compress Completed")
# Allow the database to begin accepting connections again
print("Allow users to connect to the database again")
arcpy.AcceptConnections(adminConn, True)
print("Starting Rebuild Indexes")
# Get a list of all the datasets the user has access to.
# First, get all the stand alone tables, feature classes and rasters.
dataList = arcpy.ListTables() + arcpy.ListFeatureClasses() + arcpy.ListRasters()
# Next, for feature datasets get all of the datasets and featureclasses
# from the list and add them to the master list.
for dataset in arcpy.ListDatasets("", "Feature"):
arcpy.env.workspace = os.path.join(adminConn,dataset)
dataList += arcpy.ListFeatureClasses() + arcpy.ListDatasets()
# Get the user name for the workspace
userName = arcpy.Describe(adminConn).connectionProperties.user.lower()
# remove any datasets that are not owned by the connected user.
userDataList = [ds for ds in dataList if ds.lower().find(".%s." % userName) > -1]
# Execute rebuild indexes
# Note: to use the "SYSTEM" option the workspace user must be an administrator.
arcpy.RebuildIndexes_management(adminConn, "SYSTEM", userDataList, "ALL")
print('Rebuild Complete')
# Update statistics on the system tables
print("Updating statistics on the system tables")
# Execute analyze datasets
# Note: to use the "SYSTEM" option the workspace user must be an administrator.
arcpy.AnalyzeDatasets_management(adminConn, "SYSTEM", userDataList, "ANALYZE_BASE","ANALYZE_DELTA","ANALYZE_ARCHIVE")
print("Analyze Complete")
print("Finished.")
... View more
02-16-2018
09:30 AM
|
0
|
3
|
1538
|
|
POST
|
We have a Reconcile/Post routine that runs once a week on our enterprise geodatabase. When the script runs and finishes the editing performance is painful. The features load very quickly outside of editing but when we begin editing the performance drop 200%. import arcpy, time, smtplib, os
deleteVersions = True
reconcileLog = r'C:\temp\Reconcile_Log.txt'
# set the workspace
arcpy.env.workspace = 'Database Connections/SDE.sde'
# Set a variable for the workspace
adminConn = arcpy.env.workspace
# Block new connections to the database.
print("The database is no longer accepting connections")
arcpy.AcceptConnections(adminConn, False)
# Wait 15 minutes
#time.sleep(900)
# Disconnect all users from the database.
print("Disconnecting all users")
arcpy.DisconnectUser(adminConn, "ALL")
# Get a list of versions to pass into the ReconcileVersions tool.
print("Getting list of all versions")
versionList = arcpy.ListVersions(adminConn)
for version in versionList:
if 'default' in version.lower():
if 'dbo' in version.lower():
defaultVersion = 'dbo.DEFAULT'
elif 'sde' in version.lower():
defaultVersion = 'sde.DEFAULT'
# Execute the ReconcileVersions tool.
print("Reconciling/posting/deleting all versions")
if deleteVersions:
try:
arcpy.ReconcileVersions_management(adminConn, "ALL_VERSIONS", defaultVersion, versionList, "LOCK_ACQUIRED", "NO_ABORT", "BY_OBJECT", "FAVOR_EDIT_VERSION", "POST", "DELETE_VERSION", reconcileLog)
except:
reconcileMessage = "Reconcile failed: " + arcpy.GetMessages() + ". Check reconcilelog.txt file in the " + str(reconcileLog)
arcpy.AddWarning(reconcileMessage)
pass
else:
try:
arcpy.ReconcileVersions_management(adminConn, "ALL_VERSIONS", defaultVersion, versionList, "LOCK_ACQUIRED", "NO_ABORT", "BY_OBJECT", "FAVOR_EDIT_VERSION", "POST", "KEEP_VERSION", reconcileLog)
except:
reconcileMessage = "Reconcile failed: " + arcpy.GetMessages() + ". Check reconcilelog.txt file in the " + str(reconcileLog)
arcpy.AddWarning(reconcileMessage)
pass
print("Completed Reconcile & Post")
# Run the compress tool.
print("Running compress")
arcpy.Compress_management(adminConn)
print("Compress Completed")
# Allow the database to begin accepting connections again
print("Allow users to connect to the database again")
arcpy.AcceptConnections(adminConn, True)
print("Starting Rebuild Indexes")
# Get a list of all the datasets the user has access to.
# First, get all the stand alone tables, feature classes and rasters.
dataList = arcpy.ListTables() + arcpy.ListFeatureClasses() + arcpy.ListRasters()
# Next, for feature datasets get all of the datasets and featureclasses
# from the list and add them to the master list.
for dataset in arcpy.ListDatasets("", "Feature"):
arcpy.env.workspace = os.path.join(adminConn,dataset)
dataList += arcpy.ListFeatureClasses() + arcpy.ListDatasets()
# Get the user name for the workspace
userName = arcpy.Describe(adminConn).connectionProperties.user.lower()
# remove any datasets that are not owned by the connected user.
userDataList = [ds for ds in dataList if ds.lower().find(".%s." % userName) > -1]
# Execute rebuild indexes
# Note: to use the "SYSTEM" option the workspace user must be an administrator.
arcpy.RebuildIndexes_management(adminConn, "SYSTEM", userDataList, "ALL")
print('Rebuild Complete')
# Update statistics on the system tables
print("Updating statistics on the system tables")
# Execute analyze datasets
# Note: to use the "SYSTEM" option the workspace user must be an administrator.
arcpy.AnalyzeDatasets_management(adminConn, "SYSTEM", userDataList, "ANALYZE_BASE","ANALYZE_DELTA","ANALYZE_ARCHIVE")
print("Analyze Complete")
print("Finished.")
Mapping Software: Version 10.6 ArcGIS Server Portal for ArcGIS Two ArcGIS Web Adaptors SQL Server 2012 Operating System Windows Server 2012 R2
... View more
02-07-2018
05:33 AM
|
0
|
3
|
1126
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-11-2018 06:04 AM | |
| 1 | 04-11-2018 06:24 AM | |
| 1 | 04-04-2019 05:59 AM | |
| 1 | 05-06-2019 08:45 AM | |
| 2 | 06-06-2019 06:32 PM |
| Online Status |
Offline
|
| Date Last Visited |
01-13-2021
02:32 PM
|