|
POST
|
You could list the fields, then compare the list to see if the field is within using an if statement like you said. What might also work is to just 'try' to grab the value, and use null if it fails for any reason. (the field doesnt exist, there is no value etc) Cursor example try:
value = row.getValue('field')
except:
value = None
... View more
05-03-2017
01:47 AM
|
1
|
0
|
1058
|
|
POST
|
You cannot add elements using Arcpy.Mapping Maybe you could solve the issue the 'other way round', update a template, and then use arcpy to pull in the datasets from the existing mxds.
... View more
02-20-2017
08:54 AM
|
1
|
0
|
804
|
|
POST
|
Please try using this handler instead: username = "A USERNAME"
pw = "PASSWORD"
adminUrl = "https:///portal/sharing/rest
tokenUrl = "https:///portal/sharing/rest/generateToken"
sh = arcrest.PortalTokenSecurityHandler(username=username, password=pw, org_url=adminUrl, token_url=tokenUrl)
... View more
02-14-2017
04:44 AM
|
0
|
0
|
1872
|
|
POST
|
Have never used these features, but the getting started page on ArcRest handles tokens not via a url: import arcrest
from arcresthelper import securityhandlerhelper
config = {'username': 'myusername', 'password': 'myp4ssword'}
token = securityhandlerhelper.securityhandlerhelper(config)
admin = arcrest.manageorg.Administration(securityHandler=token.securityhandler)
content = admin.content
userInfo = content.users.user()
userInfo.folders This securityhandlerhelper takes a token URL as a optional parameter: arcresthelper package — ArcREST 3.5.4 documentation e.g. you can do: token = securityhandlerhelper.securityhandlerhelper(config, token_url=tokenURL)
... View more
02-13-2017
07:08 AM
|
0
|
2
|
1872
|
|
POST
|
Hi, Your script: 1) Creates the layer with default symbology 2) Adds it to the map. 3) Changes the symbology of the original layer. (Not the one that is now in the map) 4) Exports the map. You need to either: a) find reference to the layer in the map after you have added it and change the symbology here. OR b) Change the symnbology of the layer, and then add to the map.
... View more
02-09-2017
05:19 AM
|
2
|
0
|
1740
|
|
POST
|
The documentation for field mappings, as done through python objects is pretty good, when you can get your head round them What were you specifically trying to achieve, I can probably bash up a sample for you to show you how it works for your use.
... View more
01-30-2017
08:45 AM
|
0
|
0
|
1436
|
|
POST
|
I feel that you are probably hosting data yourself, using an older version of ArcGIS server? We are on 10.3 and it seems to be a bug due to this. (I have a tech support ongoing regarding zoom to on group filter widgets)
... View more
01-24-2017
09:00 AM
|
0
|
0
|
1100
|
|
POST
|
what happens if you query it using the REST HTML interface for one of these records: e.g. change this url to your services: https://Aserver.com/arcgis/rest/services/SMP_Portal/luke_test/MapServer/0/query?f=html Then type in a 'Where' clause that returns a record you cannot see. Does this show any results for the query?
... View more
01-24-2017
08:38 AM
|
0
|
1
|
1336
|
|
POST
|
Your question seems to be something that is very easy to solve in python. How do we know that ObjectID 3 corresponds to the 1st record? Without knowing the relationships in your data we are unable to assist.
... View more
01-17-2017
04:42 AM
|
0
|
0
|
716
|
|
POST
|
Hey, try this code and see if it works!: __author__ = 'WebbL'
import arcpy, os
arcpy.env.workspace = arcpy.GetParameterAsText(0)
obszar = arcpy.GetParameterAsText(1)
out = arcpy.GetParameterAsText(2)
clip_outputs = [] # An Empty list where we will keep track of all our clip outputs
datasetList = arcpy.ListFeatureClasses()
for dataset in datasetList:
featureClassName = arcpy.ValidateTableName(dataset, out)
outFeatureClass = os.path.join(out, featureClassName)
if dataset != os.path.basename(obszar):
try:
arcpy.Clip_analysis(dataset, obszar, outFeatureClass, "")
#Remember this output for the export to CAD step step
clip_outputs.append(outFeatureClass)
except:
print arcpy.GetMessages()
#Now we export to CAD
Cad_path = os.path.join(out, "CAD_Output.DWG")
arcpy.ExportCAD_conversion(clip_outputs, "DWG_R2010", Cad_path)
... View more
01-13-2017
03:40 AM
|
1
|
0
|
2761
|
|
POST
|
Just to be sure, did you refresh the "Input" folder in catalog? As we are not providing a workspace for the CAD outputs, the CAD drawings should be going into the arcpy.env.workspace you set, which is your input folder (WSADOWY), and not the output folder you highlight in the image.. I did notice an indentation error under the "Except" statement which might cause issues.
... View more
01-12-2017
07:01 AM
|
1
|
2
|
2761
|
|
POST
|
As I said, if you look at the errors the code will output, you should see it says: "Output dataset already exists" as part of your except:
print arcpy.GetMessages() As you have the try, except outside the loop, what happens is: Clip 1st layer Export first layer to CAD Clip 2nd layer Crash as output New.DWG already exists (You have this message being printed..) Then, it exits the try except loop so stops processing. Here I have given each CAD a unique name, and moved the try except so that it does not stop ALL processing when it crashes. (Just skip the current dataset) arcpy.env.workspace = arcpy.GetParameterAsText(0)
obszar = arcpy.GetParameterAsText(1)
out = arcpy.GetParameterAsText(2)
datasetList = arcpy.ListFeatureClasses()
index = 0
for dataset in datasetList:
index +=1
featureClassName = arcpy.ValidateTableName(dataset, out)
outFeatureClass = os.path.join(out, featureClassName)
if dataset != os.path.basename(obszar):
try:
arcpy.Clip_analysis(dataset, obszar, outFeatureClass, "")
output_CAD_name = 'CAD_' + str(index) + '_New.Dwg'
arcpy.ExportCAD_conversion(outFeatureClass, "DWG_R2010", output_CAD_name)
except:
print arcpy.GetMessages()
... View more
01-12-2017
04:48 AM
|
1
|
0
|
2761
|
|
POST
|
What happends if you try to do it using the path you passed in instead of a result object: We are obviously only expecting 1 CAD drawing to be output, as it will crash / overwrite it as we are saving it to the same path each time. e.g. arcpy.GetParameterAsText(0) + "\\"+ "result_cad.dwg" import arcpy
import os
arcpy.env.workspace = arcpy.GetParameterAsText(0)
obszar = arcpy.GetParameterAsText(1)
out = arcpy.GetParameterAsText(2)
try:
datasetList = arcpy.ListFeatureClasses()
for dataset in datasetList:
featureClassName = arcpy.ValidateTableName(dataset, out)
outFeatureClass = os.path.join(out, featureClassName)
if dataset != os.path.basename(obszar):
arcpy.Clip_analysis(dataset, obszar, outFeatureClass, "")
arcpy.ExportCAD_conversion(outFeatureClass, "DWG_R2010", 'result_cad.dwg')
except:
print arcpy.GetMessages()
... View more
01-12-2017
03:32 AM
|
1
|
2
|
2761
|
|
POST
|
You are correct I didnt see you had fixed that part, by processing the values simulataneously in one pass of the cursor. Both solutions may be helpful as he may not know in advance all combinations required to be created maybe
... View more
01-06-2017
07:41 AM
|
0
|
0
|
2911
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-29-2019 07:45 AM | |
| 1 | 05-13-2013 07:11 AM | |
| 1 | 05-24-2011 07:53 AM | |
| 1 | 05-22-2017 05:01 AM | |
| 2 | 07-29-2019 05:34 AM |
| Online Status |
Offline
|
| Date Last Visited |
10-22-2024
10:40 AM
|