|
POST
|
If you have proper date fields in your data, they'll be converted into Python datetime objects when you run Calculate Field in Python3 mode. This means you can put something like this in your code block to get a decimal result: def run(start, end):
diff = end - start # creates datetime.TimeDelta object
return diff.hours + (diff.minutes / 60.0) Exercise for the reader: handle cases with null inputs.
... View more
10-10-2024
08:53 AM
|
0
|
0
|
700
|
|
IDEA
|
For persistent calculations, you can store the value in a field using Attribute Rules (as Vince mentioned) or synthesize it on demand using the Pop-up Configuration. For one-time calculations, select the rows you want then run Calculate Field on the field (right-click on the field header in the attribute table for a shortcut). That said, it would be very handy if you could right-click on individual values in either the attribute table or attribute pane to quickly select that record and launch the field calculator in one step.
... View more
10-09-2024
12:31 PM
|
0
|
0
|
1859
|
|
IDEA
|
Sounds like your local support provider was taking a nap that day: it is possible to link attachments to the appropriate Survey123 question, but you have to update the "KEYWORDS" field that's buried in the attachment table. If you're referencing EGDB data you can dig into the field in the table directly. If not (or if you want to avoid direct table editing) you can specify the KEYWORDS value for each attachment using the REST API; this sample code should point you in the right direction. That said, it would be nice if ArcGIS did a better job preserving this new field across the system, seems like it's very easy to lose it without it being obvious until it's too late.
... View more
09-27-2024
02:01 PM
|
0
|
0
|
1204
|
|
POST
|
You can even do start & end in one pass, something like:
... View more
09-26-2024
09:55 AM
|
1
|
1
|
2525
|
|
POST
|
If you have to publish this to a public repository then you might want to crosspost on a dedicated Conda forum, they should have more insight into the build system than the average ESRI user. That said, if you aren't uploading to a public system then there's a much easier way to fix your issues with conda's build system: just don't use it! Here's the cliff notes on using Python's standard packaging model: Install the "build" package to the Python environment you're using for development. Grab the folder that contains your package folder ("mailbox" in the example workflow) and add: Two empty folders, "build" and "dist" An empty file named "pyproj.toml" Your README.md (and your LICENSE file if this is leaving your company's control). You don't need anything to do with a recipe folder, nor do you need a top-level directory. Fill out your pyproj.toml as per the official guides, with extra configuration for setuptools as per its guide. The key part is your [build-system] section, this specifies your build dependencies and your build system. Mine looks like: [build-system] requires = ["setuptools >= 68.2.1","wheel"] build-backend = "setuptools.build_meta" Most of the other sections should be easy to fill out, if you run into issues with your package missing key files you can try adding: [tool.setuptools.package-data] "*" = ["esri/**"] Pop open the Python Command Prompt and run python -m build "C:\path\to\mailbox". You should now have a "tar.gz" file and a "whl" file in your "dist" folder. With the command prompt open, run pip install "C:\path\to\mailbox\dist\artifact_name.whl". This will install the package to your environment. Restart Pro and ensure you can import your module and run the installed script tools. If you can import the module but the tools fail, ensure that "esri" subfolder has all the necessary files and they're included in your "whl" file -- you can crack the whl files open with 7Zip to browse their contents to check. And there you go, now you can build and deploy your packages using pip instead of conda! The one catch is dependencies: pip will get dependencies from pypi.org instead of the dedicated conda channel, so you could clobber your environment by accident. To avoid this, always check if a dependency is available on conda and then specify that exact version in your pyproj file. You don't have to specify arcpy or any ESRI-specific dependencies if you aren't publishing to a public repository as they're a part of every Pro environment. As a bonus, you now have access to packages outside of the esri conda channel if you need extra functionality.
... View more
09-19-2024
11:46 AM
|
0
|
0
|
2479
|
|
POST
|
You might be able to use the Calculate Value utility to run all the Python code you need, but I think that just overcomplicates things. You're better off writing this as a script tool. If you're not comfortable with that then hopefully someone with more Modelbuilder experience can help.
... View more
09-19-2024
11:16 AM
|
1
|
0
|
2595
|
|
POST
|
You can use Python to read the geometry field using Cursors, then extract the in-between vertices using methods on the Polyline objects the cursor returns, then use another cursor to write the results where you need it.
... View more
09-19-2024
09:27 AM
|
0
|
2
|
2608
|
|
POST
|
Make a copy of the feature class, ensure it has the same symbology as the source layer, add records which contain the values you want to symbolize, add those options to the unique values, configure the symbols, save this to a layer file, apply this layer file to the source layer, delete the copy. Boom, you're ready for future data without tampering with the production features!
... View more
09-19-2024
09:22 AM
|
0
|
0
|
1473
|
|
IDEA
|
Should already be there, right-click on empty space in the code block or expression builder.
... View more
09-18-2024
12:16 PM
|
0
|
0
|
1164
|
|
IDEA
|
This would be a fantastic addition to all versioned datasets, the interactive view is insufficient for auditing large volumes of changes.
... View more
09-18-2024
10:11 AM
|
0
|
0
|
838
|
|
POST
|
If you're up to using Python, you can combine this function: def get_related_objects(parent_path: str) -> list[str]:
from os import path
desc = arcpy.da.Describe(parent_path)
root = path.dirname(desc["catalogPath"])
return [path.join(root, x) for x in desc.get("relationshipClassNames", [])] with your preferred export tools to dump the parent object and all related objects.
... View more
09-18-2024
09:55 AM
|
1
|
1
|
1054
|
|
POST
|
You can generate these lines database side using Attribute Rules. Use Intersects to get all towers within a given range, loop over the results and use Distance to find which point is closest, then use Geometry to construct a line from the input feature to the closest tower and insert the results into another table. Unfortunately, this is the inverse of what you want, so you won't get any lines until you submit the location, the lines won't appear in offline areas and you'll have to regularly truncate the feature classes for reference points and lines. Unless someone can post a better hack I think you're out of luck as there's no way to customize the client-side part of Field Maps like you've described. Might be worth an Idea submission!
... View more
09-12-2024
12:39 PM
|
1
|
1
|
1111
|
|
POST
|
Have you tried mapping the old schema to the new one using the Append Tool's Field Mapping options? If that isn't comprehensive enough you can use Modelbuilder or Python to transform your data into a new format, then append that instead.
... View more
09-12-2024
12:15 PM
|
1
|
0
|
1228
|
|
POST
|
The Import Toolbox docs has a section on how you have to format your toolbox URL to load it into arcpy. Note that for most services, you can't just call the tool function and then move on, you have to spin loop over the "status" property of the result object that's returned until you get one that lets you proceed, the docs have more info.
... View more
09-05-2024
12:53 PM
|
0
|
1
|
1089
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-24-2023 11:47 AM | |
| 2 | 04-09-2026 11:36 AM | |
| 1 | 09-08-2023 10:07 AM | |
| 3 | 03-26-2026 08:11 AM | |
| 2 | 03-12-2026 01:41 PM |
| Online Status |
Online
|
| Date Last Visited |
yesterday
|