Moving geometry accross linked servers with MSSQL

MSSQL implements geometry via the Common Language Runtime (CLR). This implementation doesn’t allow you to call these function across linked servers. The solution is to create a view and  convert the geometry into x,y values (or lat/long for geography).

Then convert your data back into geometry when exposing the data in a view on the destination.

 

Example:

SELECT x
,y
,GEOMETRY::STPointFromText
('POINT(' + CONVERT(VARCHAR(30), x)
+ ' ' + CONVERT(VARCHAR(30), y)
+ ')', 2927) AS shapegeometry

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *