CCCXIAO
路人甲
路人甲
  • 注册日期2004-03-22
  • 发帖数36
  • QQ
  • 铜币274枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:2036回复:3

利用 SDE 对数据处理入库

楼主#
更多 发布于:2004-09-21 14:49
<P ><FONT size=3>转贴:</FONT></P>
<P ><FONT size=3>在<FONT face="Times New Roman">ArcSDE</FONT>中,矢量数据的加载通常使用三种方法,使用<B><FONT face="Times New Roman">ArcCatalog</FONT></B>或者<FONT face="Times New Roman">ArcToolbox</FONT>中的<FONT face="Times New Roman">shapefile(coverage</FONT>等<FONT face="Times New Roman">) to Geodatabse </FONT>、直接使用<B>命令行</B>或者使用<B>程序</B>进行入库,<FONT face="Times New Roman">shp2sde(cov2sde)</FONT>。</FONT></P>
<P ><FONT size=3>使用<B><FONT face="Times New Roman">ArcCatalog</FONT></B>更加简单一些,<B>命令行</B>优势在于可以真正意义上的实现批处理,还可以检查<FONT face="Times New Roman">SHP</FONT>出现的错误,使用<B>程序</B>进行入库则可以实现接边。使处理数据更加方便实用。</FONT></P>
<P ><B><FONT face="Times New Roman">1</FONT></B><B>、</B><FONT face="Times New Roman">ArcCatalog<B><p></p></B></FONT></P>
<P ><FONT size=3><B><FONT face="Times New Roman">ArcCatalog</FONT></B>的加载办法―――略</FONT></P>
<P ><B><FONT face="Times New Roman">2</FONT></B><B>、</B>命令行<B><p></p></B></P>
<P ><FONT size=3><B>命令行</B>使用系统的命令提示符来进行数据加载<B>,</B>在命令提示苻窗口里,输入下面的命令即可,最好使用批处理<FONT face="Times New Roman">*.BAT</FONT>文件进行数据加载。下面是一个<FONT face="Times New Roman">BAT</FONT>文件的内容。</FONT></P>
<P ><FONT size=3>例子:</FONT></P>
<P ><FONT face="Times New Roman">s<B>hp2sde  -o create ^<p></p></B></FONT></P>
<P ><B><FONT face="Times New Roman">        -l buildshd,shape ^<p></p></FONT></B></P>
<P ><B><FONT face="Times New Roman">          -f D:\job\sde</FONT></B><B>入库</B><B><FONT face="Times New Roman">\builds.shp ^<p></p></FONT></B></P>
<P ><B><FONT face="Times New Roman">          -g 600,3000,10000^<p></p></FONT></B></P>
<P ><B><FONT face="Times New Roman">          -x 416047,555677,999999 ^<p></p></FONT></B></P>
<P ><B><FONT face="Times New Roman">-e  a+n ^<p></p></FONT></B></P>
<P ><B><FONT face="Times New Roman">          -S "vegrgn" ^<p></p></FONT></B></P>
<P ><B><FONT face="Times New Roman">          -a all ^<p></p></FONT></B></P>
<P ><B><FONT face="Times New Roman">          -c 10000 ^<p></p></FONT></B></P>
<P ><B><FONT face="Times New Roman">          -i 5151:esri_sde ^<p></p></FONT></B></P>
<P ><B><FONT face="Times New Roman">          -u sde ^<p></p></FONT></B></P>
<P ><B><FONT face="Times New Roman">          -p sde ^<p></p></FONT></B></P>
<P ><B><FONT face="Times New Roman">        -s jiaodaozhen     </FONT></B></P>
<P ><FONT size=3>这是一个对数据进行加载的一个具体例子,下面对每一条我都进行详细的说明。</FONT></P>
<P ><FONT face="Times New Roman"><B><FONT size=3> </FONT></B><B>^ </B></FONT><FONT size=3>换行的标志,使用命令行方法一定要注意不能使用<FONT face="Times New Roman">Tab</FONT>,换行符使用<FONT face="Times New Roman"> ^(Windows</FONT>里面使用,<FONT face="Times New Roman">Unix</FONT>中使用<FONT face="Times New Roman">"\").</FONT></FONT></P>
<P ><B><FONT face="Times New Roman">-o create </FONT></B><FONT size=3>(参数)建立一个新层</FONT></P>
<P ><B><FONT face="Times New Roman">-l  buildshd,</FONT></B><FONT size=3>(建立层的名字)</FONT><B><FONT face="Times New Roman">shape</FONT></B><FONT size=3>(类型)</FONT><B><FONT face="Times New Roman"> </FONT></B></P>
<P ><B><FONT face="Times New Roman">-f  D:\job\sde</FONT></B><B>入库</B><B><FONT face="Times New Roman">\builds.shp  </FONT></B><FONT size=3>(路径)</FONT></P>
<P ><FONT face="Times New Roman"><B>-g 600,3000,10000^</B><FONT size=3>  </FONT></FONT><FONT size=3>索引网格大小(<FONT face="Times New Roman">Grid size</FONT>)</FONT></P>
<P ><FONT size=3>在加载数据时候,我们还需要给数据指定索引网格的大小,为了提高空间查询的性能,<FONT face="Times New Roman">ArcSDE</FONT>采用空间索引的机制。是一个覆盖整个要素类的两维索引,类似于一般的道路图上的索引网格。<FONT face="Times New Roman">ArcSDE</FONT>可以赋予三层空间索引网格,每个网格层都具有自己的格网大小。第一层网格为必需,它的格网尺寸最小;而第二和第三层可选,它们的网格可以通过设置为<FONT face="Times New Roman">0</FONT>使之无效。如果有效,第二层网格大小必须至少比第一层网格大三倍,而第三层网格大小也必须至少比第二层网格大三倍。索引格网的大小加载后也是可以随时修改的。</FONT></P>
<P ><B><FONT face="Times New Roman">-x 416047,555677,999999 ^<p></p></FONT></B></P>
<P ><FONT size=3>这三个参数可以从<FONT face="Times New Roman">ArcCatalog</FONT>中获得,第一个参数<FONT face="Times New Roman"> </FONT>最小值,第二个参数是<FONT face="Times New Roman">Y </FONT>最小值。第三个参数是精度<FONT face="Times New Roman">(Precision)</FONT>。</FONT></P>
<P ><B><FONT face="Times New Roman">-e  a+n  </FONT></B><FONT size=3>(输入<FONT face="Times New Roman">shp</FONT>的类型)<B><p></p></B></FONT></P>
<P ><FONT face="Times New Roman"><B>  </B><FONT size=3>a+n ^ </FONT></FONT><FONT size=3>面<FONT face="Times New Roman"> s+n ^ </FONT>线<FONT face="Times New Roman">  p+n ^ </FONT>点</FONT></P>
<P ><B><FONT face="Times New Roman">-S "vegrgn" </FONT></B></P>
<P ><FONT size=3><FONT face="Times New Roman">   </FONT>备注</FONT></P>
<P ><B><FONT face="Times New Roman">-a all ^</FONT></B></P>
<P ><FONT size=3><FONT face="Times New Roman">   </FONT>所有的地物都要载入</FONT></P>
<P ><B><FONT face="Times New Roman">-c 10000 ^<p></p></FONT></B></P>
<P ><FONT size=3>转换速率</FONT></P>
<P ><B><FONT face="Times New Roman">-i 5151:esri_sde ^<p></p></FONT></B></P>
<P ><FONT size=3><FONT face="Times New Roman">SDE </FONT>的服务名和端口名,一般都没有做改动。</FONT></P>
<P ><FONT face="Times New Roman"><FONT size=3> </FONT><B>-u sde ^<p></p></B></FONT></P>
<P ><FONT face="Times New Roman"><B>  </B><FONT size=3> </FONT></FONT><FONT size=3>用户名</FONT></P>
<P ><B><FONT face="Times New Roman"> -p sde ^<p></p></FONT></B></P>
<P ><FONT size=3>密码</FONT></P>
<P ><B><FONT face="Times New Roman">   -s jiaodaozhen    <p></p></FONT></B></P>
<P ><FONT size=3>服务器<FONT face="Times New Roman"> </FONT>(主机名)</FONT></P>
<P ><p><FONT face="Times New Roman" size=3> </FONT></p></P>
<P ><FONT size=3><FONT face="Times New Roman">  </FONT>下面是一个追加的例子,对已经加载的数据进行追加数据。</FONT></P>
<P ><FONT size=3>导入追加:</FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">shp2sde -o append -l agency,shape -f D:\job\sde</FONT>入库<FONT face="Times New Roman">\temp\py\agency.shp -a all -c 10000 -i 5151:esri_sde -u sde -p sde -s jiaodaozhen     </FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">-O append </FONT>追加<FONT face="Times New Roman"> </FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">-L </FONT>要追加到<FONT face="Times New Roman">SDE</FONT>文件名字</FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">-F </FONT>文件目录</FONT></P>
<P ><FONT size=3>其他的参数和上面的都相同,但是要注意少了几个参数。</FONT></P>
<P ><p><FONT face="Times New Roman" size=3> </FONT></p></P>
<P ><FONT size=3>注意:如果导入的时候数据出现的错误较多,可以使用如下命令来储存错误信息。</FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">    C:\>d\resrgn.bat  > 1.txt</FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">C:\>d\resrgn.bat: </FONT>批处理的路径和名字。</FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">> 1.txt </FONT>在<FONT face="Times New Roman">C </FONT>盘根目录下的<FONT face="Times New Roman"> 1.TXT </FONT>文本文件将记录其内容。</FONT></P>
<P ><B><FONT face="Times New Roman">3</FONT></B><B>、程序</B><B><FONT face="Times New Roman"> <p></p></FONT></B></P>
<P ><B><FONT face="Times New Roman">  </FONT></B><FONT size=3>使用程序导入数据需要准备:数据、坐标格网、分层标准、数据结构。</FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">   </FONT>数据为<FONT face="Times New Roman">shape</FONT>格式。</FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">   </FONT>坐标格网是整个入库的一个基本的格网(也是每幅数据的内图廓集),数据都是要依据其进行导入,不可以出现错误,否则数据不可以导入。例如在―<B><FONT face="Times New Roman">ArcCatalog</FONT></B>――――</FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">   </FONT>数据通过<FONT face="Times New Roman">SDE</FONT>在数据库中存储的方式是<FONT face="Times New Roman"> </FONT><B>要素集、要素类、表</B>、</FONT></P>
<P ><FONT size=3>一个<B>要素集</B>代表同一个坐标系统的<B>要素类</B>的一个集合,<FONT face="Times New Roman"> </FONT></FONT></P>
<P ><FONT size=3>一个<B>要素类</B>也就是存在<B>要素集</B>下面的一个表。<B><p></p></B></FONT></P>
<P ><FONT size=3><B>表</B>也可以在数据库中单独存在,可以单独建立一个表,和通过<B>命令行</B>的形式一样。如:――――</FONT></P>
<P ><FONT size=3>下面是建立<B>要素集、要素类</B>的方法。</FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">1</FONT>)<B>要素集</B>一定要设<FONT face="Times New Roman"> </FONT>“<FONT face="Times New Roman">X/Y</FONT>的域”可以从坐标格网得到范围。</FONT></P>
<P ><FONT size=3>命名方式:<FONT face="Times New Roman">ds10000classBOU</FONT></FONT></P>
<P ><p><FONT face="Times New Roman" size=3> </FONT></p></P>
<P ><FONT size=3><FONT face="Times New Roman">2</FONT>)<B>要素类</B><B><FONT face="Times New Roman"> </FONT></B>命名方式:<FONT face="Times New Roman">boulin_jn10000 </FONT>后缀和在数据库中设立的后缀名字一定要一样。</FONT></P>
<P ><FONT size=3>在字段名称为“<FONT face="Times New Roman">shape</FONT>”<FONT face="Times New Roman"> </FONT>数据类型为<FONT face="Times New Roman"> </FONT>“几何类型”<FONT face="Times New Roman"> </FONT>改为<B>要素类</B>本身的类型。如果数据类型为双精度的时候,例如<FONT face="Times New Roman"> </FONT></FONT></P>
<TABLE  cellSpacing=0 cellPadding=0 border=1>

