Import data to Oracle Spatial
Oracle Spatial does not have a comprehensive GIS product system from desktop to database to server to development kit like ArcGIS. Therefore, loading data to Oracle is much more troublesome than using ArcGIS, at the same time, there are not so many data source formats supported. Oracle itself provides the shp2sdo tool [1]
To import the shapefile to Oracle Spatial. You can use this tool in three steps:
Step 1: Use the shp2sde tool to generate scripts and data:
[Oracle @ Test2 shp2sdo_linux] $./shp2sdo.exe
Shp2sdo-shapefile (r) to Oracle spatial converter
Version 2.15 21-may-2004
Copyright 1997,2004 Oracle Corporation
For use with Oracle spatial.
Input shapefile (no extension):/home/wuyf/World/cities
Shape file/home/wuyf/World/cities. SHP contains 2539 points
Output Table [/home/wuyf/World/cities]: Cities
Output Data Model [O]:
Geometry column [Geom]:
ID column []:
Points stored in sdo_point_type? [Y]:
Use a spatial reference system ID (SRID )? [N]:
Change tolerance value from the default (0.00000005 )? [N]:
Generate data inside control files? [N]:
Target database Oracle8i? [N]:
Spatial data requires more than 6 digits precision? [N]:
Bounds: x = [-176.151564, 179.221888] Y = [-54.792000, 78.200001]
Override? [N]:
Processing shapefile/home/wuyf/World/cities into spatial table cities
Data Model is object-relational
Geometry column is Geom
Points stored in sdo_point attributes
Data is in a separate file (s)
Control file generation for Oracle9i or higher
Spatial data loaded with 6 digits of Precision
Conversion complete: 2539 points processed
The following files have been created:
Cities. SQL: SQL script to create the table
Cities. CTL: control file for loading the table
Cities. DAT: Data File
Step 2: Execute the. SQL script generated by shp2sdo in the database:
SQL> @/home/Oracle/shp2sdo_linux/cities. SQL
Step 3: use SQL * loader to load the. CTL data generated by shp2sdo:
[Oracle @ Test2 shp2sdo_linux] $ sqlldr spatial/esrichina cities. CTL
SQL * Loader: Release 11.2.0.1.0-production on Monday April 19 14:02:26 2010
Copyright (c) 1982,200 9, Oracle and/or its affiliates. All rights reserved.
Reached submission point-logical record count 64
Submission point reached-128 logic record count
Submission point reached-192 logic record count
Submission point reached-256 logic record count
Submission point reached-320 logic record count
Submission point reached-384 logic record count
Submission point reached-448 logic record count
...
After the import is successful, we can see this space table in Oracle Spatial. Geom is the geometric field set during import. We can print some data to see it:
SQL> select Geom from cities where rownum <10;
Geom (sdo_gtype, sdo_srid, sdo_point (x, y, z), sdo_elem_info, sdo_ordinates)
Bytes ------------------------------------------------------------------------------------------------------------------------
Sdo_geometry (2001, null, sdo_point_type (-66.348,-33.316002, null), null, null)
Sdo_geometry (2001, null, sdo_point_type (-57.140001,-25.387002, null), null, null)
Sdo_geometry (2001, null, sdo_point_type (-56.428002,-25.452999, null), null, null)
Sdo_geometry (2001, null, sdo_point_type (-57.150999,-25.623999, null), null, null)
Sdo_geometry (2001, null, sdo_point_type (-56.450997,-25.784001, null), null, null)
Sdo_geometry (2001, null, sdo_point_type (-58.176999,-26.182998, null), null, null)
Sdo_geometry (2001, null, sdo_point_type (-58.295997,-26.867997, null), null, null)
Sdo_geometry (2001, null, sdo_point_type (-58.986999,-27.457002, null), null, null)
Sdo_geometry (2001, null, sdo_point_type (-58.817997,-27.486999, null), null, null)
Nine rows have been selected.
There are also a lot of other third-party tools that can be used for data import, but it is sufficient to make a free estimate.
[1]
Http://www.oracle.com/technology/software/products/spatial/index.html