zoukankan      html  css  js  c++  java
  • 使用Arcgis时,在sde空间库常用的相关函数

    一.Oracle库中配置好sde空间库常见的场景

    1.在sde库中创建表:community

    创建表:community
    字段:id(INTEGER), shape(ST_GEOMETRY)

    2.往sde库中添加资源类型:

      1.1点资源:

    1 方式一:
    2 insert into 表名(id,shape) values(1,sde.st_point(108.88,34.18,#srid值#));
    3 //例如:insert into community(id,shape) values(1,sde.st_point(108.88,34.18,2));
    4 方式二: insert into 表名(id,shape) values(2,sde.st_geometry('point(108.88 34.19)',#srid值#));
    5 //例如:insert into community(id,shape) values(2,sde.st_geometry('point(108.88 34.19)',2));

      注意点:1.方式一,其中st_point()函数为点资源函数,参数为坐标及坐标系(即:srid值);2.方式二,st_geometry()函数传入点坐标及坐标系;

      1.2线资源:

    1 insert into 表名(id,shape) values(1,sde.ST_LineString('linestring(108.88 34.19,108.98 34.29)',#srid值#));
    2 //例如:insert into community (id,shape) values(1,sde.ST_LineString('linestring(108.88 34.19,108.98 34.29)',2));

      注意点:1.线资源使用ST_LineString()函数,传入多个点(至少两个不同点)及坐标系;2.线资源的点使用linestring()处理;

      1.3面资源:

    1 insert into 表名(id,shape) values(1,sde.st_geometry ('polygon (108.88 34.19,108.98 34.29,108.88 34.19)',#srid值#));
    2 //例如:insert into community(id,shape) values(1,sde.st_geometry ('polygon (108.88 34.19,108.98 34.29,108.88 34.19)',2));

      注意点:1.面资源使用st_geometry()函数,传入多个点(至少三个不同点,必须按照一定的方向首位相接,连起来不能相交)和坐标系;2.面资源的点使用polygon()处理;

    4.sde库中表srid值的查看:

    SELECT SRID FROM SDE.ST_GEOMETRY_COLUMNS WHERE TABLE_NAME = '#表名#';
    

      注意点:ST_GEOMETRY_COLUMNS 为sde库的一张表,将sde库中的其他表的信息及srid进行保存

    5.修改sde库表的srid值

    1 update #表名#  set shape = st_geomfromtext(ST_AsText(shape),#新的srid值#);
    2 //例如:update community set shape = st_geomfromtext(ST_AsText(shape),2);

        注意点:shape:该表中st_geometry类型的字段,使用st_geomfromtext()函数将文本类型的点进行转换;

    5.sde库中判断点资源是否在一个面资源内:(SDE.ST_INTERSECTS()函数)

    1 SELECT SDE.ST_INTERSECTS(R.SHAPE,SDE.ST_POINT(108.88, 34.19,#srid值#))FROM community R where id= '#id#'
    2 //例如:SELECT SDE.ST_INTERSECTS(R.SHAPE,SDE.ST_POINT(108.88, 34.19,2))FROM community R where id= '1'

      注意点:ST_INTERSECTS()函数返回结果为1:表示该点(108.88, 34.19)在面(shape)内;结果为0:表示该点不再面内;

    6.查看字段shape中的点信息:

      1.查看shape面中的任意一点:

    SELECT id,sde.st_astext (sde.st_pointonsurface (shape)) as Surface_Points FROM sde.表名 g where id='1';
    

      注意点:st_pointonsurface()函数从shape字段中获取点,在通过st_astext()转为文本类型clob类型,点击clob可查看具体的点信息,文本内容:point(108.88 34.19);

      2.查看shape面中的点资源,线资源,面资源的点:

    SELECT id,sde.st_astext(shape) POINTS FROM sde.表名 WHERE id= '1'
    

      注意点:点击clob类型的POINTS字段值,如下:

          如果是点,则显示:point(108.88 34.19);

          如果是线,则显示:linestring(108.88 34.19,108.98 34.29);

          如果是面,则显示:polygon (108.88 34.19,108.98 34.29,108.88 34.19)

     二.总结

    优势:

      sde库中的字段简单,一个shape字段,包含的信息量多;

    缺点:

      对shape字段处理,需掌握大量的函数;

  • 相关阅读:
    第一个SWT程序
    稀疏数组
    算法与数据结构
    《Java核心技术》学习笔记 第1-3章
    算术运算符
    5.11 rw zip file
    5.10 gob序列化
    5.9 piping between writer and reader
    5.7 io.MultiWriter(buf, f)
    5.7 读写 二进制数据
  • 原文地址:https://www.cnblogs.com/talenter/p/9571405.html
Copyright © 2011-2022 走看看