POST
|
Hi @jcarlson , When it comes to changes in the web map I think Enterprise is a bit behind ArcGIS Online. It should come to Enterprise soon and can't wait to see some cool stuff with that. Keep up the good work!
... View more
02-24-2022
02:28 PM
|
0
|
1
|
487
|
POST
|
Hi @RaenaDeMaris , You would probably end up doing something like: var expr1 = 'Include the result of expr1 here' // {expression/expr1}
var expr2 = 'Include the result of expr2 here' // {expression/expr2}
var expr8 = 'Include the result of expr8 here' // {expression/expr8}
var expr9 = 'Include the result of expr9 here' // {expression/expr9}
var html = '<div style="background-color:#' + expr8 + ';padding:5px;">';
html += TextFormatting.NewLine + '<span style="color:#' + expr9 + ';">';
html += TextFormatting.NewLine + '<strong>' + $feature.CatDescrip + ': ' + $feature.Organization + '</strong>';
html += TextFormatting.NewLine + '</span></div>';
html += TextFormatting.NewLine + '<span style="' + expr1 + '">';
html += TextFormatting.NewLine + '<br />' + $feature.VictoryTitle + '<br />';
html += TextFormatting.NewLine + '</span><i><b><font color="#46C8F3"><br />' + $feature.Pop + ' benefitted from the victory!</font></b>';
html += TextFormatting.NewLine + '<br /></i>';
html += TextFormatting.NewLine + '<span style="display:' + expr2 + '"><br />' + $feature.VictDescrip + '<br /> </span>';
html += TextFormatting.NewLine + '<br />';
if (!IsEmpty($feature.Embeds)) {
html += TextFormatting.NewLine + '<span><a href="' + $feature.Embeds + '" target="_blank">Visit the Victory' + "'s Media Page</a></span>";
html += TextFormatting.NewLine + '<br />';
}
if (!IsEmpty($feature.Link1)) {
html += TextFormatting.NewLine + '<span><a href="' + $feature.Link1 + '" target="_blank">Learn More About the Victory</a></span>';
html += TextFormatting.NewLine + '<br />';
}
html += TextFormatting.NewLine + '<a href="' + $feature.Link2 + '" target="_blank">Go to Waterkeeper Website</a>';
return {'type': "text", 'text': html};
... View more
02-23-2022
04:39 PM
|
1
|
1
|
1433
|
POST
|
Hi @RaenaDeMaris , When you add an Arcade content element, the idea is that you can create HTML. Now I haven't checked the support for every available HTML, however, if you can share the entire Arcade expression you are using I can have a look. Edit: In order to avoid that you have to create a table and hide elements from that table manually in the HTML output, you could have a look at the Field Maps application. This may sound strange, but the idea is that this application allows you to hide fields conditionally and that is stored in the json definition of the map and the new map viewer is able to handle this. However, if you are planning the use the web map in for instance a dashboard or an instant app, not all other applications have support for this information in the json.
... View more
02-23-2022
03:22 PM
|
0
|
3
|
953
|
POST
|
Hi @RaenaDeMaris and @jcarlson , If I can chime in... there is a way to create HTML in the pop-up of the new map viewer. The way to do this is not to create an expression that appears as a "virtual field" (red rectangle below), but to add an Arcade content element (green rectangles below): This way you can generate HTML and it will appear in the pop-up, like this example below: You can use different styles, create lists, include multiple links stored in related data, etc...
... View more
02-23-2022
02:45 PM
|
1
|
8
|
956
|
POST
|
Hi @AhmedElagroudy , See my answer at your other post: https://community.esri.com/t5/arcgis-pro-questions/arcade-error-intersection-in-the-same-layer/m-p/1145175
... View more
02-23-2022
02:28 PM
|
0
|
0
|
281
|
POST
|
Hi @AhmedElagroudy and @KimGarbade , When creating Attribute Rules you need to be sure to check for anything that could go wrong along the way: For instance, when drawing your first line or any line that does not intersect another line, this will not return anything in the intersection and therefore "First" will fail. The intersection (and this somewhat surprised me) only seems to work on polygons You cannot cast the result of an intersection to a point And really, you should take a look at this great repository created by Mike Miller with a lot of examples: https://github.com/MikeMillerGIS/arcade-expressions/tree/master/attribute_rule_calculation In order to not overcomplicate the expression I did the following: Query the pipe featureset for all features that are not the current one Count the result of the intersects and if there is no pipe found (no intersection) do not return anything Create a small buffer of the current feature and of each intersecting pipe, Intersect the polygons Extract the centroid of the intersecting polygon Add the result(s) to an array to allow to add multiple points to the points layer Some more graphical explanations are below. The initial situation, lines in blue and intersecting points displayed with red crosses: Start drawing the line and create multiple intersections (only 1 per existing line): The intersecting points are added to the points layer: Now there are some things you will have to take into account: The points created are close to the intersection but not necessarily on the intersection since we are using a centroid of a polygon! So if you need the exact intersection you will need to explore the examples on Github to create a much more advanced expression to accomplish this. When your new line crosses an existing line it will create a point in the center of the multiple polygon sin the multipart intersection polygon. To avoid this you could convert the multipart to single-part and loop over each part to create the centroid. The expression used: var globid = $feature.GlobalID;
var sql = "GLOBALID <> @globid";
var pipes = Filter(FeatureSetByName($datastore, "pipe"), sql);
if (Count(pipes) > 0) {
var intersecting_features = Intersects(pipes, $feature);
var cnt = Count(intersecting_features);
var adds = [];
if (cnt > 0) {
var polf = Buffer($feature, 0.1, "m");
for (var pipe in intersecting_features) {
var poli = Buffer(pipe, 0.1, "m");
var polint = Intersection(poli, polf);
var pnt = Centroid(Polygon(polint));
Push(adds, {"geometry": pnt});
}
}
// don't try and return anything when there is no intersection!
if (Count(adds) > 0) {
return {
"edit": [
{"className": "test_point",
"adds": adds
}
]};
}
}
... View more
02-23-2022
02:26 PM
|
1
|
0
|
625
|
POST
|
Hi @GIS_Rookie , So, ArcGIS has its labeling engine Maplex that has a lot of settings you can play with to get the result you want. I understand that it would be better to have them all point in a certain direction in this case. However, if you have a line that describes a circular movement, it would be best that in a certain location the text switches its orientation in order to be closer to horizontal and enable readability for the end-user. I also had some issues with the texts near the start or end of the line, not sure what is going on there.
... View more
02-17-2022
03:41 PM
|
1
|
0
|
670
|
POST
|
Hi @GIS_Rookie , I suppose you can do something like this at the end of the script: # start insert cursor
flds_out = (fld_label, fld_angle)
with arcpy.da.UpdateCursor(fc, flds_out) as curs:
for row in curs:
lbl = row[0]
if lbl in dct_res:
angle = dct_res[lbl]
if angle < 0:
angle += 360
else:
pass
# angle = 400
curs.updateRow((lbl, angle, ))
... View more
02-17-2022
06:22 AM
|
1
|
2
|
678
|
POST
|
Hi @GIS_Rookie , Thanks for sharing the sample of data. There are a couple of ways you can proceed. I created a line featureclass using the cut lines and changed it a bit to have it align to the left and I included the pole information for labeling. Have a look at the result below: See below the Python code I used (in the Python window of ArcGIS Pro): def getAngleLine(line):
pntg1 = arcpy.PointGeometry(line.firstPoint, line.spatialReference)
pntg2 = arcpy.PointGeometry(line.lastPoint, line.spatialReference)
return getAngle(pntg1, pntg2)
def createPerpendicularCutLine(pntg, angle, dist, sr):
pntg_cut_1 = pntg.pointFromAngleAndDistance(angle - 90, dist * 2.0, 'PLANAR')
pntg_cut_2 = pntg.pointFromAngleAndDistance(angle + 90, dist * 2.0, 'PLANAR')
cut_line = arcpy.Polyline(arcpy.Array([pntg_cut_1.firstPoint, pntg_cut_2.firstPoint]), sr)
return cut_line
def createCutLine(pntg, bearing1, buf, sr):
bearing2 = bearing1 + 180
pntg_cut_1 = pntg.pointFromAngleAndDistance(bearing1, buf * 1.5, 'PLANAR')
pntg_cut_2 = pntg.pointFromAngleAndDistance(bearing2, buf * 0, 'PLANAR')
cut_line = arcpy.Polyline(arcpy.Array([pntg_cut_1.firstPoint, pntg_cut_2.firstPoint]), sr)
return cut_line
def createLine(pntg1, pntg2, sr):
return arcpy.Polyline(arcpy.Array([pntg1.firstPoint, pntg2.firstPoint]), sr)
def getAngle(pntg1, pntg2):
return pntg1.angleAndDistanceTo(pntg2, method='PLANAR')[0]
import os
arcpy.env.overwriteOutput = True
# input fc
fc = r'D:\GeoNet\TransmissionLabel\point.shp'
fld_label = 'Pole'
fld_orden = 'Pole'
buf = 20
fc_out = r'D:\GeoNet\TransmissionLabel\cutline02.shp'
# spatial reference
sr = arcpy.Describe(fc).spatialReference
# dicts, listado para orden
flds = (fld_orden, 'SHAPE@')
dct_crds = {r[0]: r[1] for r in arcpy.da.SearchCursor(fc, flds)}
flds = (fld_orden, fld_label)
dct_lbl = {r[0]: r[1] for r in arcpy.da.SearchCursor(fc, flds)}
# create list of points and order list
lst_ptgs = [pntg for orden, pntg in sorted(dct_crds.items())]
lst_orden = sorted(dct_crds.keys())
# create output featureclass
ws, fc_name = os.path.split(fc_out)
arcpy.CreateFeatureclass_management(ws, fc_name, "POLYLINE", None, None, None, sr)
# add fields
arcpy.AddField_management(fc_out, fld_label, "TEXT", None, None, 50)
flds_out = ('SHAPE@', fld_label)
# empty lists for output features
lst_puntos = []
lst_lineas = []
lst_polylines = []
# start insert cursor
with arcpy.da.InsertCursor(fc_out, flds_out) as curs:
# first polygon
if len(lst_ptgs) >= 2:
pntg_1 = lst_ptgs[0]
pntg_2 = lst_ptgs[1]
angle_12 = getAngle(pntg_1, pntg_2)
cut_line = createPerpendicularCutLine(pntg_1, angle_12, buf, sr)
# generate and insert output row
lbl1 = dct_lbl[lst_orden[0]]
arcpy.AddMessage(' - procesar: {0}'.format(lbl1))
curs.insertRow((cut_line, lbl1, ))
# intermediate polygons
for i in range(1, len(lst_ptgs) - 1):
# read points
pntg_a = lst_ptgs[i - 1]
pntg_1 = lst_ptgs[i]
pntg_2 = lst_ptgs[i + 1]
# get angles and bearings
angle_1a = getAngle(pntg_1, pntg_a)
angle_12 = getAngle(pntg_1, pntg_2)
bearing_l = (angle_1a + angle_12) / 2.0
# create cut lines
cut_line = createCutLine(pntg_1, bearing_l, buf, sr)
# generate and insert output row
lbl1 = dct_lbl[lst_orden[i]]
arcpy.AddMessage(' - procesar: {0}'.format(lbl1))
curs.insertRow((cut_line, lbl1, ))
# last polygon
if len(lst_ptgs) >= 2:
pntg_1 = lst_ptgs[len(lst_ptgs) - 2]
pntg_2 = lst_ptgs[len(lst_ptgs) - 1]
# get angles and bearings
angle_21 = getAngle(pntg_2, pntg_1)
cut_line = createPerpendicularCutLine(pntg_2, angle_21, buf, sr)
# generate and insert output row
lbl1 = dct_lbl[lst_orden[len(lst_ptgs) - 2]]
arcpy.AddMessage(' - procesar: {0}'.format(lbl1))
curs.insertRow((cut_line, lbl1, )) The other way would be to write the angle to the points. This can be achieved like this: def getAngle(pntg1, pntg2):
return pntg1.angleAndDistanceTo(pntg2, method='PLANAR')[0]
import os
arcpy.env.overwriteOutput = True
# input fc
fc = r'D:\GeoNet\TransmissionLabel\point.shp'
fld_label = 'Pole'
fld_orden = 'Pole'
fld_angle = 'ANGLE2'
buf = 20
# spatial reference
sr = arcpy.Describe(fc).spatialReference
# dicts, listado para orden
flds = (fld_orden, 'SHAPE@')
dct_crds = {r[0]: r[1] for r in arcpy.da.SearchCursor(fc, flds)}
flds = (fld_orden, fld_label)
dct_lbl = {r[0]: r[1] for r in arcpy.da.SearchCursor(fc, flds)}
# create list of points and order list
lst_ptgs = [pntg for orden, pntg in sorted(dct_crds.items())]
lst_orden = sorted(dct_crds.keys())
dct_res = {}
# first polygon
if len(lst_ptgs) >= 2:
pntg_1 = lst_ptgs[0]
pntg_2 = lst_ptgs[1]
angle_12 = getAngle(pntg_1, pntg_2) + 90.0
# generate and insert output row
lbl1 = dct_lbl[lst_orden[0]]
dct_res[lbl1] = angle_12
# intermediate polygons
for i in range(1, len(lst_ptgs) - 1):
# read points
pntg_a = lst_ptgs[i - 1]
pntg_1 = lst_ptgs[i]
pntg_2 = lst_ptgs[i + 1]
# get angles and bearings
angle_1a = getAngle(pntg_1, pntg_a)
angle_12 = getAngle(pntg_1, pntg_2)
bearing_l = (angle_1a + angle_12) / 2.0
# generate and insert output row
lbl1 = dct_lbl[lst_orden[i]]
dct_res[lbl1] = bearing_l
# last polygon
if len(lst_ptgs) >= 2:
pntg_1 = lst_ptgs[len(lst_ptgs) - 2]
pntg_2 = lst_ptgs[len(lst_ptgs) - 1]
# get angles and bearings
angle_21 = getAngle(pntg_2, pntg_1) - 90.0
# generate and insert output row
lbl1 = dct_lbl[lst_orden[len(lst_ptgs) - 2]]
dct_res[lbl1] = angle_21
# start insert cursor
flds_out = (fld_label, fld_angle)
with arcpy.da.UpdateCursor(fc, flds_out) as curs:
for row in curs:
lbl = row[0]
if lbl in dct_res:
angle = dct_res[lbl]
else:
pass
# angle = 400
curs.updateRow((lbl, angle, ))
... View more
02-16-2022
09:47 AM
|
1
|
4
|
1606
|
POST
|
Hi @HeathAnderson , I must admit that I haven't touched ArcMap in over 2 years now, and there is no way I can validate the code, but let me see if we can get to the bottom of this. I assume that if you manually execute the report layout in ArcMap 10.8.1, it works, right? Checking the documentation I don't see a difference in the export tool between 10.6.x and 10.8.x. Please check that the root to the input layerfiles, the input report layout and the output pdf file are all valid and the layer can be added to ArcMap without problems and the report layout can be loaded into ArcMap. There is nothing wrong with your code as far as I can tell.
... View more
02-16-2022
06:59 AM
|
0
|
1
|
326
|
DOC
|
Hi @AJ_devaccount , I think your expression is hiding the columns (or cell data elements). The challenge is that the images will appear each on a new row. This is more an HTML question than an Arcade question. I did some quick tests and none of them resulted in having the cells appear on a single row. So if you can solve this HTML issue and incorporate it in the Arcade expression it should work. And just when I am about to post this I noticed that there is something you could do; use a single cell (column) and change the display "block" to "inline-block" inside the img tag. Have a look at the example below (just HTML no Arcade): <HTML>
<header>
</header>
<body>
<table style="table-layout:fixed" width="1000px">
<tr style="white-space: nowrap; overflow: hidden;">
<td>
<a href=""><img style="display:inline-block;" alt="hiking" src=""/></a>
<a href=""><img style="display:none;" alt="cycling" src=""/></a>
<a href=""><img style="display:inline-block;" alt="dog walking" src=""/></a>
<a href=""><img style="display:inline-block;" alt="photography and filming" src=""/></a>
<a href=""><img style="display:inline-block;" alt="birding" src=""/></a>
<a href=""><img style="display:none;" alt="kicksledding" src=""/></a>
<a href=""><img style="display:none;" alt="fat tire biking" src=""/></a>
<a href=""><img style="display:none;" alt="snoeshoeing" src=""/></a>
<a href=""><img style="display:inline-block;" alt="cross-county skiing" src=""/></a>
</td>
</tr>
</table>
</body>
</HTML>
... View more
02-15-2022
03:26 PM
|
0
|
0
|
19394
|
POST
|
Hi @GIS_Rookie , Then I suppose I have to reply with a question similar to the one I asked Paul. Do you have a sample of data that you can share? That will help understand what you have and what you are looking for.
... View more
02-15-2022
03:19 PM
|
0
|
5
|
1614
|
POST
|
Hi @DavidColey , You can do something like this (see below). Remember that the Distinct function returns and array and not a featureset: var intParcels = Intersects($feature, FeatureSetByName($map, 'Community Flood Zone'));
// this returns an array, not a featureset (and I sorted it)
var fpTypes = Sort(Distinct(intParcels, "zonetype"));
var fpCnt = Count(fpTypes);
var fplist = '';
if (fpCnt > 0) {
// create empty array
var lst = [];
// add the required text to the zones
for (var i in fpTypes) {
Push(lst, '- Zone: ' + fpTypes[i]);
}
// concatenate with new line
fplist = Concatenate(lst, TextFormatting.NewLine);
} else {
fplist = 'No Flood Zone intersects this parcel'
}
return fplist;
... View more
02-03-2022
11:41 AM
|
1
|
4
|
902
|
POST
|
Hi @RonParis , A couple of changes (you are close): // Connect to featureset
var fs = FeatureSetByPortalItem(Portal('https://www.arcgis.com/'), '[item_id]', 0);
// define the field name with the information you are looking for
var field_name = "Your Field Name goes here";
// buffer, filter and count (unchanged)
var buf = Buffer($feature, 500, "meter");
var fs_filtered = Intersects(fs, buf);
var cnt = Count(fs_filtered);
// some initial values
var min_dist = 999;
var result = "No feature found";
// first check if you have feature in the search distance
if (cnt > 0) {
// loop through the features found
for (var f in fs_filtered) {
// calculate distance
var dist = DistanceGeodetic($feature, f);
// check if it is closer than previous results
if (dist < min_dist) {
// got a hot, change the min dist and read the field
min_dist = dist;
result = f[field_name];
}
}
}
// return the result
return result;
... View more
02-03-2022
11:26 AM
|
1
|
1
|
2275
|
DOC
|
Hi @TSmith , Sorry for the delay in my reply. My first guess would be the date. You need to convert it to epochs to ensure that it is taken as a date when creating the featureset. You can do something like: var epoch = DateDiff(insdate, Date(1970, 0, 0));
... View more
01-26-2022
02:38 PM
|
0
|
0
|
4450
|
Title | Kudos | Posted |
---|---|---|
1 | 11-12-2017 02:40 PM | |
1 | 11-14-2013 10:56 PM | |
1 | 05-22-2019 01:11 PM | |
1 | 06-28-2019 02:45 PM | |
2 | 07-27-2022 02:21 PM |
Online Status |
Offline
|
Date Last Visited |
2 weeks ago
|