I have a parcel layer, on top of it the buildings layer lies, each parcel contains a building, I want to create a spatial view that automatically spatially join the building with parcels (using intersect) in order to append the Parcel_Number attribute to the buildings features. Is there a way to do this?
The two layers are in enterprise geodatabase in SQL Server 2014
Any help is highly appreciated!
Hey Hani - you could use the SQL Server STIntersects function for this if your data uses Geometry data storage. For example, you could create a view in SQL Server using something like this:
CREATE VIEW buildingsparcels AS
select a.ObjectID, a.BuildingID, a.SHAPE, b.ParcelID from
DBO.Buildings a, DBO.Parcels b
WHERE a.SHAPE.STIntersects(b.SHAPE) = 1
Also in the above spatial view Julia proposed, try to create the building centroid and use this point layer to intersect with Parcels, in case you face any performance issue.
The performance may vary according to the polygon complexity.