|
POST
|
Hi Mike, here's my latest version, in case you're interested. I used your suggestions. //Script title: Set polyline M-values to cumulative length of line
var geom = Dictionary(Text(Geometry($feature)));
var paths = geom['paths'];
//Using the Equals() function doesn't work as expected. See: Arcade: Editing M-values not treated as change to geometry (https://community.esri.com/t5/arcgis-pro-questions/arcade-editing-m-values-not-treated-as-change-to/m-p/1153917)
//if (Equals(Geometry($feature), Geometry($originalfeature)) ) {
if (Text(Geometry($feature)) == Text(Geometry($originalfeature))) {
console("The geometry has not changed. We don't need to redefine the M-Values.")
return
} else {
//Alternatively, this could be done with the Arcade distance() function. I chose to do the math manually so that the script can be used elsewhere, such as VSCode (for debugging).
function pythagoras(x1, y1, x2, y2) {
return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
}
var oldX = paths[0][0][0];
var oldY = paths[0][0][1];
var line_length = 0;
for (var path_idx in paths) {
for (var point_idx in paths[path_idx]) {
var newX = paths[path_idx][point_idx][0];
var newY = paths[path_idx][point_idx][1];
//For multi-part features, we want the M-value for additional parts to start at the last M-value from the last part. We don't want to measure the distance *between* parts.
//So, for the first vertex in a given part, we will skip calculating the length between vertices.
if (point_idx != 0) {
line_length += pythagoras(oldX, oldY, newX, newY);
}
//We can use a negative slice: it will work when there is no Z.
paths[path_idx][point_idx][-1] = line_length;
oldX = newX;
oldY = newY;
}
}
console("The geometry has changed. So we *will* redefine the M-Values.")
return { "result": { "geometry": Polyline(geom) } };
} @JohannesLindner might find this interesting. Cheers!
... View more
03-21-2022
08:48 AM
|
0
|
0
|
5859
|
|
IDEA
|
@JohannesLindner Fair enough. @KoryKramer, feel free to close. Cheers.
... View more
03-21-2022
07:50 AM
|
0
|
0
|
2393
|
|
POST
|
I have a multipart polyline in an ArcGIS Pro 2.9.2 feature class: (NAD83 UTM 17N) I can set the M-values to the cumulative distance of the line by using the Set As Distance tool (setting "Starting M" to zero): That works as expected. Part #2's M-values are in the correct order (ascending). However, if I do a different test, the results are unexpected: Drop the measures. Try a slightly different feature: Change the X-coordinate of part #1, vertex 2...from 130 meters to 135 meters. Re-do the test: Set the M-values to the cumulative distance of the line by using the Set As Distance tool (setting "Starting M" to zero). Now, part #2's M-values are in the incorrect order (descending): Question: Why are the M-values in the incorrect order? (descending) I would expect the M-value order to be the same as the vertex index's order (ascending). Thanks!
... View more
03-21-2022
07:32 AM
|
0
|
2
|
1525
|
|
IDEA
|
@JohannesLindner @Thanks, what I meant was: explode a given polyline part into multiple 2-vertex segments (split at each vertex).
... View more
03-21-2022
04:48 AM
|
0
|
0
|
2425
|
|
IDEA
|
Could an Arcade function be added that would explode geometries into separate lines for each segment? That would be helpful when doing complex analysis on polyline segments.
... View more
03-21-2022
03:54 AM
|
1
|
6
|
2457
|
|
IDEA
|
I support this idea (related). @NicholeSalinger, and for anyone else who’s interested: As a last resort, in enterprise GDBs, and depending on the DB type (Oracle, etc), we might have the option of making HTTP calls via the database. For example, Oracle has the UTL_HTTP package that can make HTTP calls from PL/SQL. So in theory, we could use that in conjunction with a database trigger to make a call to an external system. Or make the HTTP call from a database view, and then use that related view in an arcade script: Arcade: Use related DB views as FeatureSets That's far from ideal; it’s complicated, would take some time/effort from the DBA to set up, and would be clunky to manage. But it might work as a very last resort. I’ve seen it used in systems that aren’t configurable (except through the database) for integrations between systems.
... View more
03-21-2022
03:40 AM
|
0
|
0
|
9431
|
|
IDEA
|
@jcarlson I updated the idea to clarify what I meant: convert feature vertices to points. Thanks.
... View more
03-20-2022
09:13 PM
|
0
|
0
|
1074
|
|
IDEA
|
@DanPatterson Developer subscriptions seem pretty high, if we’re only using it for home use/training purposes.
... View more
03-20-2022
06:53 AM
|
0
|
0
|
1977
|
|
IDEA
|
Idea: Could Esri consider offering a “home use program” for ArcGIS Developer? For example, some companies offer a program where employees can get a discount on products, if their employer has already paid for the product. The idea being, the employee wants to use the product at home, for professional development purposes. But, it would be unrealistic to pay thousands of dollars for the software, since they already have access to it at work. Still, the employee would like to use the product at home, so that they can have more freedom to experiment, and would even be willing to pay for it. But the key thing is, the price needs to be reasonable. Otherwise, the employee won’t be interested in paying for it. Microsoft has a program like that for their products. You tell them your company email address, they verify your employer already pays for the product, and then they give you a discount on the price (the discount is sent to your work email address). Otherwise, they know people won’t be interested in paying full price for the product if they already have access to it at work. It seems like a clever revenue source: https://www.microsoft.com/en-ca/home-use-program Could Esri consider doing something similar? It would be pretty great to be able to learn and experiment with things like AppStudio at home, since that’s not something I have time for at work right now. And I’d be happy to sign a contact that says it’s for home-use only. Would that be doable? Thanks. (an aspiring ArcGIS app developer…who can’t afford the price of a yearly Developer subscription)
... View more
03-20-2022
04:18 AM
|
0
|
4
|
2015
|
|
IDEA
|
I wonder if something like this would be possible: Using an Arcade function, send an HTTP request to an external system, and receive text or JSON back as a response.
... View more
03-19-2022
11:25 PM
|
0
|
2
|
3620
|
|
IDEA
|
Could Esri consider adding a Arcade function for getting the endpoint of a polyline? (including multipart lines) Similar to ST_Geometry’s St_Endpoint() function. Related: Arcade: Get endpoint coordinates of multi-part polyline
... View more
03-19-2022
10:43 PM
|
4
|
4
|
3241
|
|
IDEA
|
In the Arcade IsSimple() function docs: IsSimple(inputGeometry) -> Boolean Indicates if the given geometry is topologically simple. It would help if the docs could explain what is meant by “topologically simple”. Not everyone reading those docs is fluent in topology lingo.
... View more
03-19-2022
09:53 PM
|
2
|
2
|
1486
|
|
POST
|
When using the Arcade Intersects() function on a point and a polyline: Is a search tolerance used? The reason I ask: If I were to zoom in enough, I would think that the point would be close to the line, but wouldn’t truly intersect the line. (Unless the line has a vertex that is exactly the same as the point.) If that’s the case, then is it implied that a certain search tolerance or buffer is used? If so, how big is the tolerance? Image source: Arcade Intersects() function docs
... View more
03-19-2022
09:42 PM
|
0
|
1
|
1122
|
|
IDEA
|
Could the Densify() function be enhanced so that it can be used on a featureSet, not just an individual feature? For example, densify a handful of polylines that were returned from a FC using the Filter() function.
... View more
03-19-2022
06:34 PM
|
1
|
0
|
681
|
|
IDEA
|
Could Esri consider adding a Arcade function that could convert multipart feature vertices to points?
... View more
03-19-2022
09:35 AM
|
0
|
3
|
1127
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-20-2026 02:12 PM | |
| 1 | 03-19-2026 11:42 AM | |
| 1 | 06-03-2026 04:02 AM | |
| 1 | 03-18-2026 07:08 PM | |
| 2 | 3 weeks ago |