A common requirement in GIS is to be able to find the number of points in a polygon to answer a question such as “how many towns are in this county.”
With the spatial operations in SQL Server this can be calculated dynamically, however for large spatial datasets it can often take several minutes to run the query. If a user is running the query through a web interface they will either give up, or the connection will time out.
It can be useful to assign all features to a parent polygon in the database so these calculations are almost instant. To do this run the following SQL: