Convert Geometry data into a Geography data in MS SQL Server
2015-09-14 11:00
651 查看
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();
参考: 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
相关文章推荐
- oracle查询用户下每张表的信息
- 数据库的四个范式
- ArcSDE Post失败:"error connecting to oracle: O".
- 查看oracle数据库的使用状态
- SQL Server 数据库 'xxx' 正处于转换状态。请稍后再尝试该语句。
- MySQL错误Another MySQL daemon already running with the same unix socket.v
- 数据库的同步和复制----sql语句方法
- oracle——去除重复记录
- 我所学习的数据库知识总结!~
- Oracle Service Bus学习笔记
- Use SQLite Instead of Local Storage In Ionic Framework【转】
- 30多条mysql数据库优化方法,千万级数据库记录查询轻松解决
- Oracle命令学习
- postgresql sql语句 更改表名
- c#使用SqlBulkCopy批量插入数据
- oracle将一个用户的权限赋予给另外一个用户
- OVM Concept: Oracle VM Agent
- 使用查询结果产生的数据批量执行update 或add sql语句
- mysql中bin-log日志操作常用命令
- 用批处理文件来手动启动和停止Oracle服务