Convert Geometry data into a Geography data in MS SQL Server

Source: Internet
Author: User

DECLARE @geogGEOGRAPHY;DECLARE @geomGEOMETRY;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 geometrySET @geom = @geom. Stunion (@geom. Ststartpoint ());--forces the correct the Geometry ring orientationSET @geog =Geography::stgeomfromtext (@geom. Stastext (),4326) SELECT @geog. Starea ();

 

Reference: http://blogs.msdn.com/b/edkatibah/archive/2008/08/19/ Working-with-invalid-data-and-the-sql-server-2008-geography-data-type-part-1b.aspx

Convert Geometry data into a Geography data in MS SQL Server

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.