Intermediate Labelling Expressions in Map 3D

Intermediate Labelling Expressions in Map 3D

AllDayBreakfast
Participant Participant
2,319 Views
10 Replies
Message 1 of 11

Intermediate Labelling Expressions in Map 3D

AllDayBreakfast
Participant
Participant

I have a SHP file of a road network in AutoCAD Map 3D where I want to exclude road name labelling with the word 'private' or that of a particular value (which I can access in a list). Basically, any street name with the word "private" I do not want labelled. In ArcGIS Pro, this is easy: I choose the property I want (`STNAME`) and then in the SQL tab I choose the same expression where `STNAME` does not include the text `PRIVATE`

 

STNAME NOT LIKE '%PRIVATE%'

 

In Map 3D, this same expression returns an error "The operator syntax: 'NOT' is invalid. Click here to move the cursor to the error(9)". When I remove `NOT`, I get the error "Error: Result types are mismatched: the validation operation expected 'Text' but the expression returned 'Boolean'".

 

Any solutions on how to omit the entries I want that contain the specific words?

0 Likes
Accepted solutions (2)
2,320 Views
10 Replies
Replies (10)
Message 2 of 11

parkr4st
Advisor
Advisor

can you post the data or a screen shot of a portion of the data table so we can see the format of STNAME?

Message 3 of 11

ChicagoLooper
Mentor
Mentor

@AllDayBreakfast Wrote

<<….Result types are mismatched: the validation operation expected 'Text' but the expression returned 'Boolean'".>>

 

Boolean sounds strange because Boolean should be ‘this’ or ‘that.’ For example, yes or no, 0 or 1. Another example is data attribute attribute named ‘Is_Private’ with values either TRUE or FALSE. 

if your ‘STNAME’ attribute has names like Main St., County Blvd., City Ave. and River Rd (Private), then that’s not Boolean. 

I’m with @parkr4st. Upload a screenshot, or the columns and rows, of the list, the database file (dbf). Even better would be to upload the shp, shx, dbf and prj files for evaluation. 

Chicagolooper

EESignature

0 Likes
Message 4 of 11

AllDayBreakfast
Participant
Participant

Sorry, I may have been confusing in my first post. There is no field/attribute named "In_Private". The field is STNAME and it contains text data of road names (which I'm using to label the data on the map). Some of the road names contain the word "private" in them. See picture below:

Screenshot 2022-11-01 091804.png

 

Notice that some of the names contain the word "private", and some don't. So when labelling my map, I'd like to exclude the road names that have that word in them.

 

The SHP file I'm using can be found here: https://opendata.citywindsor.ca/Uploads/Street%20Centreline_UTM83.zip (note that this link will download the zip file). The main site is here: City of Windsor Open Data Catalogue (citywindsor.ca)

 

Thank you for replying and trying to help!

 

0 Likes
Message 5 of 11

ChicagoLooper
Mentor
Mentor
Accepted solution

Hello @AllDayBreakfast 

Try it like this:

103.PNG

 

Here's the BEFORE and AFTER using the shapefile you uploaded in Post #4 of this thread.

 

Before....

102.png

 

After...

101.PNG

 

 

Chicagolooper

EESignature

Message 6 of 11

Pointdump
Consultant
Consultant

Hi @AllDayBreakfast,
Following along with interest. Thanks for posting your data.
I tried just now to create 2 Thematic Rules, one without labels, one with:
NOT STNAME LIKE ' - PRIVATE'
STNAME LIKE ' - PRIVATE'
Seems to work.

EDIT: Zooming in, it still shows "- PRIVATE " Streets, so nope, this doesn't work.
Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
0 Likes
Message 7 of 11

Pointdump
Consultant
Consultant

OK, using 2 Thematic Rules works this way:
STNAME LIKE '%PRIVATE%' [Feature Label:None]
NOT STNAME LIKE '%PRIVATE%' [Feature Label:Text]

 

Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
0 Likes
Message 8 of 11

O_Eckmann
Mentor
Mentor
Accepted solution

Hi @AllDayBreakfast ,

 

Correct expression in labelling is :

 If ( ' STNAME LIKE ''%PRIVATE%'' '  , '', STNAME ) 

You should enclose boolean expression with '  '  to convert it into text format, and because you have a string in your condition, you need to double ' before and after it.

 

Olivier

Olivier Eckmann

EESignature

Message 9 of 11

AllDayBreakfast
Participant
Participant

Thank you for the instructions! Although it isn't the label expression I'm looking for, I can see how it solves the problem because you're querying out the data I don't need anyway.

 

Thank you so much!

0 Likes
Message 10 of 11

AllDayBreakfast
Participant
Participant

Copied and pasted the code into the expression window and it worked! Thank you so much! I just wish I knew how to read the code so I can change aspects of it in the future. Regardless, I'm making this as solved.

 

Thank you!

0 Likes
Message 11 of 11

O_Eckmann
Mentor
Mentor

Hi @AllDayBreakfast ,

 

For exemple with numeric boolean test  :    NOLANE = 2   it could be written 

 

if   NOLANE = 2

then  write label as text = '2' 

else write label as text empty ( = '')  

 

but Map 3D need only string info in the 3 members of condition if. So it should be written

 

if (' NOLANE = 2 ', '2', '')

 

Every term is enclosed with quote to ensure it's treated as string.

 

If your boolean condition works with string value, you should use double quote to enclose string value and keep quote to enclose boolean condition

For exemple to test     ST_NAME = 'BROADWAY'     you should write

 

if ('  ST_NAME = ''BROADWAY''  '  , 'BROAD', 'NOT BROAD')

 

Hope it was clear enough.

 

Olivier

 

Olivier Eckmann

EESignature