[1]利用shp2sdo把shp格式的数据转换成oracle能够识别的数据格式,利用下面的工具
shp2sdo -o c:\tmp\beijing\beijing_polyline c:\oracle_sql\beijng_polyline -s 4326
c:\tmp\beijing\beijing_polyline 是你的shp文件
c:\oracle_sql\beijng_polyline 是你要生成的目标文件
命令成功执行后,会生成三个文件
c:\oracle_sql\beijng_polyline.sql
c:\oracle_sql\beijng_polyline.dat
c:\oracle_sql\beijng_polyline.ctl
[2]修改文件
原始的beijng_polyline.ctl文件是
LOAD DATA CHARACTERSET UTF8
INFILE c:\oracle_sql\beijng_polyline.dat
TRUNCATE
CONTINUEIF NEXT(1:1) = '#'
INTO TABLE BEIJNG_POLYLINE
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS (
MAPID NULLIF MAPID = BLANKS,
ID NULLIF ID = BLANKS,
KIND NULLIF KIND = BLANKS,
GEOM COLUMN OBJECT
(
SDO_GTYPE INTEGER EXTERNAL,
SDO_SRID INTEGER EXTERNAL,
SDO_ELEM_INFO VARRAY TERMINATED BY '|/'
(X FLOAT EXTERNAL),
SDO_ORDINATES VARRAY TERMINATED BY '|/'
(X FLOAT EXTERNAL)
)
)
我修改后的文件是
LOAD DATA
CHARACTERSET UTF8(这个地方是设置编码)
INFILE
beijng_polyline.dat(这个地方很重要,一定要把路径去掉,否则的话总是有错误) TRUNCATE
CONTINUEIF NEXT(1:1) = '#'
INTO TABLE BEIJNG_POLYLINE
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS (
MAPID NULLIF MAPID = BLANKS,
ID NULLIF ID = BLANKS,
KIND NULLIF KIND = BLANKS,
GEOM COLUMN OBJECT
(
SDO_GTYPE INTEGER EXTERNAL,
SDO_SRID INTEGER EXTERNAL,
SDO_ELEM_INFO VARRAY TERMINATED BY '|/'
(X FLOAT EXTERNAL),
SDO_ORDINATES VARRAY TERMINATED BY '|/'
(X FLOAT EXTERNAL)
)
)
[3]执行导入
在命令行下,改变目录到数据所在的目录,如
c:\oracle_sql\
然后执行
sqlldr zy/password@orcl beijing_polyline
就可以了,如果成功,就会出现如图所示的结果
|----------------------------------------------------------------------------------------|
版权声明 版权所有 @zhyiwww
引用请注明来源 http://www.blogjava.net/zhyiwww
|----------------------------------------------------------------------------------------|
posted on 2008-11-12 14:06
zhyiwww 阅读(1649)
评论(0) 编辑 收藏 所属分类:
database 、
gis