4

Is it possible in SQL to run a query of spatial data, and then just return a single polygon, or a radius, that encloses, aggregates, all of the spatial data that was in that query into one feature?

4

Yes, using SQL Server's

You essentially have three options

  • ConvexHull: returns a polygon that essentially wraps the input with a rubber band,
  • EnvelopeAggregate: returns a bounding box (polygon) that encapsulates the input (box = lines in a cartesian project, arc segments in a 3d/spheroid/geographic projection)
  • UnionAggregate: takes all of the inputs and composes them into a single complex-polygon

Note: you mention radius, a radius is a buffer over an input in GIS.

If you need more features, you should check out the free PostgreSQL and PostGIS which supports even more GIS functionality.

  • Thank you! that's exactly what i'm hoping for. Are there performance benefits to choosing one or another? I'm assuming UnionAggregate would probably be the least performant if so. Otherwise EnvelopeAggregate would probably fit my needs – Phil Mar 29 '18 at 19:10
  • 1
    EnvelopeAggregate is likely the most performant, UnionAggregate the least. – Evan Carroll Mar 29 '18 at 19:15

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.