|
POST
|
Specified_Polygon is a Result object not a FeatureLayer. Use Specified_Polygon = arcpy.SelectLayerByAttribute_management(etc...)[0] or arcpy.SelectLayerByAttribute_management(etc...).getOutput(0)
... View more
04-06-2022
01:28 AM
|
0
|
1
|
975
|
|
POST
|
Can you provide some actual detail about the API output format? Perhaps an example response.
... View more
04-01-2022
03:27 PM
|
0
|
1
|
1479
|
|
POST
|
out1 = arcpy.SetParameter(3, Point1) out2 = arcpy.SetParameter(4, Point2) Should probably be at the end of the script. You're setting the outputs before doing anything with them. Try something like: arcpy.env.overwriteOutput = True
#Inputs
Point1 = arcpy.GetParameterAsText(0)
Point2 = arcpy.GetParameterAsText(1)
Polygon = arcpy.GetParameterAsText(2)
# Select points that overlap the polygon
selected_points = arcpy.SelectLayerByLocation_management(Point1, 'INTERSECT',
Polygon).getOutput(0)
#Append selected points to the other layer.
arcpy.Append_management(selected_points, Point2, 'NO_TEST')
#Delete selected points from the original layer
arcpy.DeleteFeatures_management(selected_points)
OutPoint1 = arcpy.management.MakeFeatureLayer(Point1, "Point1")
OutPoint2 = arcpy.management.MakeFeatureLayer(Point2, "Point2")
#Outputs
out1 = arcpy.SetParameter(3, OutPoint1)
out2 = arcpy.SetParameter(4, OutPoint2)
... View more
04-01-2022
02:24 AM
|
0
|
2
|
5394
|
|
POST
|
Can you provide more details about the API and its output format?
... View more
03-30-2022
02:17 PM
|
0
|
0
|
1514
|
|
POST
|
How are parameters 3 & 4 defined in the toolbox? Data type, type, direction especially. Can you provide a screenshot of the toolbox script parameter properties?
... View more
03-30-2022
02:15 PM
|
0
|
1
|
5459
|
|
POST
|
I don't think the bug with "\n" in the code block is the problem. You're actually passing a multi line string literal into the Result function Expression: Result(r"%Value (3)%") Is getting converted by ArcGIS to: Result(r"Your text file
contents with
lots of
new
lines...") Which is a syntax error. You can use triple quotes to handle multi line string literals (did you see my other post?) Result(r"""%Value (3)%""")
... View more
03-16-2022
05:43 AM
|
0
|
1
|
3537
|
|
POST
|
chr(10) is equivalent to "\n". print(f"X{chr(10)}X")
X
X Or the os.linesep workaround noted in the bug @DuncanHornby submitted. 2019, that's pretty poor...
... View more
03-15-2022
01:19 AM
|
1
|
4
|
3585
|
|
POST
|
Leave your new lines/ carriage returns in and just wrap in triple quotes instead of single quotes in the calculate field expression. String literals inside triple quotes, """ or ''', can span multiple lines of text. r"""%Value%"""
... View more
03-14-2022
08:37 PM
|
0
|
1
|
5557
|
|
POST
|
What have you attempted? We're not here to do your homework for you, but can help you with issues you come across when doing it. The easiest way to accomplish this is to run your workflow manually, then right click each result in the history tab and select "Copy Python command" then paste the python into a script and modify as required. Give it a go. Hint, 1st tool should be Select By Attributes or Make Feature Layer with a where clause.
... View more
03-13-2022
10:26 PM
|
2
|
1
|
1578
|
|
POST
|
You don't return anything from your function. Also, readlines() returns a list, not a string. Here's a simpler version that returns a string containing the text of the file. Expression: Result(r"%Text File%") Code block: def Result(txtfile): return open(txtfile).read() You could probably even just use the following without a code block Expression: open(r"%Text File%").read()
... View more
03-11-2022
01:42 AM
|
0
|
2
|
5593
|
|
POST
|
Ugly workaround - use a "SQL Expression" datatype...?
... View more
03-10-2022
08:51 PM
|
0
|
1
|
5616
|
|
POST
|
And if you want to check Python and custom toolboxes as well, you could: for subdir, dirs, files in os.walk(searchDir):
for a in files:
if os.path.splitext(a)[-1] in (".py", ".pyt", ".tbx"):
etc...
... View more
03-10-2022
07:42 PM
|
1
|
0
|
2505
|
|
POST
|
That's the ++ increment operator. If used postfix, with operator after operand (for example, x++), the increment operator increments and returns the value before incrementing. So count++ means get current value of count variable then increment it. The code you refer to starts with an empty array (transformers = []) and an zero index (count = 0). It then loops through the objects i in fsDeviceIntersects and assigns i.globalid to the transformers array at index count, then increments count by 1 before the next iteration. It's doing the same as this: var transformers = [];
var count = 0;
for (var i in fsDeviceIntersects) {
transformers[count] = i.globalid;
count = count + 1;
};
... View more
03-10-2022
04:15 AM
|
2
|
2
|
4674
|
|
POST
|
Why am I not surprised... I'm assuming since you can import utils.utils then it is a proper python package with a utils/__init__.py and then the other submodules like utils.py etc. Possible dodgy workaround (I can't test publishing) - the docs only discuss importing modules not packages (other docs discuss how to install external 3rd party packages, but that's not relevant). But there is a section in there that talks about sys.path.append: Another technique for referencing modules to import is to use the sys.path.append method. This allows you to set a path to a folder containing scripts that you need to import. ... note that the sys.path.append method requires a folder as an argument. Since r'e:\Warehousing\Scripts' is a folder, the entire contents of the folder will be consolidated. I paraphrased the quote slightly, but it makes me think you might be able to throw in sys.path.append("utils") and the utils package and all its submodules would get consolidated and published. I don't think there would be any issue with the import utils.utils call after appending the utils dir to sys.path, I just tried in a simple python script on my local drive and it worked. But if there is, you could always sys.path.pop() or del sys.path[-1] directly after the append.
... View more
03-09-2022
01:30 AM
|
0
|
0
|
2695
|
|
POST
|
Multipart geometry confuses things, it's a bit of an artificial construct. Each part is a 1D line, but I guess a multipart line needs 2 values to locate a point on it, an x or y coordinate and the part number. So maybe it could be considered 2D......? To theoretical for me though! I prefer the inner->outer Esri definition rather than the outer->inner order you describe. Just the way I think, building things up rather than picking it apart.
... View more
03-08-2022
11:04 PM
|
1
|
0
|
5114
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-24-2022 03:08 PM | |
| 1 | 07-30-2025 03:00 PM | |
| 1 | 06-10-2025 08:06 PM | |
| 5 | 05-20-2025 07:56 PM | |
| 1 | 05-04-2025 10:34 PM |