Shape file - Conditional calculation

Shape file - Conditional calculation

aniket.bhola
Contributor Contributor
866 Views
18 Replies
Message 1 of 19

Shape file - Conditional calculation

aniket.bhola
Contributor
Contributor

Hi everyone,

 

I am having multiple shape files, doing multiple analyses based on data attributes, and generating thematic conditional maps for different work. 

 

I am repetitively using 'create/ manage calculations' based on available data attributes in the shape file. In one such work, I need to generate a new column in the data attribute table with a conditional calculation. The attached image is for the condition I require to generate in the data attribute table. I am able to generate this using the shape file "style editor' option, but not able to generate it using the 'create/ manage calculations' option.

 

Please let me know if any method works and the possibilities of the same.

 

Thank you

-Aniket

 

0 Likes
867 Views
18 Replies
Replies (18)
Message 2 of 19

Pointdump
Consultant
Consultant

Hi Aniket,
Are you clicking "Create a Calculation..." at the bottom of the Data Table like >>>This<<<?
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 3 of 19

aniket.bhola
Contributor
Contributor

Hi Dave,  @Pointdump 

 

Yes, I am generating a new calculation using the same option you shared via link, "Create a calculation.

 

Regards

Aniket

 

0 Likes
Message 4 of 19

Pointdump
Consultant
Consultant

Aniket,
More details please. Maybe a screen shot of OD in Properties? Can you post the shapefile you're having trouble with?
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 5 of 19

aniket.bhola
Contributor
Contributor

Greetings Dave @Pointdump 

 

Herewith, I am attaching the shape file and screenshot of the required condition. 

 

The shape file has two attribute columns named value1 and value2. In the data attribute table, I required a new column (named final_value) that has a condition applied, similar to what I mentioned earlier, and also shown in the screenshot. 

 

Thank you

Aniket

0 Likes
Message 6 of 19

Pointdump
Consultant
Consultant

Aniket,
Thanks for posting your shapefile.
OK, I see the issue now. For some reason, IF is only available in the Style Editor, not the Data Table. So if you want to add a new column from an IF statement, you'll need to use QGIS.
Dave

 

Calc_2.png

 

Calc_3.png

 

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 19

aniket.bhola
Contributor
Contributor

Hi @Pointdump 

 

Thank you for sharing these steps using QGIS software. But I am looking for the solution with the help of Map 3D or Civil 3D-Planning and analysis software.

 

Regards

Aniket

0 Likes
Message 8 of 19

Pointdump
Consultant
Consultant

Aniket,
You may want to post this also in the >>>Map 3D Forum<<<. There are some serious Map Heads over there.
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 9 of 19

ChicagoLooper
Mentor
Mentor

Hi @aniket.bhola 

You are trying to 'create a calculation' which will create a NEW column in the Table. Once the new column has been created, can you explain what you plan to do with that new column?

Chicagolooper

EESignature

0 Likes
Message 10 of 19

aniket.bhola
Contributor
Contributor

Hi @ChicagoLooper 

 

Thank you for reaching out to work on the issue of creating a new column with the "Create a calculation" option. In our projects, we are working with data attributes using mathematical expressions for different analyses. One such analysis with this condition ("If")  will give the result based on the smaller value of the two options (from two columns). This newly generated column will allow us to further use and create thematic maps with a condition-based approach. 

(This option is required to generate analysis based on buildable, non-buildable, assign space index, etc.)

 

Thank you

-Aniket

0 Likes
Message 11 of 19

parkr4st
Advisor
Advisor

in the attached drag and drop the .layer in the map.  when you add a new value to the difference column the theming will change.

Does the map display acheive your needs?

There are three possibilities <,>, = 0.    Do you another possible option needed?

0 Likes
Message 12 of 19

aniket.bhola
Contributor
Contributor

Hi @parkr4st 

 

Thank you for sharing the way of generating differences from the value1 and value2 columns and categorizing them into three groups for thematic criteria. As I mentioned earlier, I need to use the newly generated conditional column/ value (from value1 and value2) further to generate expressions for analysis. The approach to creating differences will not provide me with the result I require.  

 

Thank you

Aniket

0 Likes
Message 13 of 19

parkr4st
Advisor
Advisor

That's OK. value1<value2 is a test essentially delta of v1 and v2 

