DECLARE @geog GEOGRAPHY; DECLARE @geom GEOMETRY; SET @geom = GEOMETRY::STGeomFromText('POLYGON ((-99.213546752929688 19.448402404785156, -99.2157974243164 19.449802398681641, -99.2127456665039 19.450002670288086, -99.213546752929688 19.448402404785156))', 4326); SET @geom = @geom.MakeValid() --Force to valid geometry SET @geom = @geom.STUnion(@geom.STStartPoint()); --Forces the correct the geometry ring orientation SET @geog = GEOGRAPHY::STGeomFromText(@geom.STAsText(),4326) SELECT @geog.STArea();
转载于:https://www.cnblogs.com/jmax/p/4806606.html