|
POST
|
I don't know if and how you can create a button like that. But: You can configure the popup of the layer so that it shows a clickable Mail link. That works for Layers in a web map /app (through Portal). It doesn't work in Pro for me, but that might be restrictions of my institution, maybe it works for you... Configure the popup of your layer (in Pro or in Map Viewer), switch to the HTML source. <a href="mailto:{MailField}">Send me a mail!</a>
<br>
<a href="mailto:{MailField}?subject=Parsed%20subject%20line">Send me a mail with a pre-written subject line!</a>
<br>
<a href="mailto:{MailField}?subject=Parsed%20subject%20line&body=Parsed%20body%20content">Send me a mail with pre-written subject line and body content!</a>
... View more
04-07-2021
10:52 AM
|
1
|
1
|
1847
|
|
POST
|
You can change the color of the popup window's top bar (Web AppBuilder -> Design -> Style). To change the window's size and border colors, you need javascript. I don't think you can change that in the Map Viewer or the Web AppBuilder. You can use HTML to style the content of the popup, though. While configuring the popup in the Map Viewer, change to HTML source:
... View more
04-07-2021
03:27 AM
|
1
|
1
|
1607
|
|
IDEA
|
Not really what you're asking for, but you can reset your panes, maybe that helps somewhat:
... View more
04-07-2021
03:09 AM
|
0
|
0
|
4693
|
|
POST
|
Does this do what you want? #specify fields from target dataset to be updated
oldFields = ("WAM_ID","LastServiceDate")
#specify fields from source dataset
newFields = ("wam_id","date")
#use search cursor to collect values from source dataset
newValues = arcpy.da.SearchCursor(gateInspections,newFields,"wam_id is not Null")
inspections = [row for row in newValues]
unique_wam_ids = set([i[0] for i in inspections])
valDict = {uid: [i[1] for i in inspections if i[0] == uid] for uid in unique_wam_ids}
# valDict contains a list of datetime.datetime objects for each wam_id
# valDict = {"wam_id_1": [datetime(), datetime(), datetime()],
# "wam_id_2": [datetime(), datetime()],
# "wam_id_5": []
# }
fcRows = arcpy.da.UpdateCursor(inFC,oldFields, "WAM_ID is not Null")
try:
for row in fcRows:
wam_id = row[0]
try:
# find the inspection dates for the given wam_id and sort them
inspection_dates = sorted(valDict[wam_id])
except KeyError:
# no inspection found -> skip rest of the for block
logFile.write('No inspection for valve {0}.\n'.format(wam_id))
continue
# somehow, there isn't a valid date -> skip the rest of the for block
if len(inspection_dates) == 0 or inspection_dates[-1] is None:
continue
# write the most current inspection
last_inspection = inspection_dates[-1] # we sorted above, [-1] is the most current date
fcRows.updateRow([wam_id, last_inspection])
except:
# your outer try-except block
pass
... View more
04-07-2021
03:03 AM
|
1
|
1
|
1883
|
|
POST
|
If you only want to delete the attachments, but keep the features they are attached to: attach_table = 'CustodianInspection__ATTACH'
##Step 1 -Search the atttachment table and export as jpegs with REL_GUID in filename
## Use UpdateCursor instead of SearchCursor
with da.UpdateCursor(attach_table, ['DATA', 'ATT_NAME', 'REL_GLOBALID']) as cursor:
for item in cursor:
attachment = item[0]
file_GUID = "GUID_" + str(item[2])
filename = file_GUID + str(item[1])
open(temp_dir + os.sep + filename, 'wb').write(attachment.tobytes())
cursor.deleteRow() # Delete this attachment
del item
del attachment If you don't need the features whose attachments you have exported, you can just delete the features and the attachments are deleted automatically.
... View more
04-06-2021
02:03 AM
|
0
|
1
|
2187
|
|
POST
|
Create another expression: // expression/display_reservation_link
// returns 'none' if the feature is not reservable, else returns 'block'
var reservable = $feature.Reservable // or however you determine if the feature is reservable
return IIF(reservable, 'block', 'none') Go into your popup, switch to HTML source. Find your link and put it into a div: <div style="display:{expression/display_reservation_link};">
<a href="{expression/reservation_link}">Click here to Learn How to Reserve!</a>
</div>
... View more
03-25-2021
07:04 AM
|
1
|
8
|
5098
|
|
POST
|
Something like this? return closest_address.street_name + " " + closest_address.house_number + ", " + closest_address.zip_code + " " + closest_address.town_name Or for better readability: var street = closest_address.street_name
var house = closest_address.house_number
var zip = closest_address.zip_code
var town = closest_address.town_name
return street + " " + house + ", " + zip + " " + town I haven't figured out calling feature attributes by variables, yet: // These work:
return $feature.Attribute
return $feature["Attribute"]
// This doesn't (in my experience):
var att = "Attribute"
return $feature[att]
// When working with features that aren't $feature (e.g. your closest_address), only this seems to work:
var f = First(Intersect(FeatureSetByName(...), $feature))
return f.Attribute
... View more
03-25-2021
06:31 AM
|
1
|
1
|
2228
|
|
POST
|
I could reproduce the different object types when manually running the commands in the python window (<Polygon object at ...>) vs running the function (<geoprocessing describe geometry object at ...>). I could not reproduce your problem (empty output). You also said one value in the output was an error, but that should be the expected outcome when merging all found features, right? I edited your code, as I couldn't use yours with my data structure and multiple features. Maybe it works better for you. # fcs_list: list of paths to the feature classes
# where_clauses: list of where clauses used to select only certain entries from a feature class ("SELECT * FROM feature_class WHERE ...")
# fname: path to the output feature class
def extract_cursor(fcs_list, where_clauses, fname):
# ensure correct input
## if len(fcs_list) != len(where_clauses):
## raise ValueError("fcs_list and where_clauses have to be the same length!")
## desc_list = [arcpy.da.Describe(fc) for fc in fcs_list]
## if not all([desc["dataType"] == "FeatureClass" for desc in desc_list]):
## raise ValueError("All elements of fcs_list have to be feature classes!")
## if len(set([desc["shapeType"] for desc in desc_list])) > 1:
## raise ValueError("All elements of fcs_list have to be of the same geometry type!")
# extract all applicable shapes from all feature classes
shapes = []
for fc, where in zip(fcs_list, where_clauses):
shapes += [row[0] for row in arcpy.da.SearchCursor(fc, ["SHAPE@"], where)]
# merge the shapes
merged_shape = shapes[0]
for s in shapes:
## print(s) # <-- this prints <geoprocessing describe geometry object at ...>
merged_shape = merged_shape.union(s)
# save the merged shape
arcpy.management.CopyFeatures(merged_shape, fname) You can call it like this: import sys
sys.path.append('path/to/zachs_arc_scripts')
from zachs_geo_script import extract_cursor
fcs_in ['kentucky','missouri','kansas']
where_clauses = ["rivers = 'rural'", "streams = 'rural'", "rivers = 'seasonal'"]
# you can also write more complex queries:
# "rivers IN ('rural', 'seasonal')"
# "TextField = 'text' OR IntField = 5"
# "rivers = 'rural' AND river_length > 9000"
fname = 'merged_rivers_ky_mo_ks'
extract_cursor(fcs_in, where_clauses, fname)
... View more
03-22-2021
05:09 AM
|
1
|
0
|
5992
|
|
POST
|
Your screenshot shows how the variable "ecosystem" is calculated, but not how it is written into the feature class. I understand that you don't want to post the whole script, but to help you, we need to know how the field is written. Please tell us: Dou you run the script in the Python Window in ArcGIS? If yes: ArcMap or ArcGIS Pro? If yes: Do you need the feature class loaded in the map as a layer? Do you run the script as a standalone script (e.g. double click or from the command line or a Python IDE)? Please look for code blocks that include any of the following and post them: arcpy.da.UpdateCursor arcpy.UpdateCursor arcpy.CalculateField_management arcpy.management.CalculateField
... View more
03-16-2021
05:03 AM
|
0
|
0
|
1901
|
|
POST
|
@JamesJordan, @DanAllen , @DerekHunt1 I'm pretty late to the party, but maybe it still helps... This sounds like a job for Python, not Arcade. Open the Python window: Edit this code, paste it in the Python window and execute it (make sure you don't have selections in the layers!). 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
with arcpy.da.UpdateCursor(attribute_layer, [common_field, "SHAPE@"]) as cursor:
for row in cursor:
try:
new_shape = shapes[row[0]]
cursor.updateRow([row[0], new_shape])
except KeyError:
print("No new geometry found for feature with {} = {}".format(common_field, row[0]))
... View more
03-10-2021
11:16 PM
|
2
|
5
|
6465
|
|
POST
|
What you are trying is not possible in this form. Attribute Rules work on the database level, while joins only work in a map. The original tables don't have these joins, hence your rule can't find the specified field. Assuming you have a relationship between Parcel_Copy_Test and Parcelview_Copy based on PIN: var parcels = FeatureSetByName($datastore, "Parcel_Copy_Test", ["PIN"], true)
var first_intersected_parcel = First(Intersects(parcels, $feature))
var pin = first_intersected_parcel.PIN
var parcelviews = FeatureSetByName($datastore, "Parcelview_Copy", ["PIN", "ADCO_PIN"])
var adco_pin = First(Filter(parcelviews, "PIN = @pin")).ADCO_PIN
return adco_pin
... View more
03-07-2021
10:48 PM
|
1
|
1
|
845
|
|
POST
|
I would start by making it a bit simpler: var evalID = $feature.EvaluationID
var sql = "SpeciesEvaluationID = @evalID"; // automatically takes care of the right syntax
var tbl = Filter(FeatureSetByName($map, "VegSpecies", ['*'], false), sql);
var speciesList = []; // Make this a list
var oneRow = [];
for (var species in tbl) {
// Handle both attributes at the same time
oneRow = Split(species.RightBankNoxiousCommonName + ',' + species.LeftBankNoxiousCommonName, ',');
for (var i in oneRow) {
speciesList[Count(speciesList)] = oneRow[i]; // Just append every found species
}
}
return Concatenate(Distinct(speciesList), ', ') // Extract unique species and concatenate In ArcGIS Pro, both your code and my simplification work. Do you get an error message?
... View more
03-03-2021
12:21 AM
|
0
|
0
|
2159
|
|
POST
|
Intersects and Touches both have pictures indicating what will be selected. Based on your screenshots above, your "h overlay" layer intersects your parcels, so you probably should use Intersects. I don't know what's wrong with the code, it works for me. Maybe someone else can help? @DanPatterson , @JoeBorgione ?
... View more
03-02-2021
07:43 AM
|
0
|
2
|
3955
|
|
POST
|
Ah, I think I misunderstood your original question... Does this do what you want? // Get all features of the LandUse layer that are intersected by the selected feature.
// You apply a negative buffer here, so you don't get land use features that only intersect with the outer edges, is that correct?
var intersect_layer = Intersects(FeatureSetByName($map, "LandUse - h Provision Overlay"), Buffer($feature, -10, 'feet'))
// No intersecting features found -> "n/a"
if(Count(intersect_layer) == 0) {
return "n/a"
}
// Define and initialize the variable that stores your text
var intersected_land_uses = ""
// Loop through the intersecting land use features
for (var f in intersect_layer ) {
var land_use = IIF(IsEmpty(f.NAME), "n/a", f.NAME)
if (intersected_land_uses == "") { // there is nothing in here yet
intersected_land_uses = land_use
} else { // there is something in here already, append with " And "
intersected_land_uses += " And " + land_use
}
}
return intersected_land_uses
... View more
03-02-2021
06:00 AM
|
1
|
2
|
3963
|
|
POST
|
What Dan and Davin said. Plus, you can just do this: #projFields = arcpy.ListFields(projArea)
#x = False
#for f in projFields:
# if f.name == "Acres":
# x = True
projFieldNames = [f.name for f in arcpy.ListFields(projArea)] # extract field names
x = "Acres" in projFieldNames # Test if field "Acres exists
... View more
03-01-2021
10:57 PM
|
1
|
0
|
4605
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-05-2023 12:46 PM | |
| 1 | 12-07-2022 07:01 AM | |
| 1 | 06-21-2022 08:27 AM | |
| 1 | 09-18-2023 04:55 AM | |
| 1 | 11-07-2022 11:15 PM |
| Online Status |
Offline
|
| Date Last Visited |
02-03-2024
06:14 PM
|