|
POST
|
Robert, Does it matter where proxy.ashx lives? Where does it normally go?
... View more
12-13-2018
06:56 AM
|
0
|
1
|
1081
|
|
POST
|
I was able to set up a proxy. I set it up on the same server that's hosting the apps. I tested that it's installed and that it is able to forward requests directly in the browser. I've been using the Guide and the README file. For the last step, I added the following to an app: require(["esri/config"], function(esriConfig) {
esriConfig.request.proxyUrl = "";
}); I'm not sure what to put as the url.
... View more
12-11-2018
02:23 PM
|
0
|
3
|
1283
|
|
POST
|
I was able to adjust the font size of the text and also the height of the text box. for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"):
if "PRINT DATE" in elm.text.upper():
elm.name = 'PrintDate'
if elm.name == 'PrintDate':
elm.fontSize = 5
elm.elementHeight = 0.4871
print "+++date changed+++" Got some help from this post: Change text\ font size element using Arcpy - Geographic Information Systems Stack Exchange
... View more
12-10-2018
09:01 AM
|
1
|
0
|
2107
|
|
POST
|
Thanks a lot. It worked nicely. The only thing is the box isn't big enough for the four lines. The dynamic date on the bottom is there only after I stretch the box a tad. I'll have to look into tweaking this somehow.
... View more
12-07-2018
12:10 PM
|
0
|
2
|
2107
|
|
POST
|
Randy, Yeah, I think you're right. It seems like the text in question may have been added using the Rectangle Text tool from Drawing. Reason being it has vertices. When text is added to map layout from Insert it looks like this: I tested what you suggested. 1. After manually resizing the text box in map layout it does not come back into alignment. 2. Here are the properties of the illegible text after running the script: -After setting the lines manually here and adjusting the textbox a little, it displayed correctly. Maybe the issue is with the size of this textbox as it is when the script runs. Reason being is because the second textbox I mentioned is the same type as this one, only much bigger (multiple line paragraph). And when this large textbox was replaced (while troubleshooting using only the "DATE" keyword) the newText displayed fine in it. So, maybe there's a parameter that increases the textbox size that I could use?
... View more
12-06-2018
01:20 PM
|
0
|
0
|
2107
|
|
POST
|
I started a new Question: https://community.esri.com/message/817891-textelement-content-in-map-layout-not-displaying-correctly
... View more
12-06-2018
11:55 AM
|
0
|
0
|
1133
|
|
POST
|
Using ArcMap 10.5.1 and Python 2.7, I have a script that finds a text box in map layout of an MXD(s) by two key words "PRINT DATE" and changes the text to new text. I believe the script is doing what I want it to and it runs with no error. However, the resulting text in the text box is illegible. Script: import arcpy, os
from arcpy import env
arcpy.env.workspace = ws = r"path\to\TestFolder"
# format new text
txtBlock = [
'Prepared by the Will County GIS Division',
'302 N Chicago St. Joliet, Il 60432',
'T:(815) 774-6343, E:gis@willcountyillinois.com',
'Print date: <dyn type=\"date\" format=\"\"/>'
]
# create variable that joins lines together with new line character
newTxt = "\n".join(txtBlock)
# list the mxds of the workspace folder
for mxdname in arcpy.ListFiles("*.mxd"):
print "checking document: {}".format(mxdname)
mxd = arcpy.mapping.MapDocument(ws + "\\" + mxdname)
# find textbox by keywords and give it the new text
for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"):
if "PRINT DATE" in elm.text.upper():
elm.text = newTxt Text box before: and after: The following trouble shoots were suggested on my previous post: find text element in MXD with wildcard? 1. I printed out the context of the text box before it was replaced and after using the repr() class: for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"):
if "PRINT DATE" in elm.text.upper():
print str(elm.text) + "\n"
print "++++++++++++++below is repr+++++++++++++++++++++"
elm.text = newTxt
print repr(elm.text) Print out: Prepared by the Will County GIS Division
Print Date: 11.2.2018
302 N. Chicago St. Joliet, Il 60432
++++++++++++++below is repr+++++++++++++++++++++
u'Prepared by the Will County GIS Division\n302 N Chicago St. Joliet, Il 60432\nT:(815) 774-6343, E:gis@willcountyillinois.com\nPrint date: <dyn type="date" format=""/>' 2. I ran the MXD through the MXD Doctor and Documet Defragmenter. There was no corrupted element and running the script on a defragmented copy of the MXD made no difference. 3. There were no changes to the font, font size or centering in the Properties of the text box from old to new. As in, the Properties weren't affected. 5. I gave the text box element a name, 'PrintDate'. This didn't seem to have any effect as using the "PRINT DATE" keywords were enough. for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"):
if "PRINT DATE" in elm.text.upper():
elm.name == 'PrintDate' 6. I know the script works. I tested the script on a new MXD with similar text in a text box. The script ran fine and the resulting new text was displayed correctly! I also had a second text box in the MXD that had the word "date" among the text . I ran the script once with only "DATE" as a key word and it found both text boxes. It knowingly changed both. The odd thing was that while the one I'm after came out illegible again, the second text box was displayed correctly! I'm wondering if anyone has seen this behaviour before?
... View more
12-06-2018
11:54 AM
|
0
|
6
|
2298
|
|
POST
|
Randy, Thanks. The MXD Doctor did not find a single issue. I then ran the Defragmenter, which saved a copy of the MXD. It shrunk the size, of course. And then I ran the script on the defragmented copy of the MXD and there was no difference in output. After trying yours and Curtis' ideas leads me to believe it may not be a corrupt MXD. On top of that, there's a separate text box in the MXD that also has the word "date". I haven't mentioned it because I figured I'd straighten that problem out after figuring out my initial problem of changing the date in the "Prepared by..." text box. Anyways, this second text box was also found by the script and the text was changed to the new text. And it wasn't befuddled at all? As in, it was clear and legible.
... View more
12-06-2018
09:21 AM
|
0
|
0
|
1133
|
|
POST
|
Curtis, Thanks. I did that. And to my not-so-experienced eyes I don't see anything odd. Code: txtBlock = [
'Prepared by the Will County GIS Division',
'302 N Chicago St. Joliet, Il 60432',
'T:(815) 774-6343, E:gis@willcountyillinois.com',
'Print date: <dyn type=\"date\" format=\"\"/>'
]
newTxt = "\n".join(txtBlock)
# list the mxds of the workspace folder
for mxdname in arcpy.ListFiles("*.mxd"):
print "checking document: {}".format(mxdname)
mxd = arcpy.mapping.MapDocument(ws + "\\" + mxdname)
for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"):
if " DATE" in elm.text.upper():
print str(elm.text) + "\n"
print "++++++++++++++below is repr+++++++++++++++++++++"
elm.text = newTxt
print repr(elm.text) Print out: Prepared by the Will County GIS Division
Print Date: 11.2.2018
302 N. Chicago St. Joliet, Il 60432
++++++++++++++below is repr+++++++++++++++++++++
u'Prepared by the Will County GIS Division\n302 N Chicago St. Joliet, Il 60432\nT:(815) 774-6343, E:gis@willcountyillinois.com\nPrint date: <dyn type="date" format=""/>' In the map, the text box still goes from this: to this:
... View more
12-06-2018
08:26 AM
|
0
|
0
|
1133
|
|
POST
|
That should work, but neither do? The text is still jumbled in the map document text box. Strange. I then tried on a text box with similar text in a new map document and it worked fine. I'd hate to think the text boxes in these old map documents are corrupt, or something.
... View more
12-05-2018
12:19 PM
|
0
|
5
|
1777
|
|
POST
|
Here's the properties of the text box above. The address line is not where it should be. So, in the script I put another \n after the dynamic date (see below). That didn't change anything. for elm in arcpy.mapping.ListLayoutElements(mxd,"TEXT_ELEMENT"):
if ' DATE' in elm.text.upper():
txt = elm.text.split("\n")
for i, t in enumerate(txt):
if ' DATE' in t.upper():
txt[i] = "Print date: <dyn type=\"date\" format=\"\"/>\n"
## format date with periods, no leading zero in month
## txt = "Print date: <dyn type=\"date\" format=\"M.dd.yyyy\"/>"
elm.text = '\n'.join(txt)
elm.name = 'DateBox'
print elm.text, elm.name
... View more
12-05-2018
07:31 AM
|
0
|
7
|
1777
|
|
POST
|
Randy, Thanks for that. I have actually attempted to just replace the whole text box with text including the new dynamic date. It worked, but the text was really hard to read. And using your latest script it's doing the same thing:
... View more
12-04-2018
09:24 AM
|
0
|
9
|
1777
|
|
POST
|
Hi David, Thanks for the reply. It's been ongoing. Our dept. is in the process of switching to a new server that will have an https certificate. I'm anticipating the apps to possibly function once we do. So, I won't know until then.
... View more
12-04-2018
08:21 AM
|
0
|
0
|
842
|
|
POST
|
I also just tried name the text box, and then changing the text to the "newdate". But this changed the whole text box too. for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"):
if "PRINT DATE" in elm.text.upper():
elm.name = 'PrintDate'
if elm.name == 'PrintDate': #the name of the text element
elm.text = newdate
print "+++date changed+++" from this: to this: "Print date: 11/28/2018" Almost there, but I'm trying to avoid changing the rest of the text in the text box! EDIT: Yes, to answer your latest post, it did exactly what you're pointing out. The problem is that the rest of the text in that same box is gone after the change.
... View more
11-28-2018
12:56 PM
|
0
|
11
|
1777
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-13-2025 08:22 AM | |
| 1 | 11-12-2025 08:37 AM | |
| 1 | 10-22-2025 02:14 PM | |
| 1 | 01-17-2019 08:21 AM | |
| 1 | 07-06-2023 07:08 AM |
| Online Status |
Offline
|
| Date Last Visited |
a week ago
|