根据SDE图层名称,判断Geometry类型

方法一:通过代码  

   /// <summary>
        /// 根据SDE图层名称,判断Geometry类型
        /// </summary>
        /// <param name="TargetLayerName">图层名称</param>
        /// <returns>返回Geometry类型,如:ST_POINT;ST_LINESTRING;ST_POLYGON</returns>
        public static string GetTargetLayerGeometryType(string TargetLayerName)
        {
            string strsql = "SELECT t.Shape.entity ENTITY FROM " + TargetLayerName + " t";
            DataSet ds = DBQueryUtil.ExecuteQuery(strsql);
            string GeometryType = ds.Tables[0].Rows[0]["ENTITY"].ToString();
            if (GeometryType == "1")
            {
                return "ST_POINT";//\\1为ST_POINT;4为ST_LINESTRING;8为ST_POLYGON

            }
            else if (GeometryType == "4")
            {
                return "ST_LINESTRING";
            }
            else
            {
                return "ST_POLYGON";
            }
        }

方法二:oracle 脚本函数或存储过程

  --------------------Func_CheckGeometryType-------

  -------判断坐标构造成的几何对象,是否为st_point or st_ST_LINESTRING or st_polygon------------------
  function Func_CheckGeometryType(geometry varchar2,markType varchar2)      return number
     as
     geometryType varchar2(50);
     mType varchar2(50);
    
     begin
     select sde.st_geometrytype(sde.st_geometry (geometry, 0)) into geometryType from dual;
     mType :=upper(markType);
     if (mType = 'LINE') then
         mType :='ST_' || mType || 'STRING';
     else
         mType := 'ST_' || mType;
     end if;
    
     if (geometryType = mType) then
        return 1;
     else
        return 0;
     end if;
  end Func_CheckGeometryType;

posted @ 2010-11-01 20:13  孜孜不倦、鸟鸟升烟  阅读(476)  评论(0编辑  收藏  举报