|
POST
|
Hi @AndrewHankinson, So the easiest way to go about this is to use the IsEmpty() function to see if there are any values in the field. This would check to see if a field has no values. I don't know if you are asking if the entire field has some value or if it is per hectare but if you want to know if which ones are empty, or vice versa, then you can use the filter function to write a short sql query to filter by. Ex: '<fieldname> IS NULL' or '<fieldname> IS NOT NULL' If you want to go further and filter by the grid then you simply add AND plus the other field and value to filter by.
... View more
11-08-2024
04:29 AM
|
1
|
0
|
960
|
|
POST
|
Hi @Ed_ , Try the solution below. My assumption is you it may be something to do with the layer name but it is hard to say what the issue is. // Store the layer as a variable
var layer = FeatureSetByName($map, "sf")
// Filter the attribute value and count values
var FilterField = "attribute1"
var FilterValue = 'YES'
var YesCount = Count( Filter( layer , FilterField + ' = @FilterValue' ) )
// If the current feature's attribute is "Yes", add 1 to the count
iif ($feature.attribute1 == "Yes" , yesCount + 1 , null ) Also, is your problem similar to the one found on stack overflow. Because if it is, then that would help anyone else here point you in the right direction. Similar sounding issue
... View more
11-07-2024
01:05 PM
|
1
|
0
|
1417
|
|
POST
|
Hi @GretaFerloni Python would be your best bet for this. Here are a few sources to help you along with that. Create a new project Create a new folder
... View more
10-16-2024
04:59 AM
|
0
|
0
|
1225
|
|
POST
|
Hi @FionaHayward, My hunch is that there is either a space in one of the values in the list of values or there is a trailing space at the end of one of the non-empty values. Try going through and using the <string_value>.strip() method to remove any spaces.
... View more
10-10-2024
06:53 AM
|
2
|
1
|
1217
|
|
POST
|
Hi @cat206 If you are using a python script then simply add a field that you can populate with the arcade expression and use that instead. I have used that method before.
... View more
10-01-2024
05:21 AM
|
0
|
0
|
2272
|
|
POST
|
Hi @cat206, GetFeatureSetInfo(GetFeatureSet($feature)).layerName does not need the GetFeatureSet. Simply having the $feature or using $featureset will do the trick. The other thing is, have you tried using console to see what it prints out because it should return the layer name only. If there are characters in the name that you don't want, then you can simply use split text function, which returns an array, and then select the first index of that array to get the name.
... View more
09-30-2024
04:54 AM
|
0
|
2
|
2347
|
|
POST
|
Hi @jacob_loughridge Just to give you another tip about coding, especially in GIS, it is best to reduce using gp tools in a script or mid script since those create other features that then need to be utilized, which further complicates scripts. The one cool thing about the geometry methods in arcpy is you can also project features to different projections using projectAs (spatial_reference, {transformation_name}) geometry method.
... View more
09-19-2024
06:02 AM
|
0
|
0
|
549
|
|
POST
|
It could be it is having trouble reading the geometry of the line feature; depending on if you are using shapefiles vs featureclasses. It is generally recommended to avoid using shapefiles and use featureclasses in filegeodatabases since shapefiles are notorious for getting corrupted. Another option is to read through all of the segments and all of the points in the segments to find the closest point. Read through the line feature class to see if any shape value return. If there is a corrupted record, it will return as a null value.
... View more
09-17-2024
10:56 AM
|
0
|
2
|
2302
|
|
POST
|
Yes. It basically utilizes the geometry of the feature and runs an analysis using the arcpy geometry methods. I have made recommendations to people to avoid using selections in a script and simply utilize the capabilities of the cursors. The cursors themselves will accomplish any gis related task.
... View more
09-16-2024
01:05 PM
|
0
|
0
|
2318
|
|
POST
|
I rewrote your script as such because it was really difficult to read and identify where the issue was. Have you checked out the link in my previous post? It shows you how to utilize the geometry of a feature. The line of code you are trying to use, are you merely copy and paying it into your script or are you running the sample that I provided.
... View more
09-13-2024
03:41 PM
|
1
|
6
|
2370
|
|
POST
|
So, there are a couple of things to mention, not so much the question but issues that I see with the script itself. Avoid nesting loops. In terms of performance, nested loops can be processing killers if they are used within themselves. All cursor functions have SQL clauses that can be used, so having separate select by attribute query layer is unnecessary. In my personal opinion, never set functions within the main portion of a script. I typically set them above the main processes and below the imports. I would also recommend checking out arcpy geometry to get a better understanding of how to utilize feature geometries. import arcpy
from arcpy import ListFields
from arcpy.da import SearchCursor as Searching , UpdateCursor as Updating
# Retrieves records of an input layer/feature and returns a dictionary of values
def GetRecords( Layer , ["OID@"] + Fields + ['SHAPE@'] , SQLClause ):
SearchLayer = Searching( Layer , Fields )
if SQLClause is not None: SearchLayer = Searching( Layer , Fields , SQLClause )
return { row[0] : row[ 1:] for row in SearchLayer }
# Returns a list of field names
def GetFieldNames( Layer , ExcludeFields ):
fieldnames = [ field.name for field in ListFields( Layer ) ]
if type( ExcludeFields ) is list: fieldnames = list( set( fieldnames ).difference( set( ExcludeFields ) ) )
return fieldnames
# Checks the distance between two geometries
def CheckProximity( InputFeatureRecords , DistanceFeatureRecords , SetDistance ):
WithinSetLimits = { }
for IF_id , IF_Attributes in InputFeatureRecords.items():
for DF_id , DF_Attributes in DistanceFeatureRecords.items():
Point = IF_Attributes[ 0 ]
Line = DF_Attributes[ 0 ]
if Point.distanceTo( Line ) <= SetDistance: WithinSetLimits[ IF_id ] = DF_Attributes[ 0 ]
else: WithinSetLimits[ IF_id ] = "Not Within 100 Feet of Stream or River"
return WithinSetLimits
Poles = '<PoleLayer>'
Streams = '<StreamLayer>'
PoleFields = GetFieldNames( infeature , '<[ list of field names to exclude ]>' )
StreamFields = [ "Stream_ID" , "StreamPermanence" ]
PoleRecords = GetRecords( infeature , ["OID@"] + Fields + ['SHAPE@'] )
StreamRecords = GetRecords( infeature , ["OID@"] + Fields + ['SHAPE@'] )
CheckProximity( PoleRecords , StreamRecords , 100 ) The sample above isn't a solution but I just thought to provide something useful to give you a rough idea.
... View more
09-13-2024
08:30 AM
|
2
|
8
|
2401
|
|
IDEA
|
Here is what I have used in the past. import arcgis.gis
from arcgis.gis import GIS
from arcgis.features import FeatureLayer
import datetime
import os
gis = GIS('<Portal>',"<Username>", "<Password>")
#print("Logged into AGOL...")
source_outages_layer_item = gis.content.get("<itemID>") #Outages layer
source_layer = source_outages_layer_item.layers[0]
#print (source_layer)
Current = datetime.datetime.now()
#print (Current)
source_layer.calculate(where = "1=1", calc_expression={"field": "Now", "sqlExpression" : "CURRENT_TIMESTAMP()"})
# Update The Outage Status
source_layer.calculate(where = "Now > TimeField and Now < TimeField", calc_expression={"field": "fieldname", "sqlExpression" : "<Some Value {must match field data type }>"})
source_layer.calculate(where = "Now < TimeField", calc_expression={"field": "fieldname", "sqlExpression" : '<Some Value {must match field data type }>' })
source_layer.calculate(where = "Now > TimeField", calc_expression={"field": "v", "sqlExpression" : '<Some Value {must match field data type }>'})
# Update The Emergency Outage Timeframe
source_layer.calculate(where = 'SQL Clause', calc_expression={"field": "fieldname", "sqlExpression" : "Expression"})
#______________________Write Text File_____________________#
output_location = 'file location'
TxtFileName = ("PythonScriptLog.txt")
TxtFile_Output = os.path.join(output_location, TxtFileName)
f = open(TxtFile_Output, "w")
f.write(str(Current) + '\n' + '\n' + 'Successfully logged into AGO' + '\n' + 'Updated ' + 'Featureclass Name')
f.close() Something that I also realized later on is that you can also treat the feature service like any feature if you use the full url and have editing capabilities on the feature.
... View more
09-11-2024
07:39 AM
|
0
|
0
|
4253
|
|
POST
|
Hi, I am merely trying to create another table within Dashboards using arcade, but I cannot seem to get the feature set to populate using multiple records. I have tested this multiple times, but I am not sure if I need to edit the feature or if there is some other way to go about it. I would greatly appreciate any help on this. var TimeFields = [
{'name': 'InspectionDate' , 'type':'esriFieldTypeDate' },
{'name': 'TimeSlot' , 'type':'esriFieldTypeString' , 'Length':10 }
]
var TimeSlots = {
'fields': TimeFields,
'geometryType': '',
'features' : []
}
var T = Today()
for( var i= 0 ; i < 24 ; i++ ){
var V = { 'InspectionDate' : T , 'TimeSlot' : Text( T , 'h:00 A') }
var F = { geometry : '' , attributes : V }
Push( TimeSlots.features , F )
T = DateAdd( T , 1 , 'hours' )
}
console( TimeSlots.features )
var FS = FeatureSet( Text( TimeSlots ) )
return FS
... View more
09-11-2024
07:19 AM
|
0
|
0
|
667
|
|
POST
|
Hi @EdHixson You can achieve this by setting the clip function on the map properties rather than in the map series. This will allow for you to exclude any features you choose while preserving the matching shape in the series.
... View more
08-12-2024
06:46 AM
|
2
|
1
|
1071
|
|
POST
|
That is what your issue is. If you are looking for a perfected grid, then the grid to index is your best option. Otherwise, the subdivide polygon is the only tool that would get your polygon to divide as proportionately as possible.
... View more
08-08-2024
06:27 AM
|
0
|
1
|
4843
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 2 weeks ago | |
| 1 | 05-07-2026 01:36 PM | |
| 1 | 02-10-2026 06:09 AM | |
| 1 | 03-04-2026 01:08 PM | |
| 1 | 02-24-2026 12:59 PM |
| Online Status |
Offline
|
| Date Last Visited |
yesterday
|