POST
|
Hi Robert, After talking with Esri, I found out there was an existing bug behind this behavior: BUG-000106245: When using a custom attribute display pop-up with a hyperlink field, null values in the hyperlink field result in a link to the current web map. This was supposedly fixed at the latest release of AGOL they say. The behavior I'm experiencing with the text appearing in the pop-up for fields with null values, even though the Arcade expression tells it otherwise is a new defect. So, they're looking into it. It sounds like, once treated, the URL field will display the hyperlink when present and nothing when the field's null, thereby eliminating the need for the Arcade expression.
... View more
09-27-2017
12:51 PM
|
2
|
1
|
2469
|
POST
|
Here's the display: Here's the HTML: <table cellpadding="0px" cellspacing="3px">
<tbody>
<tr valign="top">
<td><b>Name:</b></td>
<td><span>{NAME}</span>
</td>
</tr>
<tr valign="top">
<td><b>Address:</b></td>
<td>{FAC_ADDY_1}</td>
</tr>
<tr valign="top">
<td><br /></td>
<td>{CITY_ST_ZIP}</td>
</tr>
<tr valign="top">
<td><b>{/expr0}<a href="{URL}" target="_blank">Website</a>
</b></td><td><br /></td>
</tr>
</tbody>
</table> Here's the Arcade expression: IIF(IsEmpty($feature.URL), '', '<a href="{URL}" target="_blank">Website</a>') You'll notice in the screen shot a popup in the background. It's a popup that shouldn't have a link as there's nothing in the URL field for it.
... View more
09-21-2017
01:18 PM
|
0
|
3
|
872
|
POST
|
Robert, Ok, thanks. Now there's a different problem. After putting that line in the Arcade dialog window, the link still appears on the popups that have no website. And whereas before the link on these would bring you to the same web map on a different tab, it now opens a new blank tab.
... View more
09-21-2017
07:11 AM
|
0
|
5
|
1597
|
POST
|
Do you mean this, or the part of the HTML that calls the expression? I was pasting it here and there both in the Custom window and in the HTML, but not to the right effect.
... View more
09-20-2017
02:21 PM
|
0
|
7
|
1597
|
POST
|
Robert, I'm actually still hung up on one thing. If you look at my first reply to your original reply you'll see there's a problem with the link showing up on pop-ups that do not have a website in the attributes, thus they shouldn't have a link. It's like the problem I was having before I found out about the Arcade conditional expression.
... View more
09-20-2017
12:52 PM
|
0
|
9
|
1597
|
POST
|
Was able to remove the unwanted text. I erased URL in the Display window. Just the rest of it to figure out now.
... View more
09-20-2017
12:04 PM
|
0
|
11
|
1597
|
POST
|
Robert, Thanks for the reply. Sorry, I don't know any HTML. I put your line in and at first it seems like everything was good. I checked some pop-ups that would have a website in the attributes and the link brought me to the right website. But, now the link is showing up on pop-ups of the same attribute table that do not have any websites. So, when you click on the link it brings you back to the web map on a new tab. Also, there's still the text for the link in the pop-up that's not active--not sure how to remove it (see screen shot below). Here's the whole code: <table cellpadding="0px" cellspacing="3px">
<tbody>
<tr valign="top">
<td><b>Name:</b></td>
<td><span>{NAME}</span>
</td>
</tr>
<tr valign="top">
<td><b>Address:</b></td>
<td>{FAC_ADDY_1}</td>
</tr>
<tr valign="top">
<td><br /></td>
<td>{CITY_ST_ZIP}</td>
</tr>
<tr valign="top">
<td><b>{/expr0}<a href="{URL}" target="_blank">Website</a>
</b></td><td>{URL}</td>
</tr>
</tbody>
</table>
... View more
09-20-2017
12:01 PM
|
0
|
12
|
1597
|
POST
|
Thanks to this recent blog post: https://community.esri.com/community/gis/web-gis/arcgisonline/blog/2017/07/18/conditional-field-display-with-arcade-in-pop-ups I have a bunch of points on my web map that are tourist attractions. Some have websites available, some do not. But, they're all in the same attribute table. I have a "URL" field, and when relevant there's a url to the website. This is where the post came in handy. I was able to copy the conditional Arcade line and HTML code that I tailored to my app. The only thing is that my attribute field is dealing with a link. It's currently showing up as text on the pop-up (visible in the background here). It doesn't seem to be a case of using the link tool in the Custom Attribute Display window because most are individual links. Would you have an idea how to configure it so the link is live?
... View more
09-20-2017
09:25 AM
|
0
|
16
|
3766
|
BLOG
|
Hi Kelly, This is a great post. It basically does what I wanted to achieve in my pop-ups. I have a bunch of points on my web map that are tourist attractions. Some have websites available, some do not. But, they're all in the same attribute table. I have a "URL" field, and when relevant there's a url to the website. This is where your post came in handy. The only thing is that my attribute field is dealing with a link (visible in the background here). Would you have an idea how to configure it so the link is live? It's currently showing up as text.
... View more
09-18-2017
12:34 PM
|
0
|
0
|
29882
|
POST
|
Is there a tool that will auto populate the alias name value into a demographic table from the table with just the field name and the (full) alias name? For example, here is an Income census table with with the field names. And here is a metadata table with the aliases: The question is how do I incorporate the 'Full_Name' as a row in the Income table in ArcMap or ArcCatalog? I think I remember doing this in excel because the 'Full_Name' isn't a column, but a row there.
... View more
07-20-2017
09:37 AM
|
0
|
0
|
783
|
POST
|
Thanks for the help. I tried those few lines in a few places, but apparently not the right one as the txt files still aren't overwriting. so, I tried this in the place of the ZipShapes block and ran it as a script tool with no parameters: if __name__ == '__main__': # calls Zipshapes module and runs it. This module zips shapefiles and saves in website data folder.
path = r"\\gisfile\GISstaff\Jared\Python Scripts\Data"
out_path = r"Z:\Data"
ZipShapes(path, out_path)
zip.close() But it tells me ZipShapes isn't defined (below). If I run the script on its own it runs perfectly.
... View more
07-07-2017
09:12 AM
|
0
|
1
|
1320
|
POST
|
Thanks, I'm looking into it. Just to show you, here are the results after running the script in PythonWin with multiple copies of the txt files already in the folder. If I delete the txt files from the zipfiles and run it again the print statements are as I have them set up to be.
... View more
07-05-2017
02:29 PM
|
1
|
4
|
1320
|
POST
|
I made the attached script here into a tool (ArcMap 10.4). When running it the append2Zip() function starting on line 50 appends the txt file to a zipfile as it should, but doesn't overwrite the old one. I run this tool weekly. The other two blocks run as they should (i.e. output overwrites old files). The first block is lines 9-32. The second is 34-48. And the one I'm concerned with is lines 50-60. Can anyone catch why the append2Zip function isn't overwriting? import arcpy
import os
import zipfile
from arcpy import env
from os import path as P
arcpy.env.overwriteOutput = True
#Variables for first block of code
ws = r'\\gisfile\GISstaff\Jared\Python Scripts\Data'
mxd = arcpy.mapping.MapDocument(r'\\gisfile\GISstaff\Jared\Python Scripts\Data\Data_Request.mxd')
addy = arcpy.mapping.Layer(r"Database Connections\ims to plainfield.sde\gisedit.DBO.MGU_Will\gisedit.DBO.Address_Points")
street = arcpy.mapping.Layer(r"Database Connections\ims to plainfield.sde\gisedit.DBO.MGU_Will\gisedit.DBO.Street")
outFeature1 = "WillCounty_AddressPoints"
outFeature2 = "WillCounty_Streets"
# reference dataframe, then remove/add layers in MXD, then save in Data folder
for df in arcpy.mapping.ListDataFrames(mxd):
for lyr in arcpy.mapping.ListLayers(mxd, "gisedit.DBO.Address_Points", df):
arcpy.mapping.RemoveLayer(df, lyr) # removes old Adress_Points file from MXD.
print "removed: {}".format(lyr)
arcpy.mapping.AddLayer(df, addy, "TOP") # adds new Adress_Points file to MXD fresh from SDE.
print "added: {}".format(addy)
arcpy.FeatureClassToFeatureClass_conversion(addy, ws, outFeature1) # converts feature to shapefile and saves in data folder.
print "saved in data folder: {}".format(outFeature1)
for lyr in arcpy.mapping.ListLayers(mxd, "gisedit.DBO.Street", df):
arcpy.mapping.RemoveLayer(df, lyr) # removes old Streets file from MXD.
print "removed: {}".format(lyr)
arcpy.mapping.AddLayer(df, street, "TOP") # adds new Streets file to MXD fresh from SDE.
print "added: {}".format(street)
arcpy.FeatureClassToFeatureClass_conversion(street, ws, outFeature2) # converts feature to shapefile and saves in data folder.
print "saved in data folder: {}".format(outFeature2)
def ZipShapes(path, out_path):
arcpy.env.workspace = path
shapes = arcpy.ListFeatureClasses()
#iterate through list of shapefiles
for shapes in shapes:
name = p.splitext(shapes)[0]
zip_path = p.join(out_path, name + '.zip')
zip = zipfile.ZipFile(zip_path, 'w', compression=zipfile.ZIP_DEFLATED)
zip.write(p.join(path,shapes), shapes)
for f in arcpy.ListFiles('%s*' %name):
if not f.endswith('.shp'):
zip.write(p.join(path,f),f)
print 'All files written to %s' %zip_path
zip.close()
def append2Zip(zipfolder, path): # function that appends disclaimer to both zipfiles in website data folder.
print 'Appending to ' + zipfolder
zf = zipfile.ZipFile(zipfolder, mode= 'a')
try:
zf.write(path, os.path.basename(path))
finally:
zf.close()
path = r'\\gisfile\GISstaff\Jared\Python Scripts\Data\Disclaimer - Final.txt'
zipfolders = [r'Z:\Data\WillCounty_AddressPoints.zip', r'Z:\Data\WillCounty_Streets.zip'] #list of zip folders
for zipfolder in zipfolders: # loop through zipfolders
append2Zip(zipfolder, path) #call function above
... View more
07-05-2017
11:51 AM
|
0
|
6
|
2736
|
POST
|
@ Ian. Thanks, I understand what you're saying, and I was able to run it with os.path.join() as such: # Write to textfile
file = os.path.join(Workspace, "{}".format("MXDS.txt"))
print file
txtFile = open(file, "w")
txtFile.write("The folling list is the file path(s) to the MXD(s) followed by the ArcMap version" + "\n")
txtFile.write("-------------------------------------------------------------------" + "\n") And the script ran fine and saved the text file as "MXDS", as the string has it doing. But now I realize I wasn't really asking for the correct procedure. What I really want it to do is save as the workspace folder name. So, when the user is running the script tool the folder being saved to will be what the text file is named. I tried a couple things such as: # Write to textfile
file = os.path.dirname(Workspace)
print file
txtFile = open(file, "w")
txtFile.write("The folling list is the file path(s) to the MXD(s) followed by the ArcMap version" + "\n")
txtFile.write("-------------------------------------------------------------------" + "\n") and got the following error (line 21 in error is line 4 above): Tried this: # Write to textfile
#file = os.path.dirname(Workspace)
#print file
txtFile = open(Workspace, "w")
txtFile.write("The folling list is the file path(s) to the MXD(s) followed by the ArcMap version" + "\n")
txtFile.write("-------------------------------------------------------------------" + "\n") and got the same error. Any ideas?
... View more
06-21-2017
07:58 AM
|
0
|
1
|
819
|
POST
|
To be a bit clearer: This line... txtFile = open(Workspace + "{}".format("Mapbook_MXDs.txt"), "w") ...saves as a text file, in a workspace folder named "Townships", as such: TownshipsMapbook_MXDs I want to have the text file saved as: "Mapbook_MXDs"
... View more
06-20-2017
09:15 AM
|
0
|
3
|
819
|
Title | Kudos | Posted |
---|---|---|
1 | 01-11-2017 10:44 AM | |
1 | 03-18-2016 12:41 PM | |
1 | 03-29-2016 11:26 AM | |
2 | 09-27-2017 12:51 PM | |
1 | 07-05-2017 02:29 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|