-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Apress
committed
Oct 11, 2016
0 parents
commit f0c18ec
Showing
483 changed files
with
22,593 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-- Listing A-1. Tiling a Two-Dimensional Space | ||
SELECT * FROM TABLE | ||
(SDO_SAM.TILED_BINS(-77.1027, -76.943996, 38.820813, 38.95911,1, 8307)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-- Listing A-2. Tiling a Two-Dimensional Space by Specifying the Number of Divisions Along x- and y-axes | ||
SELECT * FROM TABLE | ||
(SDO_SAM.TILED_BINS(-77.1027, -76.943996, 38.820813, 38.95911, NULL, 8307, 2, 3 )); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- Listing A-3. ZIP Code Table Used to Get Demographic Information | ||
desc zip5_dc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- Listing A-4. Searching for Regions (Tiles) That Have a Population Greater Than 30,000 | ||
SELECT REGION_ID, AGGREGATE_VALUE, GEOMETRY FROM TABLE | ||
( | ||
SDO_SAM.TILED_AGGREGATES | ||
('ZIP5_DC', 'GEOM','SUM', 'POPULATION', 2) | ||
) a | ||
WHERE a.aggregate_value > 30000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-- Listing A-5. Estimating the Population in Sales Region 1 Using the Demographic Information in the zip5_dc Table | ||
SELECT SDO_SAM.AGGREGATES_FOR_GEOMETRY | ||
('ZIP5_DC', 'GEOM', 'SUM', 'POPULATION', a.geom) population | ||
FROM sales_regions a WHERE a.id=1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-- Listing A-6. Estimating the Population for All Rows in the sales_regions Table Using Demographic | ||
Information in the zip5_dc Table | ||
SELECT s.id, aggregate_value population FROM TABLE | ||
( | ||
SDO_SAM.AGGREGATES_FOR_LAYER | ||
('ZIP5_DC', 'GEOM','SUM', 'POPULATION', 'SALES_REGIONS', 'GEOM') | ||
) a, sales_regions s | ||
WHERE s.rowid = a.region_id; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-- Listing A-7. Finding Three Clusters for Customer Locations | ||
SELECT ID, GEOMETRY FROM TABLE | ||
(SDO_SAM.SPATIAL_CLUSTERS('CUSTOMERS', 'LOCATION', 3)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- Listing A-8. Simplifying the Geometry for New Hampshire | ||
SELECT sdo_util.getnumvertices(geom) orig_num_vertices, | ||
sdo_util.getnumvertices(sdo_sam.simplify_geometry(geom, 0.5)) new_num_vertices | ||
FROM states | ||
WHERE state_abrv='NH'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
EXECUTE SDO_TOPO.CREATE_TOPOLOGY('CITY_DATA', 0.00000005, NULL); | ||
|
||
CREATE TABLE land_parcels | ||
( | ||
parcel_name VARCHAR2(30) PRIMARY KEY, | ||
feature SDO_TOPO_GEOMETRY | ||
); | ||
|
||
CREATE TABLE streets | ||
( | ||
street_name VARCHAR2(30) PRIMARY KEY, | ||
feature SDO_TOPO_GEOMETRY | ||
); | ||
|
||
BEGIN | ||
-- Add the feature layer for the street network | ||
SDO_TOPO.ADD_TOPO_GEOMETRY_LAYER ( | ||
'CITY_DATA', -- name of the topology | ||
'STREETS', 'FEATURE', 'POLYGON' -- names of the feature table, column, and type | ||
); | ||
END; | ||
/ | ||
|
||
DESCRIBE sdo_topo_geometry; | ||
|
||
EXECUTE SDO_TOPO.INITIALIZE_METADATA('CITY_DATA'); | ||
|
||
INSERT INTO land_parcels (parcel_name, feature) VALUES | ||
( | ||
'P1', | ||
SDO_TOPO_GEOMETRY -- construct using topology elements(no explicit geometry) | ||
( | ||
'CITY_DATA', -- topology_name | ||
3, -- topo_geometry_type for polygon (or multipolygon) | ||
1, -- feature layer (TG_LAYER) ID representing 'Land Parcels', | ||
SDO_TOPO_OBJECT_ARRAY -- Array of 2 topo objects (two faces) | ||
( | ||
SDO_TOPO_OBJECT -- Constructor for the object | ||
( | ||
3, -- element ID (i.e., FACE_ID) from the associated topology | ||
3 -- element TYPE is 3 (i.e., a FACE) | ||
), | ||
SDO_TOPO_OBJECT -- Constructor for topo object | ||
( | ||
6, -- element ID (i.e., FACE_ID) from the associated topology | ||
3 -- element type is 3 (i.e., a FACE) | ||
) | ||
) | ||
) | ||
); | ||
|
||
EXEC SDO_TOPO_MAP.CREATE_TOPO_MAP('CITY_DATA', 'Manhattan Topology'); | ||
|
||
EXEC SDO_TOPO_MAP.LOAD_TOPO_MAP( | ||
'Manhattan Topology', | ||
min_long, min_lat, max_long, max_lat | ||
); | ||
|
||
INSERT INTO STREETS (street_name, feature) | ||
'Fifth Street, Segment11', | ||
SDO_TOPO_MAP.CREATE_FEATURE( | ||
'Manhattan Topology', | ||
'ROAD_NETWORK', -- Table where the feature is stored, | ||
'FEATURE', -- Column in the table storing the feature | ||
-- Next, specify the geometry for the Fifth street, segment 11 | ||
-- as line from x1,y1 to x2,y2 | ||
SDO_GEOMETRY( | ||
2002, 8307, NULL, | ||
SDO_ELEMENT_INFO_ARRAY(1,2,1), | ||
SDO_ORDINATE_ARRAY(x1,y,1, x2,y,2) | ||
) | ||
); | ||
|
||
EXEC SDO_TOPO_MAP.ADD_EDGE('Manhattan Topology', 1, 2, gm); | ||
|
||
EXEC SDO_TOPO_MAP.VALIDATE('Manhattan Topology'); | ||
|
||
EXEC SDO_TOPO_MAP.COMMIT_TOPO_MAP('Manhattan Topology'); | ||
|
||
EXEC SDO_TOPO_MAP.ROLLBACK_TOPO_MAP('Manhattan Topology'); | ||
|
||
EXEC SDO_TOPO_MAP.DROP_TOPO_MAP('Manhattan Topology'); | ||
|
||
SELECT a.parcel_name FROM land_parcels a, rivers b | ||
WHERE SDO_ANYINTERACT (a.feature, b.feature) = 'TRUE'; | ||
|
||
SELECT a.parcel_name FROM land_parcels a | ||
WHERE SDO_ANYINTERACT ( | ||
a.feature, | ||
SDO_GEOMETRY | ||
( | ||
2003,NULL, NULL, | ||
SDO_ELEM_INFO_ARRAY(1,1003,3) | ||
SDO_ORDINATE_ARRAY(14,20,15,22) | ||
) | ||
) = 'TRUE'; | ||
|
||
SELECT topology_id, tg_layer_id FROM USER_SDO_TOPO_METADATA | ||
WHERE topology = 'CITY_DATA' | ||
AND table_name='LAND_PARCELS' | ||
AND column_name='FEATURE'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- Listing D-1. Altering the branches Table to Add the georaster Column | ||
ALTER TABLE branches ADD ( georaster SDO_GEORASTER); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- Listing D-2. Structure of SDO_GEORASTER | ||
DESC SDO_GEORASTER; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
-- Listing D-3. Creating the Raster Data Table | ||
CREATE TABLE branches_rdt OF SDO_RASTER | ||
( | ||
PRIMARY KEY | ||
( | ||
RASTERID, PYRAMIDLEVEL, BANDBLOCKNUMBER, | ||
ROWBLOCKNUMBER, COLUMNBLOCKNUMBER | ||
) | ||
) | ||
LOB(RASTERBLOCK) STORE AS (NOCACHE NOLOGGING); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-- Listing D-4. Creating a Trigger to Populate the Raster Data Table | ||
-- Not needed in 11g. | ||
call SDO_GEOR_UTL.createDMLTrigger('BRANCHES','GEORASTER'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
-- Listing D-15. Generating and Populating the Spatial Extent of the georaster Column | ||
DECLARE | ||
extent SDO_GEOMETRY; | ||
BEGIN | ||
SELECT SDO_GEOR.GENERATESPATIALEXTENT(a.georaster) INTO extent | ||
FROM branches b WHERE b.id=1 FOR UPDATE; | ||
UPDATE branches b SET b.georaster.spatialextent = extent WHERE b.id=1; | ||
COMMIT; | ||
END; | ||
/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
-- Listing D-16. Populating the Metadata for the Spatial Extent of the georaster Column | ||
INSERT INTO USER_SDO_GEOM_METADATA VALUES ( | ||
'branches', | ||
'georaster.spatialextent', | ||
SDO_DIM_ARRAY ( | ||
SDO_DIM_ELEMENT('X', -180, 180, 0.5), | ||
SDO_DIM_ELEMENT('Y', -90, 90, 5) | ||
), | ||
8307 -- SRID | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-- Listing D-17. Creating an Index on the Spatial Extent of the georaster Column | ||
CREATE INDEX geor_idx ON branches(georaster.spatialextent) | ||
INDEXTYPE IS MDSYS.SPATIAL_INDEX; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- Listing D-18. Creating a Predefined Theme for the georaster Column in the branches Table | ||
INSERT INTO user_sdo_themes VALUES | ||
( | ||
'BRANCHES_Images', -- Theme name | ||
'Tiff Image', -- Description | ||
'BRANCHES', -- Base table name | ||
'GEORASTER', -- Column name storing georaster object in table | ||
'<?xml version="1.0" standalone="yes"?> | ||
<styling_rules theme_type="georaster" raster_table="BRANCHES_RDT" | ||
raster_id="1" > | ||
</styling_rules>' -- Theme style definition | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
-- Listing D-19. Creating a Dynamic Theme for GeoRaster Objects | ||
<theme name="georaster_theme" > | ||
<jdbc_georaster_query | ||
georaster_table="branches" | ||
georaster_column="georaster" | ||
jdbc_srid="8307" | ||
datasource="mvdemo" | ||
asis="false"> SELECT georaster FROM branches WHERE id =1 | ||
</jdbc_georaster_query> | ||
</theme> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- Listing E-1. Adding an SDO_PC Column to Store Point Cloud Data | ||
CREATE TABLE pc_tab (pc SDO_PC); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- Listing E-2. Creating pc_blktab As the Block Table for the Point Cloud Data | ||
CREATE TABLE pc_blktab AS SELECT * FROM MDSYS.SDO_PC_BLK_TABLE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- Listing E-3. Structure of the Table Storing Input Set of Points | ||
DESC INPTAB; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-- Listing E-4. Result Table for Three-Dimensional Point Data | ||
CREATE TABLE restab (ptn_id NUMBER, point_id NUMBER, | ||
rid VARCHAR2(24), val_d1 NUMBER, val_d2 NUMBER, val_d3 NUMBER); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
-- Listing E-5. Initializing, Inserting, and Populating a Point Cloud with an Input Set of Points | ||
-- Initialize a PointCloud object and populate it using the points in INPTAB. | ||
DECLARE | ||
pc sdo_pc; | ||
BEGIN | ||
-- Initialize the point cloud object. | ||
pc := SDO_PC_PKG.INIT( | ||
'PC_TAB', -- Table that has the SDO_POINT_CLOUD column defined | ||
'PC', -- Column name of the SDO_POINT_CLOUD object | ||
'PC_BLKTAB', -- Table to store blocks of the point cloud | ||
'blk_capacity=50', -- max # of points per block | ||
SDO_GEOMETRY(2003, 8307, NULL, | ||
-- Extent: 2 in 2003 in preceding line indicates that | ||
-- ptn_dimensionality is 2. This means only the first 2 dimensions are | ||
-- used in partitioning the input point set. The index on the block table | ||
-- will also have a dimensionality of 2 in this case. | ||
-- | ||
SDO_ELEM_INFO_ARRAY(1,1003,3), | ||
SDO_ORDINATE_ARRAY(-180, -90, 180, 90) | ||
), | ||
0.5, -- Tolerance for point cloud | ||
3, -- Total number of dimensions is 3; the third dimension is stored | ||
-- but not used for partitioning | ||
NULL -- This parameter is for enabling compression but always set to | ||
-- NULL in Oracle 11gR1; | ||
); | ||
-- Insert the point cloud object into the "base" table. | ||
INSERT INTO pctab (pc) VALUES (pc); | ||
-- Create the blocks for the point cloud. | ||
SDO_PC_PKG.CREATE_PC( | ||
pc, -- Initialized PointCloud object | ||
'INPTAB' -- Name of input table to ingest into the point cloud | ||
'RESTAB' -- Name of output table that stores the points | ||
-- (with addl. Columns ptn_id,pt_id) ); | ||
END; | ||
/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- Listing E-6. Number of Points in INPTAB | ||
SELECT count(*) FROM INPTAB; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- Listing E-7. Verifying Number of Points in the Point Cloud (Associated Block Table) | ||
SELECT sum(num_points) FROM pc_blktab; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- Listing E-8. Querying a Point Cloud Object | ||
CREATE TABLE qryres AS SELECT * FROM MDSYS.SDO_PC_BLK_TABLE; | ||
-- Query | ||
DECLARE | ||
inp sdo_pc; | ||
BEGIN | ||
SELECT pc INTO inp FROM pc_tab WHERE rownum=1; | ||
INSERT INTO qryres | ||
SELECT * FROM | ||
TABLE(SDO_PC_PKG.CLIP_PC | ||
( | ||
inp, -- Input point cloud object | ||
SDO_GEOMETRY(2003, 8307, NULL, | ||
SDO_ELEM_INFO_ARRAY(1, 1003, 3), | ||
SDO_ORDINATE_ARRAY(-74.1, -73.9, 39.99999,40.00001) | ||
), -- QUERY | ||
NULL, NULL, NULL, NULL)); | ||
END; | ||
/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- Listing E-9. Get the Points in Each Block As aMultipoint Collection SDO_GEOMETRY | ||
SELECT blk_id, SDO_PC_PKG.TO_GEOMETRY( | ||
r.points, -- LOB containing the points | ||
r.num_points, -- # of points in the LOB | ||
3, -- Total dimensionality of the points in the LOB | ||
8307 -- SRID | ||
) FROM qryres r; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- Listing E-10. Selecting the Point IDs in Each Block As an Array of <ptn_id, point_id> Pairs | ||
SELECT SDO_PC_PKG.GET_PT_IDS( | ||
r.points, -- LOB containing the points | ||
r.num_points, -- # of points in the LOB | ||
3 -- Total dimensionality of the points in the LOB | ||
) FROM resqry r WHERE num_points >0; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- Listing E-11. Adding an SDO_TIN Column to Store TIN Data | ||
CREATE TABLE tin_tab (tin SDO_TIN); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- Listing E-12. Creating tin_blktab As the Block Table for the TIN Data | ||
CREATE TABLE tin_blktab AS SELECT * FROM MDSYS.SDO_TIN_BLK_TABLE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- Listing E-13. Structure of the Table Storing Input Set of Points | ||
DESC INPTAB; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-- Listing E-14. Result Table for Three-Dimensional Point Data | ||
CREATE TABLE restab (ptn_id NUMBER, point_id NUMBER, | ||
rid VARCHAR2(24), val_d1 NUMBER, val_d2 NUMBER, val_d3 NUMBER); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
-- Listing E-15. Initializing, Inserting, and Populating a TIN with an Input Set of Points | ||
-- Initialize a PointCloud object and populate it using the points in INPTAB. | ||
DECLARE | ||
tin SDO_TIN; | ||
BEGIN | ||
-- Initialize the TIN object. | ||
tin := SDO_TIN_PKG.INIT( | ||
'TIN_TAB', -- Table that has the SDO_TIN column defined | ||
'TIN', -- Column name of the SDO_TIN object | ||
'TIN_BLKTAB', -- Table to store blocks of the TIN | ||
'blk_capacity=6000', -- max # of points per block | ||
SDO_GEOMETRY(2003, 8307, NULL, -- Extent: 2 in 2003 indicates that | ||
-- ptn_dimensionality is 2. This means only the first 2 dimensions are | ||
-- used in partitioning the input point set. The index on the block table | ||
-- will also have a dimensionality of 2 in this case. | ||
-- | ||
SDO_ELEM_INFO_ARRAY(1,1003,3), | ||
SDO_ORDINATE_ARRAY(-180, -90, 180, 90) | ||
), | ||
0.00000005, -- Tolerance for TIN | ||
3, -- Total number of dimensions is 3; the third dimension is stored | ||
-- but not used for partitioning | ||
NULL -- This parameter is for enabling compression but always set to | ||
-- NULL in Oracle 11gR1; | ||
); | ||
-- Insert the TIN object into the "base" table. | ||
INSERT INTO tin_tab (tin) VALUES (tin); | ||
-- Create the blocks for the TIN. | ||
SDO_TIN_PKG.CREATE_TIN( | ||
tin, -- Initialized TIN object | ||
'INPTAB' -- Name of input table to ingest into the point cloud | ||
'RESTAB' -- Name of output table that stores the points | ||
-- (with addl. Columns ptn_id,pt_id) ); | ||
END; | ||
/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- Listing E-16. Number of Points in INPTAB | ||
SELECT count(*) FROM INPTAB; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- Listing E-17. Number of Points in each Block of the Block Table | ||
SELECT blk_id, num_points FROM tin_blktab; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
-- Listing E-18. Querying a TIN Object | ||
CREATE TABLE qryres AS SELECT * FROM MDSYS.SDO_TIN_BLK_TABLE; | ||
-- Query | ||
DECLARE | ||
inp SDO_TIN; | ||
BEGIN | ||
SELECT pc INTO inp FROM tin_tab WHERE rownum=1; | ||
INSERT INTO qryres | ||
SELECT * FROM | ||
TABLE(SDO_TIN_PKG.CLIP_TIN | ||
( | ||
inp, -- Input TIN object | ||
SDO_GEOMETRY(2003, 8307, NULL, | ||
SDO_ELEM_INFO_ARRAY(1, 1003, 3), | ||
SDO_ORDINATE_ARRAY(-74.1, -73.9, 39.99999,40.00001) | ||
), -- QUERY | ||
NULL, NULL)); | ||
END; | ||
/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- Listing E-19. Get the Triangles in Each Block As a Collection SDO_GEOMETRY | ||
SELECT blk_id, SDO_TIN_PKG.TO_GEOMETRY( | ||
r.points, -- LOB containing the points | ||
r.triangles, -- LOB containing the triangles | ||
r.num_points, -- # of points in the LOB | ||
r.num_triangles, -- # of triangles in the LOB | ||
2, -- Index dimensionality: dim value in SDO_GTYPE | ||
-- of extent in SDO_TIN_PKG.INIT | ||
3, -- Total dimensionality of the points in the LOB | ||
8307 -- SRID | ||
) FROM qryres r; |
Oops, something went wrong.