I have an Mapbasic/.NET application that read data from SQL Server 2008 R2. I have a table with polygons and need to sum up the area of a subset of the polygons. This should work dynamic so the user should be able to sort on different parameters and get the sum of the areas from their selection. My options are:

  1. MapBasic
  2. C# .NET

Mapbasic seems to be to slow for this, personally I would prefer to do this direct in SQL Server but have not found any way to sum up the area with T-SQL. Have anyone done this before or is there any reason to do this at any of the levels?


With MapBasic you can get the area using a basic SQL statement:

Select Sum(Area(obj, "sq m")) "SUMAREA" from MYTABLE Into __RESULT
Fetch First From __RESULT

here MYTABLE contains the records matching the parameters set by the user. You can of course build these criterias into the select statement.

I'm sure you can do this thru SQL Server in a similar way

  • Thanks, I was making the problem more complicated then it was, it works the same in SQL Server with STArea(). – user613068 Sep 18 '12 at 12:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.