|
POST
|
I'll probably not get this 100% technically correct, but here goes: Each script is blessed with a '__name__'. If the script is the main executing file, it gets the name '__main__'. You can also import any .py file as a module, like you did with RemoveAddLayer. When the code executes within RemoveAddLayer, I assume __name__ = 'RemoveAddLayer', or something similar, but definitely not '__main__'. On the flipside, if you ran a different script that imported the script you've posted above, __name__ != __main__, so that part wouldn't execute. You would still have access to the ZipShapes() function in the first script, though. Clear as mud? edit: there is lots and lots written out there. Search for '__main__' or '__name__'.
... View more
11-17-2016
02:35 PM
|
1
|
0
|
5390
|
|
POST
|
I'll echo Dan's suggestion for Densify. Then, Spatial Join the densified line segments to the nearest point (the segments will inherit the attributes of the nearest point). It gets somewhat more complicated if you only want segments to inherit attributes of the points that fall along that original segment, but it can be done with a little more work/joins.
... View more
11-17-2016
11:00 AM
|
1
|
0
|
2882
|
|
POST
|
There are vector options, too, but the simple raster solution is: Tabulate Area—Help | ArcGIS for Desktop
... View more
11-16-2016
02:06 PM
|
3
|
0
|
12065
|
|
POST
|
To set your default parameters rather than collect user input, change all the GetParameterAsText() to your desired defaults. I didn't go through the rest so there may be more changes required, but that would be a good start.
... View more
11-16-2016
10:06 AM
|
2
|
0
|
2191
|
|
POST
|
May not be the issue, but your example has an error: Image2,jp2 should have a period, not comma.
... View more
11-15-2016
04:54 PM
|
1
|
1
|
3478
|
|
POST
|
The only helpful thing I can say is I've successfully exported to EPS format, so it can be done. As Dan says, there is too little to go off for outsiders to help with a question like this. There are a million and one ways for crashes to happen, and it's something for which an ESRI support tech will have a troubleshooting checklist to guide you.
... View more
11-15-2016
11:47 AM
|
0
|
1
|
1871
|
|
POST
|
Yes, that's all correct. Are you running into issues? I could imagine a problem by naming a field "Long" just because that may be a reserved word in some cases (I usually use "Lng" to avoid problems), but not necessarily an error in this situation.
... View more
11-15-2016
10:58 AM
|
2
|
0
|
4915
|
|
POST
|
You can read more fields in the update cursor by adding them to the field list. The first field is read as row[0], next as row[1], and so on. with arcpy.da.UpdateCursor(fc2, ["SHAPE@XY","JoinedFC.XField","JoinedFC.YField"]) as cursor:
for row in cursor:
row[0] = ([row[1],row[2]])
cursor.updateRow(row)
... View more
11-15-2016
09:22 AM
|
4
|
4
|
4915
|
|
POST
|
You can't actually move geometry with a join, but you can transfer attributes between the two, calculate XY coordinates, and then create a new FC based on those coordinates. Make XY Event Layer—Help | ArcGIS for Desktop Or, join, then run an arcpy.da.UpdateCursor to update the geometry.
... View more
11-10-2016
03:21 PM
|
1
|
7
|
4915
|
|
POST
|
The only thing completely wrong in your original example is that VBScript uses double quotes for strings, not single quotes (Python uses either). You also don't need to 'dim' in VBScript, that's a VBA thing. You will also get a warning if the function returns nothing, but you can click past that.
... View more
11-10-2016
02:11 PM
|
0
|
0
|
2513
|
|
POST
|
You can see that the code doesn't ever get into the part where it changes the text (you'd also get an error because you've got elm and eml). Is the entire piece of text in the text element '2016' or 'Will County, Illinois ~ 2016'? If you want the mxd saved each time through the loop, you need to indent it. If you want to change the name of the saved mxd dynamically, based on the 'mxdname' variable, it would be something like this: mxd.saveACopy(os.path.join(path_to_your_folder, mxdname)) ^ you should use os.path.join to make paths because it handles things like slashes for you.
... View more
11-10-2016
01:57 PM
|
1
|
1
|
1247
|
|
POST
|
Yes, I used my script to change the same text in over 200 mxds within a single folder structure (i.e. including subfolders). The only thing I can think of is that my script used mxd.save() and yours uses mxd.saveACopy(...). Not sure if there is some sort of quirk there.
... View more
11-10-2016
09:21 AM
|
0
|
3
|
1247
|
|
POST
|
May not be the problem, but your path syntax is not necessarily correct - use single forward slash, double backslash, or raw string notation (as you did for the first path). Other than that, does the folder exist that you're trying to save to? And, obviously, do you have write access?
... View more
11-09-2016
02:02 PM
|
1
|
5
|
3812
|
|
POST
|
I think you must have a different setting than I do. Hitting enter when first adding text simply finishes the text element - it doesn't add a new line. I suppose hitting enter inside the text properties adds a new line, but regardless, the text should still appear.
... View more
11-09-2016
01:47 PM
|
0
|
0
|
4001
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-30-2013 02:22 PM | |
| 1 | 04-12-2011 11:19 AM | |
| 1 | 09-17-2021 09:43 AM | |
| 1 | 04-04-2012 12:05 PM | |
| 2 | 07-16-2020 11:31 AM |
| Online Status |
Offline
|
| Date Last Visited |
07-15-2023
12:11 AM
|