|
POST
|
To access AGOL, use the url https://www.arcgis.com Don't use reserved names (Portal) as variable names. It's no problem here because you don't need to call Portal() anymore, but you could run into prroblems with other expressions if you let that become a habit. var p = Portal("https://www.arcgis.com")
var cities = FeatureSetByPortalItem(p, "0218468f0d8f40daa9b5aa79b88ca961", 1, ['admin4_en2', 'primary_destination', 'parentglobalid'])
... View more
01-31-2023
01:33 AM
|
0
|
0
|
910
|
|
POST
|
PopupInfo has a list of TableMediaInfo objects. l_cim = l.getDefinition("V2")
media = arcpy.cim.CIMPopup.CIMTableMediaInfo()
media.fields = ["Field"]
popup = arcpy.cim.CIMPopup.CIMPopupInfo()
popup.mediaInfos = [media]
l_cim.popupInfo = popup
l.setDefinition(l_cim)
... View more
01-30-2023
09:38 AM
|
3
|
0
|
3299
|
|
POST
|
I don't have ArcMap installed anymore, can't test. But it should honor split policy according to A quick tour of attribute domains—ArcMap | Documentation (arcgis.com) If you don't see that behavior, that might be a question for the ArcMap community.
... View more
01-30-2023
06:13 AM
|
1
|
0
|
1721
|
|
POST
|
If you assign to a variable, the messages don't show:
... View more
01-30-2023
05:58 AM
|
0
|
0
|
1717
|
|
POST
|
Sounds like you defined a domain for that field and didn't set the split policy to "Duplicate": Introduction to attribute domains—ArcGIS Pro | Documentation
... View more
01-30-2023
05:47 AM
|
1
|
0
|
1728
|
|
POST
|
Yeah, sometimes arcpy can be tricky with the conversion between Result objects, geoprocessing xyz objects and the "pure" xyz objects. In this case, you can just create a new SpatialReference with the factory code of your extracted sr: m = arcpy.mp.ArcGISProject("current").activeMap
extent = m.defaultCamera.getExtent()
map_sr = m.spatialReference
map_point = arcpy.PointGeometry(arcpy.Point(extent.XMin,extent.YMin), map_sr) # error
map_sr = arcpy.SpatialReference(map_sr.factoryCode)
map_point = arcpy.PointGeometry(arcpy.Point(extent.XMin,extent.YMin), map_sr) # works
... View more
01-30-2023
05:41 AM
|
2
|
0
|
3957
|
|
POST
|
The advanced_search method of ContentManager has a max_items argument, that sadly isn't documented in the parameters table. Setting that to a high value might help. from arcgis.gis import GIS
gis = GIS("home")
users = gis.users.search(max_users=1000)
query = " OR ".join([f"owner:{u.username}" for u in users])
results1 = gis.content.advanced_search(query)["results"]
results2 = gis.content.advanced_search(query, max_items = 200000)["results"]
len(results1) # 100
len(results2) # 190189
... View more
01-30-2023
05:16 AM
|
0
|
2
|
3081
|
|
POST
|
The arcpy way of doing this: import arcpy
fc = "C:\Temp\ProjectModel.gdb\TempAvgs_ExportFeatures1"
fields = ['GeologicUnit', 'Analyte']
unique_combinations = {
row
for row in arcpy.da.SearchCursor(fc, fields)
}
for unit, analyte in unique_combinations:
print(unit, analyte)
# create a layer with all rows of that values combination
sql = f"GeologicUnit = {unit} AND Analyte = {analyte}" # add single quotes around {unit} and {analyte} if those fields are strings
layer = arcpy.management.MakeFeatureLayer(fc, f"{unit}_{analyte}", sql)
# do your geoprocessing on this layer
arcpy.analysis.Intersect([layer, some_other_layer], f"Intersect_{unit}_{analyte}")
... View more
01-28-2023
04:14 AM
|
1
|
1
|
2350
|
|
POST
|
Use Feature to Point to get a point feature class with the centroids of your polygons. Drag the csv into your map (or use Table to Table to convert it into a gdb tale) Use Add Join or Join Field to join the table to the points. If you used Add Join, export the layer into a new feature class to make the join permanent.
... View more
01-26-2023
09:14 AM
|
1
|
1
|
1298
|
|
POST
|
for the point fc shall I use Length or Area on line 9? What about points that are on the boundary of the polygon - technically they are on the boundary of 2 polygons? Hmmm. If your ElectoralDivisions do not overlap each other, then a point will only be on one polygon, except when it is on the boundary, as you said. So either use your original code (take the first intersecting polygon) or create a small buffer around the point and use Area(). Note that we intersect the buffer, not the $feature: // load the other featureset
var fs = FeatureSetByName($datastore, "Highways.HIGHWAYMGR.ElectoralDivisions")
// get all features from fs that intersect the current $feature
var f_buffer = Buffer($feature, 1 "meters")
var i_fs = Intersects(fs, f_buffer)
// find the ElectDiv of the feature with the greatest intersection with $feature
var greatest = 0
var name = null
for(var i_f in i_fs) {
var current = Area(Intersection(f_buffer, i_f))
if(current <= greatest) { continue }
greatest = current
name = i_f.Name
}
return name But this will probably still return the same result as First(i_fs). You could also sort the intersecting polygons by some column and the return the First(). For example, if you have a field ElectoralDivisions.Population and you want to return the name of the polygon with the highest population when the point is on the border of 2 polygons: // load the other featureset
var fs = FeatureSetByName($datastore, "Highways.HIGHWAYMGR.ElectoralDivisions")
// get all features from fs that intersect the current $feature
var i_fs = Intersects(fs, $feature)
// sort the intersecting features by population, descending
var sorted = OrderBy(i_fs, "Population DESC")
// return the name of the intersecting feature with the highest population
var greatest_pop = First(sorted)
if(greatest_pop == null) { return null }
return greatest_pop.Name I've updated the field ElectDiv to the name field. Are the changes below ok? Yeah, looks good
... View more
01-26-2023
09:03 AM
|
0
|
0
|
1422
|
|
POST
|
OK, at least we found it... You can ask the author of the WMS to disable time on the WMS or to supply parameters to do it yourself. If they don't, you probably have to live with the time slider.
... View more
01-26-2023
08:35 AM
|
0
|
0
|
2682
|
|
POST
|
https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/make-feature-layer.htm The tool expects you to input a single path and a single layer name. So you have to do it in a loop: for path, name in zip(full_fcs, serials):
arcpy.management.MakeFeatureLayer(path, name)
... View more
01-25-2023
11:40 AM
|
1
|
1
|
2147
|
|
IDEA
|
Ah, nevermind, I found the issue: If you drag&drop the feature service into your map, it gets grouped in a layer. If you let it stay that way, then you can't select the error row for tables. If you ungroup the service layer, it works.
... View more
01-25-2023
10:48 AM
|
0
|
0
|
1885
|
|
IDEA
|
I just tested it on my personal ArcGIS Pro (also 3.0.3), and it works as expected, with the same feature service. Must be something with my setup at work. Thanks for checking!
... View more
01-25-2023
10:45 AM
|
0
|
0
|
1886
|
| 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
|