|
POST
|
Thanks Dan. Funny how it's easy to miss the tiny things. It didn't fix the errors though. I did find though that by commenting out mxd.save() it executes correctly. Not sure why it doesn't want to save to that location.
... View more
09-01-2016
06:47 AM
|
0
|
0
|
1307
|
|
POST
|
Hello Everyone, I have a model which runs the calculate value tool: The code in the tool is: When the model runs the following errors are displayed: I'm not sure what the errors are related to. What's strange is that the code does seem to execute: it displays the extent of the site_polygon layer, sets the scale to 1:4000, then creates the JPG file. Any insights appreciated. Thanks!
... View more
08-31-2016
03:21 PM
|
0
|
27
|
6474
|
|
POST
|
Good point. Thanks Chris. I had previously read that a while ago.
... View more
08-02-2016
12:10 PM
|
0
|
2
|
1872
|
|
POST
|
Hello, I am working on a model and one of the steps executes a script (script is called AddLayerSitePolygon(2)). The purpose of the script is to: add a layer named "site_polygon" rename the layer to "PROPOSED - site_polygon" add a new layer named "site_polygon" The end result being that 2 new layers are added to the TOC ("site_polygon" and "PROPOSED - site_polygon"). When I watch the model execute I can see that the script works as I see the 2 layers get added to the TOC, but then right after they are removed from the TOC. Afterwards if I go ahead and run the script on it's own (outside of the model) it works as expected, the layers are added to the TOC and they stay there. I cannot figure out why it is that when the script is run within the model that the layers get removed from the TOC? Here is what the script looks like: import arcpy
##Reference the Current map document.
#Add site_polygon
mxd = arcpy.mapping.MapDocument("Current")
df = arcpy.mapping.ListDataFrames(mxd)[0]
NewLayer = arcpy.mapping.Layer("site_polygon.lyr")
arcpy.mapping.AddLayer(df, NewLayer, "AUTO_ARRANGE")
AddLayerSitePolygonResult = True
mxd.save()
#Rename site_polygon to "PROPOSED - site_polygon"
for lyr in arcpy.mapping.ListLayers(mxd):
if lyr.name in ("site_polygon"):
lyr.name = "PROPOSED - site_polygon"
mxd.save()
#Add site_polygon
df2 = arcpy.mapping.ListDataFrames(mxd)[0]
NewLayer2 = arcpy.mapping.Layer("site_polygon.lyr")
arcpy.mapping.AddLayer(df2, NewLayer2, "AUTO_ARRANGE")
AddLayerRenameSitePolygonResult = True
arcpy.SetParameter(0, AddLayerRenameSitePolygonResult)
mxd.save()
arcpy.RefreshTOC()
arcpy.RefreshActiveView() And here is a picture of where the script is in the model: Thanks for any help!
... View more
08-02-2016
09:07 AM
|
0
|
7
|
2858
|
|
POST
|
Yes I am. So now when I think about it, it makes sense. But it's not what I want to do. Site_polygon is a empty layer, all I want to do is to copy a parcel from the OPF PARCEL layer and paste it into site_parcel, without having it removed from TOC and losing it's symbology. Is there a better way I should be looking into doing this? Thanks
... View more
06-01-2016
07:17 AM
|
0
|
2
|
1303
|
|
POST
|
Hello everyone, I have the following model which adds a field to site_polygon. It works fine but it also removes site_polygon from the TOC. Which I don't understand why this happens. I can drag site_polygon back onto the map from Catalog but it will not have any of the symbology that it had before. I find it works the same if I use "Delete Field" also. Thanks. Any ideas appreciated. Chris
... View more
05-31-2016
02:54 PM
|
0
|
4
|
4119
|
|
POST
|
Thanks for the link Curtis. I'm just happy I stumbled across the answer. Cheers
... View more
05-06-2016
06:42 AM
|
1
|
0
|
6126
|
|
POST
|
Well, this is a strange one. I did a bit of reading on another thread I found from a google search where someone said that: "I came across this same issue and tried everything. Turns out the issue was that the layer name that I was giving the output started with a number and you cannot use the copy features tool to write to a fgdb if the layer name you are giving it starts with a number. There are other rules for how to name your output layer regarding this as well. It was a while back so I'm not sure of the source for that information. All I know is that it worked once I fixed my output name." (modelbuilder - ArcGIS Model Builder Copy Features tool fails with 10.2 fGDB as input - Geographic Information Systems St… ) So even though my output name didn't start with a number I thought I'd change it from "site_polygon2" to "site_polygonA" and see if that made any difference and it works. Weird one for sure. Thanks for all the suggestions, Chris
... View more
05-05-2016
01:30 PM
|
1
|
2
|
6126
|
|
POST
|
Hi Chris, Thanks for the input. I replaced the blank spaces with underscores, there's nothing I can do about the "." as this data is coming from our corp SDE. The blank spaces were just part of groupings set up in the mxd file. So I made the changes and reran the model and the results are still the same. The output path to site_polygon2 looks fine: Then I started wondering what I have set for current & scratch workspaces, where I saw that they are pointing to the Default.gdb: Looking in there shows that site_polygon2 is not there: So I seem to still be where I started. The suggestions are much appreciated though. Thanks!
... View more
05-05-2016
12:09 PM
|
0
|
0
|
6126
|
|
POST
|
I was hoping it would be as simple as that, but unfortunately it is not checked. Thanks Ben, Chris
... View more
05-05-2016
11:32 AM
|
0
|
0
|
6126
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-10-2020 03:34 PM | |
| 1 | 02-23-2021 11:53 AM | |
| 1 | 02-16-2021 09:15 AM | |
| 1 | 12-10-2020 07:46 AM | |
| 1 | 01-18-2019 09:54 AM |
| Online Status |
Offline
|
| Date Last Visited |
04-22-2021
04:31 PM
|