Arithmetic operations - shapefile attribute tables

Dear all,

I’m new to programming with MapWinGis. I looked in the documentation, but I found it difficult. Could someone show me a code where arithmetic operations would take place between fields in the shapefile attribute table. For example: multiplication between two fields in the attribute table and save the result in another field.

Have a look at the Table class and especially at the Calculate() method.

First, you add a new field, next you do the calculation and save the result in that new field.

In MapWindow v5 (the C# GUI for MapWinGIS) you can have a look at how it is implemented:

The string, in this example [STATE_NAME] + [AREA] / 100 is the expression.

Here’s an example of how to get a field and alter its data: MapWinGIS: CalculateArea.cs

I see we don’t yet have an example of sf.Table.Calculate().
Perhaps you can share your results and I’ll try to add it as an example.

Hello @pmeems

Thanks for your answer.

I had already searched for the code in those indications, but I haven’t had a positive result yet. I will continue to try to implement Sf.Table.Calculate (), because I need it for my PhD thesis.

If anyone can help me thank you.

Sorry for the very late reply.

Do you still have questions about sf.Table.Calculate()?