|
POST
|
You want the following SQL query: CNTRY_NAME = 'Country' To get that as a string in PYthon: query = "CNTRY_NAME = '{}'".format(country)
... View more
12-09-2021
01:32 PM
|
1
|
1
|
1458
|
|
POST
|
RESULTA1 = "!{0}!*!{1}!+{2}".format(CHAMP1, CHAMP2, DDDF)
RESULTA2 = "!{0}!*!{1}!-{2}".format(CHAMP1, CHAMP2, DDDF)
#RESULTA1 = '!CHAMP1!*!CHAMP2!+9.4'
#RESULTA2 = '!CHAMP1!*!CHAMP2!-9.4'
RESULTA = "({0}) * ({1})".format(RESULTA1, RESULTA2)
#'(!CHAMP1!*!CHAMP2!+9.4) * (!CHAMP1!*!CHAMP2!-9.4)'
... View more
12-09-2021
07:23 AM
|
0
|
4
|
4776
|
|
POST
|
This way is incorrect. When you use a with block, this is what happens (on a very, very conceptual level!) with arcpy.da.UpdateCursor(...) as cursor:
your_code()
# this gets translated into
cursor = arcpy.da.UpdateCursor(...)
cursor.__enter__()
your_code()
cursor.__exit__() The __exit__ method of the cursors resets iteration and removes locks. When you delete the cursor object before the __exit__ method is called, there's a good chance that you'll get persistent locks. Deleting the cursor object is optional. I use cursors all the time and never delete them, never had a problem. ESRI recommends considering using the del to be absolutely sure there are no locks left: https://pro.arcgis.com/de/pro-app/latest/arcpy/get-started/data-access-using-cursors.htm Cursors support with statements to reset iteration and aid in removal of locks. However, using a del statement to delete the object or wrapping the cursor in a function to have the cursor object go out of scope should be considered to guard against all locking cases. If you want to use it, delete OUTSIDE of the with block: with arcpy.da.UpdateCursor(...) as cursor:
for row in cursor:
stuff()
del cursor
... View more
12-09-2021
07:12 AM
|
4
|
1
|
3697
|
|
POST
|
My first guess wasn't far off. Though the feature do have geometries, they're corrupted. Recognizable by Shape_Area = 0. Running RepairGeometry solves the problem: Don't want to go through the code right now, but inserting something like the line below after you created and filled the feature class should suffice. https://pro.arcgis.com/en/pro-app/2.7/tool-reference/data-management/repair-geometry.htm arcpy.management.RepairGeometry(in_features)
... View more
12-09-2021
06:47 AM
|
1
|
1
|
6776
|
|
POST
|
// calculation attribute rule on child
// field: if you want to get only one field from the parent, then chose
// that field. if you want to get multiple fields, leave empty
// triggers: Insert(, update)
// load the related parent features using one of these methods
// if you have a relationship class between parent and child:
var parent_fs = FeatureSetByRelationshipName($feature, "RelationshipName")
// if not
var parent_fs = FeatureSetByName($datastore, "NameOfParentFC")
var key = $feature.ForeignKeyField
parent_fs = Filter(parent_fs, "PrimaryKeyField = @key")
// return nothing if no parent feature was found
var parent = First(parent_fs)
if(parent == null) { return }
// if you want to return only one field:
return parent.Field
// if you want to return multiple fields:
var att = {
"Field1": parent.Field1,
"Field2": parent.Field2
}
return {"result": {"attributes": att}}
... View more
12-09-2021
01:09 AM
|
3
|
4
|
10805
|
|
POST
|
So you want something like this? var portal = Portal("https://www.arcgis.com/")
var vendor = GroupBy(
FeatureSetByPortalItem(portal,"********************",0,["*"],false),
["Invoice_Date"],
[
{ "name": "Invoice_Total", "expression": "Invoice_Total", "statistic": "SUM" }
]
)
var combinedDict = {
"fields": [
{ "name": "date1", "type": "esriFieldTypeDate" },
{ "name": "cost1", "type": "esriFieldTypeDouble" },
{ "name": "running_sum1", "type": "esriFieldTypeDouble" },
],
"geometryType": "",
"features": []
}
var i = 0
var running_sum = 0
for (var v in vendor) {
running_sum += v["Invoice_Total"] // increase the running sum
combinedDict.features[i++] = {
"attributes": {
"date1": v["Invoice_Date"],
"cost1": v["Invoice_Total"],
"running_sum1": running_sum
}
}
}
//return combinedDict;
// Return dictionary cast as a FeatureSet
return FeatureSet(Text(combinedDict))
... View more
12-09-2021
12:24 AM
|
2
|
1
|
3993
|
|
POST
|
Change NameOfLogoLayer to the actual name of the logo layer (or the path to the feature class). To run, skip to the end of the code and press enter.
... View more
12-08-2021
06:57 AM
|
1
|
0
|
2470
|
|
POST
|
OK, really last idea. <div style="text-align: center; font-size: large; font-weight: bold;">
Introduction
</div>
<div style="background:#e01a2a; width:100%; height:5px;"></div> Other than that, I'm out of ideas about how to do this with HTML. All of these should work and do work in a simple html file. All of them, except the hr one, also work in a WebApp info widget. But the ArcGIS widgets and HTML often don't work together, so it can get frustrating. Really ugly ideas: Use "-" or "_" to make a "line" and use the text editor to make that red. Create an image of the line and put that underneath the heading.
... View more
12-08-2021
06:54 AM
|
1
|
2
|
5486
|
|
POST
|
Last try, using hr, which has a color attribute. Maybe that gets through where the style color couldn't... <div style="text-align: center; font-size: large; font-weight: bold;">
Introduction
<hr color="#e01a2a" width="50%" size="5">
</div>
<!-- if that doesn't work, try placing the hr outside of the div -->
<hr color="#e01a2a" size="5">
... View more
12-08-2021
06:16 AM
|
0
|
1
|
5489
|
|
POST
|
Ah OK, thanks for the tip. I was wondering why that wouldn't throw an error. Seems to be a Javascript concept. I don't know how to feel about this, seems kinda dirty to me. Although I really like the reverse, where you just call dict.key instead of the pythonic dict["key"]. Seems like Arcade handles dictionaries like duck typed objects in Python.
... View more
12-08-2021
06:01 AM
|
0
|
0
|
4012
|
|
POST
|
https://pro.arcgis.com/de/pro-app/latest/help/mapping/text/text-formatting-tags.htm Nothing in the tags, HTML doesn't work. Your only options seems to be creating two label classes. But then they will be positioned independently from each other. You can force them into the format you want with a a bit of fiddling. For points, it's easy: the haloed class on top, the other class on the bottom: For polygons: Settings for both classes Position: Regular, Horizontal, "Place label at fixed position within polygon" (chose the same position) Conflict Resolution: Unplaced labels -> Never remove Settings for one class Symbol -> Position -> Offset Y You could also post an Idea to include HALO and _HALO label tags in ArcGIS Pro.
... View more
12-08-2021
03:10 AM
|
3
|
2
|
3189
|
|
POST
|
Might be a stupid question, but do the features actually have geometries? Can you see them on the map, can you zoom to them? Could you share the python script and a feature class that doesn't work?
... View more
12-08-2021
02:14 AM
|
1
|
2
|
6804
|
|
POST
|
you don't use quotation marks around the dictionary keys you try to store the string "Invoice_Date" instead of the value of the field Invoice_Date (even if you used the quotation marks correctly, this would get rejected, as the type of date1 is esriFieldTypeDate) var portal = Portal("https://www.arcgis.com/")
var vendor = GroupBy(
FeatureSetByPortalItem(portal,"********************",0,["*"],false),
["Invoice_Date"],
[
{ "name": "Invoice_Total", "expression": "Invoice_Total", "statistic": "SUM" }
]
)
var combinedDict = {
"fields": [
{ "name": "date1", "type": "esriFieldTypeDate" },
{ "name": "cost1", "type": "esriFieldTypeDouble" },
],
"geometryType": "",
"features": []
}
var i = 0
// Loop through each FeatureSet and store its attributes
for (var v in vendor) {
combinedDict.features[i++] = {
"attributes": {
"date1": v["Invoice_Date"],
"cost1": v["Invoice_Total"]
}
}
}
//return combinedDict;
// Return dictionary cast as a FeatureSet
return FeatureSet(Text(combinedDict)) I don't think you need the combinedDict at all. All you're doing is copy the rows from vendor verbatim. If you're not planning to actually combine vendor with another FeatureSet, this should be enough: var portal = Portal("https://www.arcgis.com/")
var vendor = GroupBy(
FeatureSetByPortalItem(portal,"********************",0,["*"],false),
["Invoice_Date"],
[
{ "name": "Invoice_Total", "expression": "Invoice_Total", "statistic": "SUM" }
]
)
return vendor
... View more
12-08-2021
02:05 AM
|
1
|
2
|
4019
|
|
POST
|
If you are dealing with File Geodatabases (.gdb), they have to be in a location that is accessible to your colleagues. If you're dealing with Enterprise Geodatabases (.sde), your colleagues have to connect as data owner to use TruncateTable. If they use their own connection files, they have to update the script with the right paths. To run the script, your colleagues need ArcGIS installed on their PCs. To share the script, you have a few options: Just save it in a text file. To run it, copy paste into the ArcGIS Pro Python Window. Insert "import arcpy" at the start of the script and save it as a python script (.py). Now you can also run it outside of ArcGIS, either using the command line or by opening it with IDLE (automatically installed with ArcGIS) and running it there. Create a toolbox, turn the script into a script tool inside that toolbox, share the toolbox. Might be a bit overkill... https://pro.arcgis.com/de/pro-app/latest/arcpy/geoprocessing_and_python/a-quick-tour-of-creating-script-tools.htm
... View more
12-08-2021
01:25 AM
|
0
|
0
|
1955
|
|
POST
|
@DavidZiegler Create a new field in the point feature class with the name "LogoData" and the field type BLOB (Binary Large OBject). Fields of this type can store byte data, so everything you can think of. Images, PDFs, Excel, Word, music, video, etc. We're going to use it to store the logo files directly in the feature class.
... View more
12-08-2021
12:43 AM
|
1
|
0
|
4444
|
| 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
|