Sign up ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
Do you have the Sql Server Spatial Tools assembly installed? – Kirk Kuykendall Sep 14 '12 at 16:11

1 Answer 1

up vote 0 down vote accepted

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

share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

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