|
POST
|
I'd try exporting out to a new shapefile/fc by adding it to ArcMap, right clicking the layer and selecting Data > Export Data. If that doesn't work, try creating a new file gdb and making a new feature dataset using your desired coordinate system and xy domain. Then, try importing the shapefile into it.
... View more
03-25-2013
11:26 AM
|
0
|
0
|
1128
|
|
POST
|
If you are working with the 'current' map document, did you make sure to use arcpy.RefreshActiveView()? Also, are you making sure to do mxd.save() at the end?
... View more
03-25-2013
11:17 AM
|
0
|
0
|
510
|
|
POST
|
If you loop through your ListLayoutElements variable, I bet you don't have anything in that list. This is why grabbing an index doesn't work and why grabbing a property of the MapsurroundElement object doesn't work. My guess is that your issue is with the text "ScaleBar" wildcard. Do you have anything in your layout with the name ScaleBar? Not all scale bars are named "ScaleBar", but rather, are named closer to what the text says when you click Insert > Scale Bar, and select a scale bar here (i.e. "Scale Line", "Stepped Scale Line", "Alternating Scale Bar", etc.) As a test, try the following to figure out what the name of your scale bar element is, and then you can use that as a wildcard in your code: scaleBar = arcpy.mapping.ListLayoutElements(mxd, "MAPSURROUND_ELEMENT")
for item in scaleBar:
print item.name
... View more
03-25-2013
08:44 AM
|
0
|
0
|
1866
|
|
POST
|
Ken, You might try using os.walk to walk through a directory and find all of your MXDs. Then use your code to check if it has an old data source and if it does, switch it out. import os
inDir = r"C:\Shared"
for root, dirs, files in os.walk(inDir):
for name in files:
if name.endswith(".mxd"):
... View more
03-22-2013
07:59 AM
|
0
|
0
|
889
|
|
POST
|
It'll keep growing. When you think about each class, you could probably find 10+ properties that each should have that aren't currently available, and I would say that many of the more common ones will come with time.
... View more
03-19-2013
04:47 PM
|
0
|
0
|
1697
|
|
POST
|
I think you are kind of limited to the properties and methods available to the MapDocument Class. Unfortunately, pageSize is a read-only property of the MapDocument class, so I don't think you're going to have much luck at this point. Might be worth an enhancement on the ideas page
... View more
03-19-2013
03:09 PM
|
0
|
0
|
1697
|
|
POST
|
Well, you do need a Feature Layer to use the Select Layer by Location tool, so if you drag and drop a shapefile, this will likely give you an error. However, if you completely take your script out of the equation, you should be able to do the following: 1. Right click your toolbox and select Add > Script 2. Click Next through the first 2 pages 3. On the parameter page, make your first parameter a feature class, and call it "input feature" 4. Make a second parameter called "SQL Expression" and select data type of SQL Expression 5. For the second parameter, in the properties, select obtained from "input feature" 6. Finish the tool, then double click it in the toolbox 7. Fill in the tool with a shp/fc 8. Click the SQL button and you should see the fields from the first parameter See if this works, and if it does, implement the same type of logic into your script.
... View more
03-15-2013
03:41 PM
|
0
|
0
|
1561
|
|
POST
|
You shouldn't need a feature layer. It works as shapefile or feature class for me. Are the fields you want coming from the shapefile parameter below the SQL expression parameter, or are you trying to obtain the fields from a feature class that is defined within the script (not a parameter).
... View more
03-15-2013
02:59 PM
|
0
|
0
|
1561
|
|
POST
|
Regarding the first part of your question, when you create the script tool parameters, make sure that you select the Obtained From box for the SQL Expression, and select the input feature that you want the fields to come from.
... View more
03-15-2013
02:37 PM
|
0
|
0
|
1561
|
|
POST
|
Could you explain how your domains are set up? Do you have duplicate values for this in your feature class? Also, is this what you are using as your sort field, or do you only use it for your name field? Any further details on how you set this up would be helpful.
... View more
03-15-2013
08:01 AM
|
0
|
0
|
577
|
|
POST
|
I agree with Mark. You could also do this in ModelBuilder using an iterator, if you feel more comfortable in that environment. This feature class iterator will go through a workspace, grab all the feature classes (you can specify geometry type), then you can just use the Feature Class to Feature Class tool to export to another gdb.
... View more
03-15-2013
07:52 AM
|
0
|
0
|
590
|
|
POST
|
You can integrate either of these into the field calculator. Select to use Python for the parser, and check to Show Codeblock. Expression should be: title(!fieldName!) Code Block: def title(name): alist = name.split(",") city = alist[0].title() final = city + "," + alist[1] return final
... View more
03-14-2013
03:56 PM
|
0
|
0
|
1026
|
|
POST
|
There could be a more elegant way, but this should do the trick: >>> a = 'AKRON, OH 12345'
>>> alist = a.split(",")
>>> city = alist[0].title()
>>> final = city + "," + alist[1]
>>> print final
Akron, OH 12345
... View more
03-14-2013
02:47 PM
|
0
|
0
|
1026
|
|
POST
|
I think the issue is with your Expression variable. Here is what you have: UpdatedField = "Update"
Expression = (" = " + "'" + arcpy.GetParameter(3) + "'")
arcpy.CalculateField_management(Selected_cnddb_point, UpdatedField, Expression, "PYTHON") If your user entered parameter was "hello", the expression would be: ='hello' and not: "Update" = 'hello'. I think your Expression variable should actually be: Expression = '"Update" = ' + "'" + arcpy.GetParameter(3) + "'"
... View more
03-14-2013
12:57 PM
|
0
|
0
|
1217
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-24-2025 10:45 AM | |
| 1 | 07-30-2025 08:26 AM | |
| 1 | 05-15-2025 07:35 AM | |
| 2 | 11-26-2024 01:27 PM | |
| 1 | 06-26-2015 10:19 AM |
| Online Status |
Offline
|
| Date Last Visited |
Tuesday
|