POST
|
Hi Al, I'd definitely recommend keeping all of the data in the same table and having a drop down. Where are you aiming to display the data, in a web map in ArcGIS Online? You can set up filtering on a layer within web maps in AGOL, and ArcGIS Dashboards and Web Experience Builder/Web App Builder also have filter tools that would allow a user to query the data in a drop down box as they please. You may also just want to consider symbolising on the species field so you can easily see which species are where - Field Maps also now allows for the configuration of filtering by specific fields in a layer which would allow your data collectors to see the points for a specific species in the field too. Cheers, Josh
... View more
04-14-2023
06:41 PM
|
0
|
0
|
760
|
POST
|
Have you confirmed that the intersect outputs what you want it to when you run it manually? I've updated the user above's code to store unique names for the input county/counties and print them at the end. aprx = arcpy.mp.ArcGISProject("CURRENT")
m = aprx.listMaps("Map")[0]
county = ["Dude County"]
projectfilepath = "C:\\Users\\User\\Documents\\ArcGIS\\Projects\\ARCPY_test\\"
datafilepath = "C:\\Users\\User\\Documents\\ArcGIS\Data\\"
to_KMZs_filepath = "Circuits_KMZs\\"
parcel = "Counties_(v17a)"
gdb = datafilepath + to_KMZs_filepath
counties = m.listLayers(parcel)
import os
fields = ["LABEL", "NAME_1"]
names = {}
for dirpath, dirnames, filenames in os.walk(rootdir):
for file in filenames:
if file.endswith("kmz"):
try:
arcpy.conversion.KMLToLayer(
in_kml_file = m.addDataFromPath(os.path.join(gdb,file)),
output_folder = projectfilepath,
output_data = file + "_LAYER",
include_groundoverlay="NO_GROUNDOVERLAY"
)
line = m.listLayers(file + "\Polylines")
tmp_int = arcpy.analysis.Intersect(
in_features = [counties, line],
out_feature_class = r"memory\temp_intersect",
output_type = "POINT"
)
with arcpy.da.SearchCursor(tmp_int, fields) as s_cursor:
for label, name_1 in s_cursor:
if label in county: # remove this conditional and adjust the indents below for it to include all counties in the intersect
print(f"{name_1}")
if label not in names: #if county not present as key in dictionary add it and add first name_1 value as a list
names[label]= [name_1]
print(f"Added {label} and {name_1} to names dictionary")
else:
if name_1 not in names[label]: #if county present as key and name_1 not in list of names, add it
names[label].append(name_1)
print(f"Adding {name_1} to {label} in dictionary")
else: #if name already in list of names for county key in dict, don't add it
print(f"Not adding {name_1} as already present in dictionary")
except Exception:
arcpy.AddMessage(os.path.join(rootdir, file))
# print the final message
for k, v in totals.items():
print(f'County: {k} | names: {v}') The temp layers will always be overwritten with the above code because the output name is the same every time it's run, what we're doing here is extracting the information we want from the temporary layer, storing it to a dictionary outside of the for loop (so it's persisted) and then looping through the dictionary values at the end.
... View more
04-14-2023
03:16 PM
|
1
|
0
|
547
|
POST
|
Hi, I think the structure of your data is fine as it gives you the granularity you would need to chain multiple selectors and filter down to the specific data you're interested in! Probably the best way to do this is to add multiple "Category" selectors (one for each variable) set to "Grouped" values and pointing to the respective fields you're wanting to filter by, so one Wind selector pointed at the "Wind" field etc.. With the grouped values this will a drop down where you can choose "True" or "False" and it will filter the rest of the data in your dashboard, once you've configured that in the "Actions" portion of the selector setup.
... View more
04-14-2023
02:21 AM
|
0
|
0
|
175
|
POST
|
Adding to the above poster's comment, if you're doing this in a smart form/Field Maps, then you can just edit the final line to be this: IIF($editcontext.editType == "INSERT", nearStation.station_name, destinationField) With destinationField being the field you're writing the station name to. Which will mean that if a point is being added for the first time it will do the intersect and populate the field with the closest station, but if it's an update/edit then it just returns the current field value.
... View more
04-14-2023
12:28 AM
|
0
|
0
|
249
|
POST
|
Hi, Do you just need to indent from the "fields" line down? With the search cursor outside of the for loop it'll keep overwriting the "memory\temp_intersect" output for each KML and then just run the search cursor over the final KML layer that is intersected. Although this would print out the values for each KML separately which it doesn't sound like you want the output to be. If you do want it all in one final search cursor, you could output each temp intersect layer with a different name (so it's not overwritten every time), then add a merge above the "fields" line to bring them all together, and use the merged layer as the input into your cursor?
... View more
04-14-2023
12:17 AM
|
1
|
0
|
586
|
POST
|
Hi Abhishek, I've just downloaded a csv from the open data site you linked and despite the fields being labelled x/y those are latitudes and longitudes (x=longitude, y=latitude). And in the reverse geocode example you posted the results are in WGS84 (WKID4326) which is latitude and longitude. You can plug them into google maps and it will work, I've done this with the top row of the csv below
... View more
04-07-2023
03:45 PM
|
2
|
0
|
763
|
POST
|
My pleasure, glad that worked and that I could help out! I am also eagerly awaiting the day that attribute rules are supported, but glad this is an interim solution at least!
... View more
04-06-2023
01:01 PM
|
0
|
0
|
1030
|
POST
|
Weird, outputting the layer using feature class to feature class and storing it in the 'memory' workspace may be a decent option for temporary data, but if your process of outputting to a .lyrx is working then all good I guess!
... View more
04-06-2023
12:33 AM
|
0
|
1
|
2678
|
POST
|
Hi, If it's not automatically adding it you may be able to sandwich it within the following code to get it to add to the map - haven't tried it myself but it's the manual way of adding a layer to a map. myProject = arcpy.mp.ArcGISProject("CURRENT") #references current pro project
myMap = myProject.activeMap
#the rest of the code
myMap.addLayer(outputLayer)
... View more
04-06-2023
12:19 AM
|
0
|
3
|
2691
|
POST
|
Hi, If you're running it from within Pro then MakeFeatureLayer should automatically add it to your active map. Although in testing this I've realised that MakeFeatureLayer doesn't honour the selection which is annoying. Does it have to be a temporary layer? If not then exporting to feature class should work https://pro.arcgis.com/en/pro-app/latest/tool-reference/conversion/feature-class-to-feature-class.htm If not you will need to take the selected features on the input and add their ObjectIDs to the where_clause in the MakeFeatureLayer function. This should work: inputLayer = 'yourlayername'
outputLayer = 'outputlayername'
OIDS = arcpy.Describe(inputLayer).FIDSet #returns a string of all the OBJECTIDs
sql = "OBJECTID IN ({})".format(OIDS.replace("; ", ",")) #formats the OBJECTiD string into the format of (1, 2, 3) required for SQL IN
arcpy.management.MakeFeatureLayer(inputLayer, outputLayer, where_clause=sql)
... View more
04-06-2023
12:00 AM
|
1
|
5
|
2693
|
POST
|
Hi Kim, The new "Form" functionality in Map Viewer and Field Maps allows you to have a calculation using Arcade. I've done something similar and I believe my steps were something along the lines of: Intersect the current feature with your overlay layer, indicating which side of town it's in https://developers.arcgis.com/arcade/function-reference/featureset_functions/#intersects Get the layer to query itself (filter function https://developers.arcgis.com/arcade/function-reference/featureset_functions/#filter) to find records with an "S" or "N" in the AssetID field, then use Order By (filtered features, "AssetID Desc") to get the one with the highest number at the top, and First(OrderedFeatures) to get the top one Grab the final four characters of the id by doing Right(FirstFeature.AssetID, 4) , then cast it to a number by using Number(RightFeature) Get the next number by doing += 1 on the above number Add the leading zeroes by taking your number and doing Text(mynum, "0000") Concatenate "VALV-" + the N/S string + "-" + the number with the padded zeroes from the step above This will then work in that web map or field maps app. Not quite the same as using attribute rules but the best way I've found of doing it in AGOL so far, hope that helps!
... View more
04-05-2023
11:09 PM
|
0
|
2
|
1058
|
POST
|
Do you want to do the selection in ArcPy as well or will you be selecting them using the regular tools in the GUI and then running some python to create the layer? This page https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/make-feature-layer.htm has the details of the make feature layer tool which is what you want, just click on "Python" in the Parameters section to see what the function is + what the inputs are. Pretty sure that by default if your input features into the tool have a selection on them that that will be honoured in any ArcPy tool.
... View more
04-05-2023
10:45 PM
|
0
|
7
|
2710
|
POST
|
Hi Aurelian, Unless I'm misunderstanding I think you might be over-complicating things. When adding the indicator widget you're able to add a filter (in this case FREQ_MAINTENANCE not equal 0) and choose the statistic as "SUM" on "Shape_Length". Cheers, Josh
... View more
04-03-2023
02:33 AM
|
0
|
0
|
267
|
POST
|
Hi, I believe this support article shows an example of what you're trying to do: https://support.esri.com/en-us/knowledge-base/how-to-show-attachments-from-a-related-tablelayer-in-t-000027210 pulling the images from a related table onto the parent features popup. In this example it only returns the first image, but I think the code could be modified to return all images.
... View more
04-01-2023
03:50 PM
|
0
|
0
|
351
|
Title | Kudos | Posted |
---|---|---|
1 | 05-21-2023 10:47 PM | |
1 | 07-28-2020 10:24 AM | |
1 | 04-06-2023 12:00 AM | |
1 | 06-27-2023 10:36 PM | |
1 | 06-27-2023 10:14 PM |
Online Status |
Offline
|
Date Last Visited |
08-04-2023
06:55 AM
|