搜尋
首頁資料庫mysql教程Java操作Oracle空间信息介绍(SDE)

Java对sde操作,首先需要下载sde支持的jar包。jpe92_sdk.jar和jsde92_sdk.jar两个包,这两个包可以从安装的目录下找到。

sde是Spatial Database Engine简写,中文全称:空间数据库引擎。

SDE是一种客户/服务器软件,可使空间数据在工业标准的数据库管理系统中存储、管理和快速查询检索。把GIS数据放在RDBMS中,但是一般的RDBMS都没有提供GIS的数据类型(如点、线、多边形、以及这些feature之间的拓扑关系和投影坐标等相关信息),RDBMS只提供了少量的数据类型支持:int,float,double,,Blob,Long ,char等,一般都是数字,字符串和二进制数据几种。并且RDBMS不仅没有提取对GIS数据类型的存储,也没有提供对这些基础类型的操作(如:判断包含关系,相邻、相交、求差、距离、最短路径等)

Java对sde操作,首先需要下载sde支持的jar包。jpe92_sdk.jar和jsde92_sdk.jar两个包,这两个包可以从安装的目录下找到。

下面是Java获的sde的链接代码:

/**
  * 连接sde服务
  * @return
  */
 public  SeConnection getConnection () {
        SeConnection conn = null ;
        try {
            conn = new SeConnection(SDE_SERVER_IP, SDE_PROT, SDE_DATEBASE_SID, SDE_USERNAME, SDE_PASSWORD);
        } catch (SeException e) {
            return null;
        }
        return conn;
 }

对sde数据进行添加,点线面的新增

/**
  * 添加资源信息点到sde中
  * @param pointBean 坐标点 POJO
  * @param tbName    图层名称
  * @param String typeName 所画的类型 1 点 2 线 3 面
  * @return  Long  sde的id
  * @throws Exception
  */
 public Long addPointObject(PointBean pointBean, List columnList, String tableName, String typeName) throws Exception {
  SeLayer insertLayer = null;
  SeConnection conn = null;
  Long intsertRowID = null;
  SeInsert insert = null;
  try {
   conn = this.getConnection();
   insertLayer = new SeLayer( conn,  tableName, "SHAPE");
   if (insertLayer == null) {
    throw new Exception("找不到空间表:" + tableName);
   }
   conn.startTransaction();
   int arrayLength = columnList.size() + 1 ;
   String[] cols = new String[arrayLength];
   cols[0] = "SHAPE";
   for (int i = 0 ;i    ColumnBean columnBean = (ColumnBean)columnList.get(i);
    cols[i+1] = columnBean.getName();
   }
   insert = new SeInsert(conn);
   insert.intoTable(insertLayer.getName(), cols);
   insert.setWriteMode(true);
   SeCoordinateReference coordref = (SeCoordinateReference) insertLayer.getCoordRef();
   SeShape shape = new SeShape(coordref);
   
   if ("1".equals(typeName)) {
    this.addPoint(pointBean, shape);
   } else if ("2".equals(typeName)) {
    this.addLine(pointBean, shape);
   } else if ("3".equals(typeName)) {
    this.addPolygon(pointBean, shape);
   }
   SeRow row = insert.getRowToSet();
   row.setShape(0, shape);
   for (int i = 0 ;i    ColumnBean columnBean = (ColumnBean)columnList.get(i);
    if (columnBean.getTypeObject() == 1) {
     row.setNString(i+1, String.valueOf(columnBean.getValObject()));
    } else if (columnBean.getTypeObject() == 2) {
     row.setInteger(i+1, Integer.parseInt(columnBean.getValObject().toString()));
    }else if (columnBean.getTypeObject() == 3) {
     row.setDouble(i+1, Double.parseDouble(columnBean.getValObject().toString()));
    }
   }
   insert.execute();
   intsertRowID = new Long(insert.lastInsertedRowId().longValue());
   conn.commitTransaction();
  } catch (Exception ex) {
   ex.printStackTrace();
   conn.rollbackTransaction();
  } finally {
   if (insert != null) {
    insert.close();
   }
   if (conn != null) {
    conn.close();
   }
  }
  return intsertRowID;
 }

sde查询接口实现

/**
  * 查询sde
  * @param productId 产品id
  * @throws SeException
  */
 public SeQuery searchSde (Long productId, String tableName) throws SeException {
  SeConnection conn = getConnection();
  SeLayer layer = new SeLayer( conn,  tableName, "SHAPE");
        SeSqlConstruct sqlConstruct = new SeSqlConstruct(layer.getName());
        if (productId != null) {
         sqlConstruct.setWhere("yid="+productId.intValue());
        }
        String[] cols = null;
        if (tableName.equals("YU_AN_POINT") || tableName.equals("FANG_AN_POINT")) {
            cols = new String[4];
            cols[0] = new String("OBJECTID");
            cols[1] = layer.getSpatialColumn();
            cols[2] = new String("NAME");
            cols[3] = new String("IMAGETYPE");
        } else {
         cols = new String[3];
            cols[0] = new String("OBJECTID");
            cols[1] = layer.getSpatialColumn();
            cols[2] = new String("NAME");
        }
        System.out.println("cols.length : " + cols.length);
        SeQuery query = new SeQuery(conn, cols, sqlConstruct );
        query.prepareQuery();
        query.execute();
        return query;
 }

