POST
|
Well that seemed to solve that issue, but creates a new one now. I can often have just the WIDTH supplied without a NAME. This code won't display it if there is no NAME given. Also, if I add in a Route and not ALT_NAME, it duplicates the NAME field. This is one interesting things you're trying to solve here ha...
... View more
02-07-2023
07:59 AM
|
0
|
0
|
316
|
POST
|
Very odd. So I have tried your code and I get it to work, all except when there is only the NAME being displayed. Then it fails with the '&' and prints out the following: "TEST & TEST" will show up as "TEST &: TRUE" Now if I add an ALT_NAME with or without the '&' it displays both perfectly fine. Or if I add a ROUTE or WIDTH (other than what is in the exclusion) it works perfectly fine. So just the NAME with the '&' fails. This is getting pretty close to the fix though. On another note, being on 3.0.3 myself. I did try with the <ITA> just to see if I get the same issues you did, and I am getting it working for me the exact way you used <BOL>. So odd you aren't getting that working like I am...
... View more
02-07-2023
05:43 AM
|
0
|
0
|
550
|
POST
|
Yes that works the same with the code I just posted earlier and allows the use of the "&". The issue is that it won't allow me to work with Itallics or font changes and that was the issue. I can get away using the code I had, or the one you posted just fine, but I won't have the ability to work with that functionality. Again, it's more just visually appeasing, and not something I really need, but it would be nice to see if it could work with that sort of thing. Here's the example of what I added to your code for just the Width (note I had to rename your WIDTH1 to another name as some data comes in with a Width1 as the name, and searching replacing doesn't work as well like that.) so I just renamed it to WDTH_TMP if WDTH_TMP:
if str(WDTH_TMP).strip() not in (None,"<NULL>","<Null>","","0",0):
width_str = "<ITA>Width = {}'</ITA>".format(str(WDTH_TMP))
str_list.append(width_str) Here's the full code using your example and the itallics and font size changes where having a "&" in the name, still causes that issue displaying the code for itallics, etc as the original issue had. Removing those of course works fine, but I don't get this added visual possibilities is all... (I will be out on vacation for a week so after tomorrow, I'll repond and check out any other suggestions next week.)
... View more
02-06-2023
03:50 PM
|
0
|
0
|
559
|
POST
|
Well for the Width the original code had if WDTH_TMP:
if str(WDTH_TMP).strip() not in ("<NULL>","<Null>","0","Varies"):
width_str = "<ITA>Width = {}'</ITA>".format(str(WDTH_TMP))
str_list.append(width_str) as I need to exclude 0 if it was a numeric field, or exclude text values that show up as "<NULL>, "0", "<Null>" and "Varies". These have been populated in the Width field if the Width was a text field and ones with those values, I didn't want to display at all as a lable if they contained those values...
... View more
02-06-2023
12:58 PM
|
0
|
0
|
568
|
POST
|
Though the problem now is I can't exclude some of the text variables that might show up if that field is a Text rather than Numeric. I have gotten this version of the code to work without any issues. The only problem of course is the labeling features such as font size and Itallics aren't included, but I can deal with that as the "&' in the NAME or ALT_NAME is more important. Thanks for your help though on this again... def FindLabel([NAME],[ALT_NAME],[ROUTE],[WIDTH]):
str_list = []
if [NAME] not in (None, "<NULL>", "", "0"):
str_list.append([NAME])
if [ALT_NAME] not in (None,"<NULL>", "", "0"):
altname_str = '({})'.format([ALT_NAME])
str_list.append(altname_str)
if [ROUTE] not in (None,"<NULL>", "", "0"):
route_str = 'RT# {}'.format([ROUTE])
str_list.append(route_str)
if [WIDTH] not in (None, "<NULL>", "", "0"):
width_str = 'Width = {}'.format([WIDTH])
str_list.append(width_str)
label_str = '\n'.join(str_list)
return(label_str)
... View more
02-06-2023
09:45 AM
|
0
|
0
|
576
|
POST
|
@RhettZufelt , I did run into an issue though. As I mentioned before, the WIDTH can actually be a string in some cases or numeric in other cases. So right now this code works if the WIDTH is a String, but it fails if it's numeric and WIDTH=0. So I've tried to add in just a 0 into the code, but it doesn't seem to ignore that. I've also tried to use the None as well without success. (Note I had to change the name of the Width_1 to WDTH_TMP to make it easier. Here's what I'm trying without success if the value is 0 and WIDTH is actually a numeric field. if str(WDTH_TMP).strip() not in (None,"<NULL>","<Null>","0",0):
... View more
02-03-2023
06:51 AM
|
0
|
0
|
584
|
POST
|
Thanks so much, and I actually used the code block in the past and just forgot how to use it, so thanks for that refresher for my future questions on the forum. I liked how you explained everything and that made it much easier to understand why you changed what you did. Now I can update my document with this and make it a lot more inclusive to the types of naming conventions we get. With the Width, yes we can get just numeric values or such things like "8FT" or "Varies", so I always have to treat that as a text field (I forgot to include the "varies" back into the code, but that's an easy fix). Thanks so much for this help...
... View more
02-03-2023
05:43 AM
|
0
|
0
|
586
|
POST
|
Ok I got the Name part working with the & which is great and thank you for that. In the larger code (which is different than the example I showed you), I am trying to apply that to 2 fields out of 4. In this example NAME and ALT_NAME. I run into issues when trying to do it for a 2nd field. Here's the code that I can't seem to get working. One issue is that you stated the <ITA> and such may not be supported in this fashion, 2nd I can't get this code to work at all regardless of where I place the ALT_NAME1 if statements for the &: def FindLabel([NAME],[ALT_NAME],[ROUTE],[WIDTH]): str_list = [] NAME1=[NAME] ALT_NAME1=[ALT_NAME] ROUTE1=[ROUTE] WIDTH1=[WIDTH] if '&' in NAME1: NAME1=NAME1.replace("&","&") if NAME1 not in (None, "<NULL>","<Null>", "", "0"): str_list.append(NAME1) if '&' in ALT_NAME1: ALT_NAME1=ALT_NAME1.replace("&","&") if ALT_NAME1 not in (None,"<NULL>", "", "0"): altname_str = "<ITA><FNT size = '6'>({})</FNT></ITA>".format(str([ALT_NAME])) str_list.append(altname_str) if ROUTE1 not in (None,"<NULL>", "", "0"): route_str = "RT#: {}".format([ROUTE]) str_list.append(route_str) if WIDTH1 not in (None, "<NULL>","<Null>", "", "0", " "): width_str = "<ITA>Width = {}'</ITA>".format(str([WIDTH])) str_list.append(width_str) label_str = '\n'.join(str_list) return(label_str)
... View more
02-02-2023
01:54 PM
|
0
|
0
|
1582
|
POST
|
So that at least shortened the script a bit by removing like you said the extra itallics from the WIDTH part, but I still have the same issue with the NAME and using & in the name as in my last screen shot...
... View more
02-02-2023
12:25 PM
|
0
|
0
|
1586
|
POST
|
Well first off, the WIDTH is not always a numeric field, it can sometimes be a text field depending on who gives us the data. This is also one of the simple labeling functions I do, there could be a number of other fields that also get displayed. I just used these two NAME and WIDTH as an easy example. The code you suggested returned an error: Here's an example of what I am experiencing This is how my names should look and in this case I substituted the '&' with'and'. It also has the width field shown as well in itallics. Example 2 (amp_ex2.jpg) shows what I am getting if I use the '&' instead...
... View more
02-02-2023
10:39 AM
|
0
|
2
|
1592
|
POST
|
Just what's shown in the code above. The actual fied is a text field though in the dataset...
... View more
02-02-2023
08:01 AM
|
0
|
0
|
1605
|
POST
|
I've got a number of different labeling scripts I use and they all at least contain one NAME type field I display. On the rare occasion, I have names that contain the "&" (such as "Rough & Ready"). I know the ampersand is a special character and when I use it in my script it starts displaying the other fileds parameters in the output text. Here is an example of one of my simple labeling codes in Python: def FindLabel([Name_1],[Width_1]): str_list = [] if [Name_1] not in (None, "<NULL>","<Null>", "", "0"): str_list.append([Name_1]) if [Width_1] not in (None, "<NULL>","<Null>", "", "0", " ","Varies"): Width_1_str = '<ITA>Width = {}\'</ITA>'.format("<ITA>" + [Width_1] + "</ITA>") str_list.append(Width_1_str) label_str = '\n'.join(str_list) return(label_str) I have found an example using VB and somehow incorporating "&","&" into the script, but I have played around with adding variations of that in my code, but I can't seem to get it to work without errors. Any ideas how to simply allow & into my Name_1 field in this example? Thanks
... View more
02-02-2023
06:55 AM
|
0
|
23
|
2545
|
POST
|
If you used the Attribute Editor and click on the selected part (in the red box in the lower right) it should have shown the selected features when using the Statistics on your field. It will bring up the Char Properties pane and then you can see the Selection listed there beside the entire dataset. This is of course if you were doing it this way and not the data engineering method as it looked like you originally did since you had the distribution chart showing (which I don't use or need either)...
... View more
01-20-2023
08:45 AM
|
0
|
0
|
3043
|
IDEA
|
I am suggesting the Goto XY (esri_mapping_gotoXYControl) to allow a single entry of both the Lat/Long rather than forced to using it as it currently is as two separate boxes. I find it frustrating when using the Copy Location (esri_mapping_copyCoordinates) from one map and want to find that location on another, I have to paste the full Lat/Long in the Long box, then cut out the Lat and re-paste that in the Lat box. It would be easier to have the option to paste the entire coordintate into the a Lat/Long box option (similar as to how Google allows pasting of both and it will jump to the location) as well as have it separated as it currently has to deal with both types of coordinates to paste in. It would also be helpful to allow the Long box and Lat box to also be expanded to paste in longer coordinates as well.
... View more
01-18-2023
06:47 AM
|
12
|
2
|
476
|
POST
|
@JeffBaker2: That acutally seemed to work for me right now and a good workaround...
... View more
01-03-2023
08:35 AM
|
0
|
0
|
1271
|
Title | Kudos | Posted |
---|---|---|
1 | 11-15-2019 09:49 AM | |
1 | 12-06-2023 05:28 AM | |
2 | 12-07-2023 07:32 AM | |
5 | 11-15-2023 12:31 PM | |
1 | 10-23-2023 09:33 AM |
Online Status |
Offline
|
Date Last Visited |
a month ago
|