|
POST
|
That error is because you are using a single = which is for assignment. Use double == for comparing equality. And you probably want quotes around the LOW value to indicate it's a string and not a variable that isn't defined. if (RiskZone == "LOW"): Also, get rid of the double return keywords; just one will do 😉
... View more
06-16-2021
09:17 AM
|
1
|
1
|
7811
|
|
POST
|
@MattWeber2 were you able to figure out the problem with your memory workspace?
... View more
06-15-2021
03:28 PM
|
1
|
0
|
3510
|
|
POST
|
Not sure what you mean by looping the statement in the field calculator. Calculate field will perform the operation on all (or selected) records once. If you want it to do multiple things when you run calculate field, you'll have to code that logic; possibly using an if statement. If you want to automatically do something when a condition is met (new record, new value, etc), that would be something different. Maybe look into Attribute Assistant or Attribute Rules. If it's in an RDBMS, you could make a database trigger. Or if it doesn't need to be immediate, you could schedule a Python script as a Windows task.
... View more
06-15-2021
11:07 AM
|
1
|
0
|
7840
|
|
POST
|
You say it did not work but what was the result? No values? Incorrect values? Error message? In the case of an error, what was the complete message (check the geoprocessing results)? If you're working with the datetime library, you'll need to import datetime Try something like this for the Python code block def calc_reinspection(survey_date):
date_str_format = "%d/%m/%Y"
survey_date = datetime.datetime.strptime(survey_date, date_str_format)
reinspection_date = survey_date + datetime.timedelta(days=365)
return datetime.datetime.strftime(reinspection_date, date_str_format) That last line is formatting the datetime object back to a string formatted date to exclude the time portion (which defaults to midnight). You can leave that part out if you don't mind your dates all having the time displayed (even though they do have it hidden); just return reinspection_date. And this for the Python expression: calc_reinspection(!SurveyDate!)
... View more
06-15-2021
07:32 AM
|
1
|
3
|
7850
|
|
POST
|
A popup is referring to a specific feature in the map. When multiple features are clicked to initiate a popup, there is just an overflow arrow at the top corner to allow showing the next or previous feature one at a time. Here's a sample. If you want to cumulatively show information from a collection of features, you probably just want to display that information in a div and position it using the view's UI. You can populate the contents of the div with hitTest(), writing the coordinates in some useful format into the results div as they come in.
... View more
06-14-2021
08:19 AM
|
0
|
2
|
4824
|
|
POST
|
Correct. At minimum, you need Python installed. If you're interacting with anything ArcPy, you'll also need ArcGIS (or the engine) installed.
... View more
06-14-2021
08:05 AM
|
0
|
1
|
2955
|
|
POST
|
Ah, I forgot the single quotes. As @JoeBorgione mentioned, these often take some fiddling. Hopefully this will keep the strings as single quotes. select = f"PIN IN({str(fc2List)[1:-1]})" Edit: I just found this solution that is more robust and less of a hack. str_values = ",".join(f"'{x}'" for x in fc2List)
select = f"PIN IN({str_values})"
... View more
06-11-2021
01:29 PM
|
1
|
0
|
3473
|
|
POST
|
I like this, but don't forget that formatting your select string with the list isn't valid SQL syntax because of the brackets. You need to reformat it with parenthesis. Assuming PIN is a string, you would need select = f'PIN IN({",".join(fcList)})'
... View more
06-11-2021
10:35 AM
|
2
|
0
|
3494
|
|
POST
|
A script could definitely be made to export data. However, it sounded like your users are already used to using Portal so it seemed like a website offering a menu of data and download options would be easier for them to use. Alternatively, maybe you could run a script as a nightly scheduled task that exports the most commonly used feature classes in the most commonly requested formats. Save the outputs wherever is most convenient for your users to get. At least that would reduce most of your request workload.
... View more
06-11-2021
08:35 AM
|
0
|
3
|
2986
|
|
POST
|
I think @DavidPike has the solution for the basic question you asked. However, seeing that you have a Zone3 option, are you able to definitively say you will always have exactly 3 "zones" of data? If it could be variable, you could write the values to a dictionary and then handle the results however you need. This all assumes that your naming of the zones is related to the first digit of the field values. It also assumes the range of possible values is 10000 - 99999. If it goes past that, one of the zones will get overwritten with a different range. For example, Zone1 will get overwritten with the 100k values, etc. recorded_zones = {}
with arcpy.da.SearchCursor(fc, fields) as cursor:
for row in cursor:
current_zone_value = row[0]
# Get first digit of value to identify the zone.
current_zone = str(current_zone_value)
current_zone = int(current_zone[0])
# Compare zone values and updated if current zone value is higher.
# Defaults recorded_zone_value to 0 if not found.
recorded_zone_value = zones.get(current_zone, 0)
if recorded_zone_value > current_zone_value:
recorded_zones[current_zone] = current_zone_value
# Do something with the zone values
for zone, value in recorded_zones.items():
print("Zone{} = {}".format(zone, value))
... View more
06-11-2021
08:07 AM
|
2
|
5
|
5735
|
|
POST
|
My app with token authentication is very rudimentary in that I funnel all errors through a generic error handling function for everything in the app. One of the checks is to find the word "token". If it does, it assumes the token is expired, so deletes it and then sends them to the log in screen. Very basic but better than making the user refresh the app. I'm also hoping someone else has a better solution.
... View more
06-11-2021
07:37 AM
|
0
|
0
|
1991
|
|
POST
|
Ah, sorry, I didn't notice that Extract Data only worked on hosted feature layers. In that case, you could set up a Hub site to share stuff internally. We are testing it out and it works great for services hosted on our internal ArcGIS Server. Not sure if you need to enable Open Data first though.
... View more
06-11-2021
07:11 AM
|
1
|
5
|
2990
|
|
POST
|
Could you add the service to ArcGIS Online or Portal as a feature layer? That would allow users to pretty easily extract the data themselves. Extract Data—ArcGIS Online Help | Documentation
... View more
06-10-2021
08:59 AM
|
0
|
7
|
3020
|
|
POST
|
It's just like querying a feature layer. You can get the url for the table item in ArcGIS Online, plug it into a QueryTask, execute the Query, then iterate over the results. Here's an example: var qTask = new QueryTask({
url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/SpatioTemporalAggregation/RainfallTimeSeriesDataIllinois/MapServer/8"
});
// Set the query parameters with a where clause and to return all fields.
var params = new Query({
returnGeometry: false,
where: "avg_monthly_rainfall > 100",
outFields: ["*"]
});
// executes the query and handle the resulting FeatureSet.
qTask.execute(params)
.then(function(featureSet) {
featureSet.features.forEach(function(feature) {
console.log(feature);
for (const [fieldName, fieldValue] of Object.entries(feature.attributes)) {
// Do something with the field names and field values.
console.log(`\t${fieldName}: ${fieldValue}`);
}
});
})
.catch(function (error) {
console.error("Promise rejected: ", error.message);
});
... View more
06-10-2021
08:50 AM
|
0
|
0
|
1787
|
|
POST
|
In that case, you'll probably have to use a library like OpenPyXL to write to the existing Excel file. I've never done that so you'll have to explore that on your own. Start with a SearchCursor on the shapefile using a where_clause to query on the records you want. Then iterate over the SearchCursor and find a way to write the rows to Excel.
... View more
06-03-2021
02:09 PM
|
1
|
0
|
5355
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 3 weeks ago | |
| 1 | 10-23-2025 03:53 PM | |
| 1 | 04-28-2026 07:25 AM | |
| 1 | 03-19-2026 08:59 AM | |
| 1 | 02-12-2026 01:37 PM |