SDE信息删除操作

陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
MySQL字符串類型:存儲,性能和最佳實踐MySQL字符串類型:存儲,性能和最佳實踐May 10, 2025 am 12:02 AM

mySqlStringTypesimpactStorageAndPerformanCeaseAsfollows:1)長度,始終使用theSamestoragespace,whatcanbefasterbutlessspace-felfficity.2)varCharisvariable varcharisvariable length,morespace-morespace-morespace-effficitybuteftife buteftife butfority butfority textifforlyslower.3)

了解MySQL字符串類型:VARCHAR,文本,char等了解MySQL字符串類型:VARCHAR,文本,char等May 10, 2025 am 12:02 AM

mysqlStringTypesIncludeVarChar,文本,char,Enum和set.1)varCharisVersAtileForvariable-lengthStringStringSuptoPuptOuptoPepePecifiedLimit.2)textisidealforlargetStortStorStoverStoverStorageWithoutAutAdefinedLength.3)charlisfixed-lenftenge,for forConsistentDatalikeCodes.4)

MySQL中的字符串數據類型是什麼?MySQL中的字符串數據類型是什麼?May 10, 2025 am 12:01 AM

MySQLoffersvariousstringdatatypes:1)CHARforfixed-lengthstrings,2)VARCHARforvariable-lengthtext,3)BINARYandVARBINARYforbinarydata,4)BLOBandTEXTforlargedata,and5)ENUMandSETforcontrolledinput.Eachtypehasspecificusesandperformancecharacteristics,sochoose

如何向新的MySQL用戶授予權限如何向新的MySQL用戶授予權限May 09, 2025 am 12:16 AM

TograntpermissionstonewMySQLusers,followthesesteps:1)AccessMySQLasauserwithsufficientprivileges,2)CreateanewuserwiththeCREATEUSERcommand,3)UsetheGRANTcommandtospecifypermissionslikeSELECT,INSERT,UPDATE,orALLPRIVILEGESonspecificdatabasesortables,and4)

如何在MySQL中添加用戶:逐步指南如何在MySQL中添加用戶:逐步指南May 09, 2025 am 12:14 AM

toadduserInmysqleffect和securly,跟隨台詞:1)USEtheCreateUserStattoDaneWuser,指定thehostandastrongpassword.2)GrantNecterAryAryaryPrivilegesSustherthing privilegesgeStatement,usifementStatement,adheringtotheprinciplelastprefilegege.3)

mysql:添加具有復雜權限的新用戶mysql:添加具有復雜權限的新用戶May 09, 2025 am 12:09 AM

toaddanewuserwithcomplexpermissionsinmysql,loldtheSesteps:1)創建eTheEserWithCreateuser'newuser'newuser'@''localhost'Indedify'pa ssword';。 2)GrantreadAccesstoalltablesin'mydatabase'withGrantSelectOnMyDatabase.to'newuser'@'localhost';。 3)GrantWriteAccessto'

mysql:字符串數據類型和coltrationsmysql:字符串數據類型和coltrationsMay 09, 2025 am 12:08 AM

MySQL中的字符串數據類型包括CHAR、VARCHAR、BINARY、VARBINARY、BLOB、TEXT,排序規則(Collations)決定了字符串的比較和排序方式。 1.CHAR適合固定長度字符串,VARCHAR適合可變長度字符串。 2.BINARY和VARBINARY用於二進制數據,BLOB和TEXT用於大對像數據。 3.排序規則如utf8mb4_unicode_ci忽略大小寫,適合用戶名;utf8mb4_bin區分大小寫,適合需要精確比較的字段。

MySQL:我應該在Varchars上使用什麼長度?MySQL:我應該在Varchars上使用什麼長度?May 09, 2025 am 12:06 AM

最佳的MySQLVARCHAR列長度選擇應基於數據分析、考慮未來增長、評估性能影響及字符集需求。 1)分析數據以確定典型長度;2)預留未來擴展空間;3)注意大長度對性能的影響;4)考慮字符集對存儲的影響。通過這些步驟,可以優化數據庫的效率和擴展性。

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser是一個安全的瀏覽器環境,安全地進行線上考試。該軟體將任何電腦變成一個安全的工作站。它控制對任何實用工具的訪問,並防止學生使用未經授權的資源。

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

將Eclipse與SAP NetWeaver應用伺服器整合。

VSCode Windows 64位元 下載

VSCode Windows 64位元 下載

微軟推出的免費、功能強大的一款IDE編輯器

Atom編輯器mac版下載

Atom編輯器mac版下載

最受歡迎的的開源編輯器

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)