<TR >
<TD  width=127>
<P  align=center>高程<p></p></P></TD>
<TD  width=93>
<P  align=center><FONT face="Times New Roman">ELEV<p></p></FONT></P></TD>
<TD  width=93>
<P  align=center><FONT face="Times New Roman">F<p></p></FONT></P></TD>
<TD  width=93>
<P  align=center><FONT face="Times New Roman">8.3<p></p></FONT></P></TD>
<TD  width=93>
<P  align=center><p><FONT face="Times New Roman"> </FONT></p></P></TD></TR></TABLE>
<P ><FONT size=3><FONT face="Times New Roman">8.3</FONT>代表的意思是小数点前面是<FONT face="Times New Roman">8</FONT>后面是<FONT face="Times New Roman">3</FONT>。</FONT></P>
<P ><FONT size=3>这样则精度为<FONT face="Times New Roman"> 12</FONT>(<FONT face="Times New Roman">8</FONT>+<FONT face="Times New Roman">3</FONT>+<FONT face="Times New Roman">1</FONT>=<FONT face="Times New Roman">12</FONT>)<FONT face="Times New Roman"> </FONT>比例为<FONT face="Times New Roman"> 3</FONT></FONT></P>
<P ><FONT size=3>如―――――</FONT></P>
<P ><FONT size=3>按照建立<B>要素集、要素类</B>的方法。使用坐标格网建立一个索引层</FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">3</FONT>)在程序中建立关联并设立索引层</FONT></P>
喜欢0 评分0
agua
路人甲
路人甲
  • 注册日期2003-07-29
  • 发帖数109
  • QQ
  • 铜币344枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2004-09-22 16:29
<img src="images/post/smile/dvbbs/em01.gif" />
举报 回复(0) 喜欢(0)     评分
croquette
路人甲
路人甲
  • 注册日期2003-09-17
  • 发帖数145
  • QQ
  • 铜币15枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2004-09-22 10:37
<img src="images/post/smile/dvbbs/em01.gif" />
举报 回复(0) 喜欢(0)     评分
gzstyxb
路人甲
路人甲
  • 注册日期2004-09-22
  • 发帖数358
  • QQ
  • 铜币1045枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2004-09-22 09:38
<img src="images/post/smile/dvbbs/em01.gif" />
由爱故生忧, 由爱故生怖. 若离于爱者, 无忧亦无怖.
举报 回复(0) 喜欢(0)     评分
游客

返回顶部