So,  the original   IF(value1<value2,value1, value2) will crash or report NULL in v1 =v 2 as there is no option for the 0 difference?  Is that acceptable?

you can theme off of NULL but not a crash?

 

 

0 Likes
Message 14 of 19

ChicagoLooper
Mentor
Mentor

Hi h@aniket.bhola 

<<...This newly generated column will allow us to further use and create thematic maps with a condition-based approach....>> 

 

You should upload an illustration that shows your themed map and thoroughly explain the criteria needed to produce all possible outcomes. When you say, 'this newly generate column will be used to generate this and that,' you're not providing enough information that explains how the the If Then expression should work. In fact, you might not even need an If Then expression at all. Only your detailed explanation can determine that.

 

As it stands now, the Forum can only guess what you are really, I mean really and truly, guess what you're trying to achieve. Here's a Best Guess:

 

This is only a guess.

PLOT COLOR (The colors are determined using IF/THEN expression)

Green plots VALUE1 < VALUE2.

Red plots VALUE1 > VALUE2.

 

TEXT LABELS

Line 1 = 'PLOT_NUMBE'

Line 2 = the lower of 'VALUE1' and 'VALUE2'  (The lower value is determined using IF/THEN expression)

 

1001.JPG

 

What is your theme? Would it be possible to explain it in detail?

 

Chicagolooper

EESignature

Message 15 of 19

Pointdump
Consultant
Consultant

@ChicagoLooper,
Aniket is pointing out the availability of conditional IF statement is different between Styling a Feature Label and Creating a Calculation.


Style >> Feature Label >> Add Label >> Use Expression >> Conversion Dropdown

 

Table >> Options >> Create a Calculation... >> Conversion Dropdown

 

Dave

 

Conversion_1.png

 

Conversion_2.png

 

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 16 of 19

ChicagoLooper
Mentor
Mentor

@aniket.bhola 

Here's another approach........

 

Text Labels in BLUE

PLOT_NUMBE <<taken from the dbf>>

'VALUE' <<Compare VALUE1 vs VALUE2, display the lower of the two values>>

 

Plot Colors

If FINAL_VALUE < 0 (negative) then make plot Green......BUT.....

If FINAL_VALUE > 0 (positive) then make plot Red.

 

2001.JPG

 

Notes:

The FINAL_VALUE column was created using a calculation.

Then FINAL_VALUE column is needed to generate line 2 in the Blue label.

 

Chicagolooper

EESignature

Message 17 of 19

ChicagoLooper
Mentor
Mentor

@Pointdump 

While performing a 'calculation' Map3D doesn't allow you to use an IF-THEN expression. That's why it's important to determine the purpose of the FINAL_VALUE column. If he can achieve the same result, then does it matter HOW it's achieved? The OP has already stated he wants to do it in the AutoCAD environment which means he won't (or can't) use QGIS.

 

The Forum doesn't know the end goal, it was never disclosed, and the OP is marrying his solution to a Calculation.

Instead, he should be more openminded and marry a solution, regardless of how that solution is achieved.

 

Chicagolooper

EESignature

Message 18 of 19

Pointdump
Consultant
Consultant

@ChicagoLooper,
Sometimes we just want what we want.
"...performing a 'calculation' Map3D doesn't allow you to use an IF-THEN expression."
I think this is a glaring oversight on Autodesk's part.
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
Message 19 of 19

ChicagoLooper
Mentor
Mentor

@Pointdump 

Well....we want what we want? I agree, 100%. 

 

Not trying to be difficult, but I also think we want results. More specifically, the client wants his desired results.

 

Sometimes it really doesn't matter how we get them we just want the results reflected accurately in the deliverable. That's how (and why) we get paid. By delivered results. We don't get paid by Likes or Accepted Solutions in the Forum. Client doesn't care how we do it in Map3D, they just want it accurately formatted, reflected in the Dwg, and in a way that can be easily changed in case a 'higher up' or an authoritative overseeing agency demands changes. And by 'easily changed' I mean someone else in the office who can make those changes lickety-split in case the original drafter is not available.

 

In the end, OP still can't do it using only the Create Calculation feature. In light of that, he's gotta get creative to meet expectations and achieve results. If OP willing to use another GIS-essy program (QGIS, ArcPro, Global Mapper, etc.) then the strategy may change, but as of now, OP wants it in the Cad environment. And it can't be done using his workflow.

 

Chicagolooper

EESignature

0 Likes