1

I've just started with SQL Server, coming from an Arcpy/ArcGIS/python geospatial background.

I've been searching for a while for the answer to this question but have only found examples for using STUnion on two shapes.

I have 2 spatial tables, table 1 and table 2 in SQL Server.

Table 1 has some columns and a geometry column and multiple (000's) records.

Column A
Column B
Shape

Table 2 has some columns and a geometry column and multiple (000's) records.

Column C
Column D
Shape

I want to do the equivalent to the arcpy Union_analysis (http://pro.arcgis.com/en/pro-app/tool-reference/analysis/union.htm) where by I join the tables spatially and keep all the records from each and the fields from each table whether they intersect or not.

The table I end up with would have

Column A
Column B
Column C
Column D
Shape

Is there a method for doing this? Or do I have to do the union using python and transfer the result back to SQL Server.

Any suggestions helpful.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • Why you need only one geometry column [Shape] in result...? – Rajesh Ranjan Jun 17 '16 at 05:15
  • Do you mean you want something like `SELECT Tab1.ColA, Tab1.ColB, Tab2.ColC, Tab2.ColD Tab1.Shape.STUnion(Tab1.Shape) FROM Tab1 JOIN Tab2 ON Tab1.Shape.STIntersects(Tab2.Shape) = 1` – Liesel Jun 20 '16 at 04:10

0 Answers0