|
POST
|
Using the "Add Data -> XY Point Data" button starts the XY Table To Point tool. This tool takes your input table (Excel) and creates a new point feature class, using the X and Y values of the table. This feature class is a normal feature class, meaning that you can't just input coordinates and expect the geometry to appear. You kinda have to do it the other way around: create a new feature https://pro.arcgis.com/en/pro-app/2.7/help/editing/get-started-editing.htm#ESRI_SECTION1_C1B1369180244477B87A7D72C1E8C9C5 if you need the coordinates, calculate X and Y https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/calculate-geometry-attributes.htm or use an Attribute Rule https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/an-overview-of-attribute-rules.htm
... View more
11-22-2021
11:30 PM
|
2
|
1
|
24156
|
|
POST
|
#arcpy.CalculateField_management("UT_CROSSING","DISCREPTION","!COMPANY!" + " " + "!LOCATION!" + " " + "!TYPE!" + " " + "!SIZE!" ,"PYTHON")
# this gives the following string, which isn't a valid python expression, into CalculateField:
#expr = "!COMPANY! !LOCATION! !TYPE! !SIZE!"
# What you want to do is something like this:
# Notice that the expression is wrapped in single quotes
expr = '!COMPANY! + " " + !LOCATION! + " " + !TYPE! + " " + !SIZE!'
# even better
expr = '" ".join([!COMPANY!, !LOCATION!, !TYPE!, !SIZE!])'
arcpy.CalculateField_management("UT_CROSSING","DISCREPTION",expr ,"PYTHON") Or use Arcade: expr = 'Concatenate([$feature.COMPANY, $feature.LOCATION, $feature.TYPE, $feature.SIZE], " ")'
arcpy.CalculateField_management("UT_CROSSING","DISCREPTION",expr ,"ARCADE")
... View more
11-21-2021
10:25 PM
|
1
|
1
|
4357
|
|
POST
|
Yeah, filtering by date can be iffy, as different DBMSs handle it differently. Try converting your date to a string: var inspectionDate = Text($feature.DATE, "Y-M-D")
... View more
11-18-2021
11:24 PM
|
0
|
1
|
4771
|
|
POST
|
Edit and run this code in the python window. input_path = "path:/to/your/SHP.shp"
output_path = "path:/to/output/folder_or_gdb"
# get unique values for id1 and id2
raw_ids = [r for r in arcpy.da.SearchCursor(input_path, ["ID1", "ID2"])]
ids = [ri[0] for ri in raw_ids] + [ri[1] for ri in raw_ids]
unique_ids = list(set(ids))
# loop through unique_ids
for uid in unique_ids:
where_clause = "ID1 = {0} OR ID2 = {0}".format(uid)
output_name = "Polygons_{}".format(uid)
arcpy.conversion.FeatureClassToFeatureClass(input_path, output_path, output_name, where_clause)
... View more
11-18-2021
11:17 PM
|
0
|
0
|
1421
|
|
POST
|
AFAIK, not directly. You have a few options: use Arcade to show the virtual value in the popup create the field, but calculate it automatically using an attribute rule instead of publishing a feature class, publish a database view that contains the virtual field, calculated with SQL
... View more
11-18-2021
10:57 PM
|
1
|
0
|
1569
|
|
POST
|
You could assign geotags to the logos and run GeotaggedPhotosToPoints, creating an attachment tables from the logos and then symbolize the points with the attachments (see last point of the list below). This might be simpler and can be done completely in ArcGIS: Input: Table (Excel/CSV/etc) with X, Y, LogoPath import table into ArcGIS Pro right-click on the table -> Display XY Data -> save as point feature class add field LogoData (BLOB) read the logos into the feature class with this python script (run in ArcGIS Pro Python window) with arcpy.da.UpdateCursor("NameOfLogoLayer", ["LogoPath", "LogoData"]) as cursor:
for row in cursor:
with open(row[0], "rb") as f:
cursor.updateRow([row[0], f.read()]) symbolize the layer Single Symbol Allow symbol property connections Picture Marker, map File to LogoData, set size Result:
... View more
11-17-2021
11:44 PM
|
3
|
8
|
4531
|
|
POST
|
A simple if/else is not going to work here, because any number of purpose fields can have values. If you do a simple if/else chain like below, only the first purpose will be returned, completely ignoring possible other purposes. // THIS IS WRONG, DON'T DO THIS
if(!IsEmpty($feature.PurposeA)) {
// if PurposeA is filled ("Butterfly Garden" in the example), the expression will end here.
// Other purpose fields (PurposeD - "Dog Garden") will be ignored!
return $feature.PurposeA
}
if(!IsEmpty($feature.PurposeB)) {
return $feature.PurposeB
}
if(!IsEmpty($feature.PurposeC)) {
return $feature.PurposeC
}
if(!IsEmpty($feature.PurposeD)) {
return $feature.PurposeD
}
... View more
11-17-2021
10:54 PM
|
0
|
1
|
1539
|
|
POST
|
// build an array of the purpose field values
var purposes = [
$feature.PurposeA,
$feature.PurposeB,
$feature.PurposeC,
$feature.PurposeD,
$feature.PurposeE
]
// use that to build an array of non-empty purpose values
var non_empty_purposes = [] // empty array
for(var p in purposes) { // loop through purposes
if(!IsEmpty(purposes[p])) { // if purpose is not empty (null or "")
Push(non_empty_purposes, purposes[p]) // append to array
}
}
// return the concatenated array as string
return Concatenate(non_empty_purposes, ", ")
... View more
11-17-2021
10:48 PM
|
1
|
0
|
1540
|
|
POST
|
var fs = FeatureSetByName($datastore, "FeatureClassWithSubtypes", ["*"], true)
// filter for subtype
// if you only care for a specific subtype:
fs = Filter(fs, "SubtypeField = 2")
// if you care for variable subtypes (different for each $feature):
var subtype = $feature.TargetSubtype
fs = Filter(fs, "SubtypeField = @subtype")
// intersect
var intersect_fs = Intersects(fs, $feature)
// return
if(Count(intersect_fs) > 0) {
return First(intersect_fs).Attribute
}
return null
... View more
11-17-2021
10:32 PM
|
1
|
1
|
1761
|
|
POST
|
Ah. Then the script gets easier. Select the feature you want to update in the master layer. If the input layer has more than one record, select the corresponding feature there, too. Run the script in the python window. You just have to edit lines 1 and 2. input_layer_name = "name_of_the_input_layer"
master_layer_name = "name_of_the_master_layer"
active_map = arcpy.mp.ArcGISProject("current").activeMap
input_layer = active_map.listLayers(input_layer_name)[0]
master_layer = active_map.listLayers(master_layer_name)[0]
new_shape = [r[0] for r in arcpy.da.SearchCursor(input_layer, ["SHAPE@"])][0]
with arcpy.da.UpdateCursor(master_layer, ["SHAPE@"]) as cursor:
for row in cursor:
cursor.updateRow([new_shape])
... View more
11-16-2021
10:26 PM
|
1
|
0
|
3815
|
|
POST
|
Glad to have helped. Please accept the answer so that the question is marked as solved.
... View more
11-16-2021
10:04 PM
|
0
|
0
|
3928
|
|
POST
|
Yeah, no wonder it goes crazy. Your HTML is pure chaos. It doesn't close the style declaration of the td, it doesn't close the td or the tr, it tries to close a div (???) but uses the wrong sign. Also, you have the tr outside of the table... It's a good idea to write each tag on its own line, with indentation, and to close a tag before you work on its content. That way, you catch things like that more easily and the HTML becomes more readable. You can always shorten the code after making sure it works. <table style="width:100%;">
<tbody>
<tr style="display:{expression/expr8};">
<td style="padding:5px;background-color:{expression/expr12};">
<b>The following equipment is stored in the warehouse</b>
</td>
</tr>
<!-- other tr's -->
</tbody>
</table> Also, make sure that you actually have a default value in the When function in expr12. https://developers.arcgis.com/arcade/function-reference/logical_functions/#when
... View more
11-16-2021
01:55 AM
|
2
|
0
|
3308
|
|
POST
|
// load the feature set
var fs = FeatureSetByName($datastore, 'TrailLinesQAQC')
// filter for name
var name = $feature.name
var filtered_fs = Filter(fs, "name = @name")
// get sum of sec_length_ft
return Sum(filtered_fs, "sec_length_ft") This should work, too: // do it with GroupBy
var group = GroupBy(FeatureSetByName($datastore, 'TrailLinesQAQC'),'name',
{name: 'trail_ft', expression: 'sec_length_ft', statistic: 'SUM'})
// you still have to filter it
var name = $feature.name
var filtered_group = Filter(group, "name = @name")
return First(filtered_group).trail_ft
... View more
11-15-2021
11:35 PM
|
0
|
2
|
3945
|
|
POST
|
If the input and master layers have a common field: geometry_layer_name = "name_of_the_layer_with_the_right_geometry"
attribute_layer_name = "name_of_the_layer_with_attributes_and_wrong_geometry"
common_field = "name_of_the_common_field"
# this will change the geometry of the second layer's underlying data, so back it up!
active_map = arcpy.mp.ArcGISProject("current").activeMap
geometry_layer = active_map.listLayers(geometry_layer_name)[0]
attribute_layer = active_map.listLayers(attribute_layer_name)[0]
# read the correct geometries and save them in a dictionary
# {common_field_value: shape}
cursor = arcpy.da.SearchCursor(geometry_layer, [common_field, "SHAPE@"])
shapes = dict([row for row in cursor])
# loop through the second layer and update the geometries
updated_features = []
with arcpy.da.UpdateCursor(attribute_layer, [common_field, "SHAPE@"]) as cursor:
for row in cursor:
try:
new_shape = shapes[row[0]]
# only update if the geometry is different, fill the updated_features list
if not new_shape.equals(row[1]):
cursor.updateRow([row[0], new_shape])
updated_features.append(row[0])
except KeyError:
print("No new geometry found for feature with {} = {}".format(common_field, row[0]))
# build an SQL query of the updated_features, depending on whether common_field is a text field or not
if updated_features and isinstance(updated_features[0], str):
sql = "{} IN ('{}')".format(common_field, "', '".join(updated_features))
else:
sql = "{} IN ({})".format(common_field, ", ".join([str(uf) for uf in updated_features]))
# print the SQL query
print("Updated the geometry of {} features:\n{}".format(len(updated_features), sql))
... View more
11-15-2021
11:22 PM
|
1
|
2
|
3832
|
|
POST
|
Ah, so your field formatting isn't consistent. It isn't a bug, it's exactly what you told the computer to do. Take a look at your expressions: Split($feature.Equipment, ",")
// "Car,Boat" -> ["Car", "Boat"]
// "Car, Boat" -> ["Car", " Boat"]
// -> Test for "Boat" will fail in the second case Yeah, removing the spaces in the table would be good. Alternatively (or additionally), you can also remove the spaces in the expression: Split(Replace($feature.Equipment, " ", ""), ",")
... View more
11-15-2021
06:37 AM
|
1
|
2
|
3316
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-30-2023 09:57 AM | |
| 1 | 05-18-2023 12:51 AM | |
| 1 | 03-05-2023 12:46 PM | |
| 1 | 12-07-2022 07:01 AM | |
| 1 | 06-21-2022 08:27 AM |
| Online Status |
Offline
|
| Date Last Visited |
02-03-2024
06:14 PM
|