|
POST
|
Yes - you are exactly right. Popups and attribute tables are two different things, so they have to be configured separately.
... View more
11-10-2021
06:18 PM
|
1
|
0
|
1468
|
|
POST
|
@DonMorrison1 Thanks for the response. I do actually have a script to change the instance type to dedicated and set the min/min instances after a service is published. FYI you can change the Instance Type from https://<services-url>/<folder>/<serviceName.serviceType>/changeProvider Use 'ArcObjects11' for Dedicated and 'DMaps' for Shared In terms of setting the service to Dedicated with the Min/Max before publishing, I think I have that figured out now. keys = doc.getElementsByTagName('Key')
for key in keys:
k = key.firstChild.data
v = key.nextSibling.firstChild
if k == 'MinInstances':
v.data = 0 # min instance
elif k == 'MaxInstances':
v.data = 1 # max instance
elif k == 'provider':
v.data = 'ArcObjects11' # Dedicated Instance
... View more
11-09-2021
04:14 PM
|
1
|
1
|
2274
|
|
POST
|
I have a script to publish data from an SDE to ArcGIS Enterprise. The script will enable feature access in the SD draft before publishing. I'm looking for some guidance or examples on how to also change the Instance Type to Dedicated and set the min/max # of instances. The script I have defaults the services to Shared Instance. '''Modify the .sddraft file to enable overwriting services'''
# Read the file
doc = DOM.parse(sddraft_output_filename)
# Enable overwrite existing service
tagsType = doc.getElementsByTagName('Type')
for tagType in tagsType:
if tagType.parentNode.tagName == 'SVCManifest':
if tagType.hasChildNodes():
tagType.firstChild.data = 'esriServiceDefinitionType_Replacement'
'''Modify the .sddraft file to enable feature access'''
# Find all elements named TypeName
# This is where the addition layers and capabilities are defined
typeNames = doc.getElementsByTagName('TypeName')
for typeName in typeNames:
# Get the TypeName to enable
if typeName.firstChild.data == 'FeatureServer':
extension = typeName.parentNode
for extElement in extension.childNodes:
# Enable feature access
if extElement.tagName == 'Enabled':
extElement.firstChild.data = 'true'
# Get all the value tags.
values = doc.getElementsByTagName('Value')
for value in values:
if value.hasChildNodes():
# Change the default WebCapabilities from 'Query,Create,Update,Delete,Uploads,Editing' to just 'Query'.
if value.firstChild.data == 'Query,Create,Update,Delete,Uploads,Editing':
value.firstChild.data = 'Query,Create,Update,Delete'
... View more
11-09-2021
02:01 PM
|
0
|
3
|
2442
|
|
POST
|
If you can post the full code you are using (change folder and drive letter names if you want) that is a better option. You can also try lyr.replaceDataSource
... View more
11-07-2021
04:18 PM
|
0
|
1
|
2436
|
|
POST
|
No it's better to mosaic rasters in their native coordinate system, then project/resample as needed.
... View more
11-07-2021
01:27 PM
|
0
|
0
|
9040
|
|
POST
|
You can try something like within your for loop lyr.findAndReplaceWorkspacePath(find_workspace_path=lyr.dataSource, replace_workspace_path=r"C:\Newpath\To\SDE_ConnectionFile.sde") Lots of examples here: Desktop Help 10.0 - Updating and fixing data sources with arcpy.mapping (arcgis.com)
... View more
11-07-2021
01:14 PM
|
0
|
1
|
2468
|
|
POST
|
I have created a python toolbox in ArcGIS Pro that I want to share as a GP Service. The user inputs their Portal URL, username, password and the GIS Server parameter dynamically provides a dropdown with a list of GIS Servers federated to the Portal. Based on which sever is selected, the GIS Folder provides a dropdown list with available folders on that server. This works great in ArcGIS Pro. But when published to ArcGIS Enterprise as a Web Tool/GP Service, my Geoprocessing Widget in WAB does not provide the dropdowns. In fact, nothing happens. Is there a way to keep my validation code working in the GP Widget?
... View more
10-29-2021
12:54 PM
|
0
|
0
|
810
|
|
POST
|
I'm hitting the same wall with a very similar issue. Unfortuatenly I think validation code from a working Python toolbox does not carry over to the GP Widget in WAB. This guy had this same problem and 2016 and suggests building the functionality in JS rather than python. Ugh... 3 Lessons I Learned from Publishing Geoprocessing Services in ArcMap (ifeomacollins.com)
... View more
10-28-2021
08:54 PM
|
0
|
0
|
1395
|
|
POST
|
Unfortunately, I can confirm that validation code does not carry over from a Python Toolbox to GP Server. I have a Python Toolbox (not a Script Tool) published as a GP Service to ArcGIS Enterprise 1081. The toolbox has validation code to update a parameter's drop down lists based on the user updating another parameter. This functionality does not carry over to the GP Widget in Web AppBuilder after publishing as a GP Service.
... View more
10-28-2021
08:49 PM
|
1
|
0
|
4057
|
|
POST
|
I need the the index of the GIS Server the user selects as a variable to use later on in my execute. Using parameters[3].valueAsText does not provide this. I did figure this out though, so thank you for you help! def execute(self, parameters, messages): """The source code of the tool.""" # Input Parameters startTime = time.time() portal = parameters[0].valueAsText user = parameters[1].valueAsText password = parameters[2].valueAsText # Based on which server the user selects for the GIS Server drop down, get the Index Number for that to pass into the rest of the script if parameters[2].value: # If the password field is filled in gis = GIS(portal, user, password, verify_cert=False) # Connect to the GIS Portal serverList = gis.admin.servers.list() # Build a list of GIS Servers # Convert each item in the serverList to a string and add it to a new list newList = [] for item in serverList: myString = str(item) newList.append(myString) x = newList.index(parameters[3].valueAsText) # Get index value from the server list based on which server the user selects ...
... View more
10-28-2021
07:11 PM
|
0
|
0
|
605
|
|
POST
|
This is what I've tried so far, but I need to be able to use the variable 'b' in my execute function. Any ideas? def updateParameters(self, parameters): """Modify the values and properties of parameters before internal validation is performed. This method is called whenever a parameter has been changed.""" # Create a dropdown list for the GIS Server Parameter of all federated GIS Servers portal = parameters[0].valueAsText user = parameters[1].valueAsText password = parameters[2].valueAsText if parameters[2].value: # If the password field is filled in gis = GIS(portal, user, password, verify_cert=False) serverList = gis.admin.servers.list() newList = [] for item in serverList: myString = str(item) newList.append(myString) parameters[3].filter.list = newList if parameters[3] in newList: b = newList.index(parameters[3]) return
... View more
10-28-2021
11:07 AM
|
0
|
3
|
3646
|
|
POST
|
Thanks! After some tinkering, I've got it working. I can enter my portal url, user, password and I get a list of GIS Servers to choose for the 3rd parameter. def updateParameters(self, parameters):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
# Create a dropdown list for the GIS Server Parameter of all federated GIS Servers
portal = parameters[0].valueAsText
user = parameters[1].valueAsText
password = parameters[2].valueAsText
if parameters[2].value: # If the password field is filled in
gis = GIS(portal, user, password, verify_cert=False)
serverList = gis.admin.servers.list()
newList = []
for item in serverList:
myString = str(item)
newList.append(myString)
parameters[3].filter.list = newList One issue is I am using the ArcGIS Python API in line 11 to get a List of GIS Server. If I pass that list directly into my Filter List my toolbox throws this error. ValueError: FilterObject: illegal list value Turns out I need to convert each item in my serverList to a string and add it to a new list. Then, using the new list, my toolbox dropdown works correctly. Say the user selects the 2 item in the dropdown (index 1), how I store that index number as a variable in my updateParameters function and use that in my execute function later?
... View more
10-28-2021
10:27 AM
|
1
|
4
|
3649
|
|
POST
|
@Anonymous User I'm attempting a python toolbox for the first time and hitting a wall. I would like the enter the Portal URL, username, password and have the GIS Server parameter auto populate with a drop down list of all my federated servers. If I comment out the updateParameters method, then I can enter the other parameters without the error. Any ideas what I need to do here? # -*- coding: utf-8 -*-
import arcpy
from arcgis.gis import GIS
class Toolbox(object):
def __init__(self):
"""Define the toolbox (the name of the toolbox is the name of the
.pyt file)."""
self.label = "Toolbox"
self.alias = "toolbox"
# List of tool classes associated with this toolbox
self.tools = [SwitchInstanceTypeToDedicated]
class SwitchInstanceTypeToDedicated(object):
def __init__(self):
"""Define the tool (tool name is the name of the class)."""
self.label = "Edit REST Service"
self.description = ""
self.canRunInBackground = False
def getParameterInfo(self):
"""Define parameter definitions"""
param0 = arcpy.Parameter(
displayName="Portal URL eg. https://arcgis.com/portal",
name="PortalURL",
datatype="string",
parameterType="Required",
direction="Input")
param1 = arcpy.Parameter(
displayName="Username (must be Admin level)",
name="username",
datatype="string",
parameterType="Required",
direction="Input")
param2 = arcpy.Parameter(
displayName="Password",
name="password",
datatype="string",
parameterType="Required",
direction="Input")
param3 = arcpy.Parameter(
displayName="GIS Server",
name="gisSrv",
datatype="string",
parameterType="Required",
direction="Input")
params = [param0, param1, param2, param3]
return params
def isLicensed(self):
"""Set whether tool is licensed to execute."""
return True
def updateParameters(self, parameters):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
if params[0].value: # conditional to trigger setting the filter
fcFilter = params[3].filter # the parameter that the user will pick from
# your code for getting the list of servers
# Connect to GIS Portal
gis = GIS(param0, param1, param2, verify_cert=False)
# List GIS Servers
serverList = gis.admin.servers.list()
# serverList.sort() # if you want to
fcFilter.list = serverList
return
def updateMessages(self, parameters):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
return
def execute(self, parameters, messages):
"""The source code of the tool."""
arcpy.AddMessage('Hello World')
return
... View more
10-27-2021
01:22 PM
|
0
|
6
|
3670
|
|
POST
|
Thanks I will look into this. Sounds like I will need to use a Python Toolbox over a Script Tool.
... View more
10-27-2021
07:58 AM
|
0
|
2
|
3679
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | 07-16-2022 08:54 AM | |
| 1 | 11-09-2021 04:14 PM | |
| 1 | 04-13-2022 08:10 AM | |
| 1 | 11-13-2024 05:02 PM | |
| 1 | 05-06-2021 06:48 PM |
| Online Status |
Offline
|
| Date Last Visited |
a month ago
|