Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Apress committed Oct 6, 2016
0 parents commit 10fda59
Show file tree
Hide file tree
Showing 380 changed files with 11,850 additions and 0 deletions.
Binary file added 1911.pdf
Binary file not shown.
25 changes: 25 additions & 0 deletions 1930.html
@@ -0,0 +1,25 @@
PART 1 – Overview<br />
Chapter 1 – Spatial Information Management<br />
Chapter 2 – Overview of Oracle Spatial<br />
Chapter 3 – Location-Enabling Your Applications<br />
<br />
PART 2 – Basic Spatial<br />
Chapter 4 – The SDO_GEOMETRY Data Type<br />
Chapter 5 – Loading, Transporting, and Validating Spatial Data<br />
Chapter 6 – Geocoding<br />
Chapter 7 – Manipulating SDO_GEOMETRY in Application Programs<br />
<br />
PART 3 – Analysis and Visualization<br />
Chapter 8 – Spatial Indexes and Operators<br />
Chapter 9 – Geometry Processing Functions<br />
Chapter 10 – Network Modeling<br />
Chapter 11 – Generating Maps Using MapViewer<br />
Chapter 12 – A Sample Application<br />
<br />
PART 4 – Advanced Spatial<br />
Chapter 13 – Case Studies<br />
Chapter 14 – Tips, Common Mistakes, and Common Errors<br />
Appendix A – Additional Spatial Analysis Functions<br />
Appendix B – Linear Referencing<br />
Appendix C – Topology Data Model in Oracle<br />
Appendix D – Storing Raster Data in Oracle
1 change: 1 addition & 0 deletions 2443.html

Large diffs are not rendered by default.

Binary file added 9781590593837.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions LICENSE.txt
@@ -0,0 +1,27 @@
Freeware License, some rights reserved

Copyright (c) 2004 Ravikanth Kothuri, Euro Beinat, and Albert Godfrind

Permission is hereby granted, free of charge, to anyone obtaining a copy
of this software and associated documentation files (the "Software"),
to work with the Software within the limits of freeware distribution and fair use.
This includes the rights to use, copy, and modify the Software for personal use.
Users are also allowed and encouraged to submit corrections and modifications
to the Software for the benefit of other users.

It is not allowed to reuse, modify, or redistribute the Software for
commercial use in any way, or for a user�s educational materials such as books
or blog articles without prior permission from the copyright holder.

The above copyright notice and this permission notice need to be included
in all copies or substantial portions of the software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS OR APRESS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


3 changes: 3 additions & 0 deletions ProOracleSpatialCode/Code/Appendix-A/listing-A-01.sql
@@ -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));
2 changes: 2 additions & 0 deletions ProOracleSpatialCode/Code/Appendix-A/listing-A-02.sql
@@ -0,0 +1,2 @@
-- Listing A-2. Zip Code Table Used to Get Demographic Information
desc zip5_dc;
8 changes: 8 additions & 0 deletions ProOracleSpatialCode/Code/Appendix-A/listing-A-03.sql
@@ -0,0 +1,8 @@
-- Listing A-3. 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)
)
WHERE aggregate_value > 30000;
4 changes: 4 additions & 0 deletions ProOracleSpatialCode/Code/Appendix-A/listing-A-04.sql
@@ -0,0 +1,4 @@
-- Listing A-4. 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', geom) population
FROM sales_regions
WHERE id=1;
9 changes: 9 additions & 0 deletions ProOracleSpatialCode/Code/Appendix-A/listing-A-05.sql
@@ -0,0 +1,9 @@
-- Listing A-5. Estimating the Population for All Rows in the sales_regions Table Using Demographic Information in the zip5_dc Table
SELECT b.id, aggregate_value population
FROM TABLE
(
SDO_SAM.AGGREGATES_FOR_LAYER
('ZIP5_DC', 'GEOM','SUM', 'POPULATION', 'SALES_REGIONS', 'GEOM')
) a,
sales_regions b
WHERE b.rowid = a.region_id;
3 changes: 3 additions & 0 deletions ProOracleSpatialCode/Code/Appendix-A/listing-A-06.sql
@@ -0,0 +1,3 @@
-- Listing A-6. Finding Three Clusters for Customer Locations
SELECT ID, GEOMETRY
FROM TABLE (SDO_SAM.SPATIAL_CLUSTERS('CUSTOMERS', 'LOCATION', 3));
4 changes: 4 additions & 0 deletions ProOracleSpatialCode/Code/Appendix-A/listing-A-07.sql
@@ -0,0 +1,4 @@
-- Listing A-7. Simplifying the Geometry for New Hampshire
SELECT SDO_SAM.SIMPLIFY_GEOMETRY(geom, 0.5)
FROM us_states
WHERE state_abrv='NH';
2 changes: 2 additions & 0 deletions ProOracleSpatialCode/Code/Appendix-D/listing-D-01.sql
@@ -0,0 +1,2 @@
-- Listing D-1. Altering the branches Table to Add the georaster Column
ALTER TABLE branches ADD ( georaster SDO_GEORASTER);
2 changes: 2 additions & 0 deletions ProOracleSpatialCode/Code/Appendix-D/listing-D-02.sql
@@ -0,0 +1,2 @@
-- Listing D-2. Structure of SDO_GEORASTER
DESC SDO_GEORASTER;
10 changes: 10 additions & 0 deletions ProOracleSpatialCode/Code/Appendix-D/listing-D-03.sql
@@ -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);
2 changes: 2 additions & 0 deletions ProOracleSpatialCode/Code/Appendix-D/listing-D-04.sql
@@ -0,0 +1,2 @@
-- Listing D-4. Creating a Trigger to Populate the Raster Data Table
call SDO_GEOR_UTL.createDMLTrigger('BRANCHES','GEORASTER');
4 changes: 4 additions & 0 deletions ProOracleSpatialCode/Code/Appendix-D/listing-D-05.sql
@@ -0,0 +1,4 @@
-- Listing D-5. Initializing the georaster Column in the branches Table
UPDATE branches
SET georaster = SDO_GEOR.INIT('BRANCHES_RDT')
WHERE id=1;
16 changes: 16 additions & 0 deletions ProOracleSpatialCode/Code/Appendix-D/listing-D-06.sql
@@ -0,0 +1,16 @@
-- Listing D-6. Populating the Georaster Column with a TIFF Image
DECLARE
g SDO_GEORASTER;
BEGIN
-- Select the georaster column
SELECT georaster INTO g FROM branches WHERE id = 1 FOR UPDATE;
-- Import into the georaster object
SDO_GEOR.IMPORTFROM
(
g, 'blocksize=(512,512)', 'TIFF', 'file',
'/usr/rasters/r1.tif' -- specify the name and location of the image file
);
-- update the column
UPDATE branches SET georaster = g WHERE id = 1;
END;
/
18 changes: 18 additions & 0 deletions ProOracleSpatialCode/Code/Appendix-D/listing-D-07.sql
@@ -0,0 +1,18 @@
-- Listing D-7. Granting Permissions to Import Data into a GeoRaster Column
CONNECT system/manager -- Replace with password for system

-- Grant permission to user 'spatial'
CALL DBMS_JAVA.GRANT_PERMISSION(
'SPATIAL',
'SYS:java.io.FilePermission',
'/usr/rasters/r1.tif',
'read');

-- Grant permission to the MDSYS schema
CALL DBMS_JAVA.GRANT_PERMISSION(
'MDSYS',
'SYS:java.io.FilePermission',
'/usr/rasters/r1.tif',
'read');

CONNECT spatial/spatial
10 changes: 10 additions & 0 deletions ProOracleSpatialCode/Code/Appendix-D/listing-D-08.sql
@@ -0,0 +1,10 @@
-- Listing D-8. Generating Pyramids for a GeoRaster Object in the branches Table
DECLARE
geor sdo_georaster;
BEGIN
SELECT georaster INTO geor FROM branches WHERE id = 1 FOR UPDATE;
-- Generate four levels of pyramids
SDO_GEOR.GENERATEPYRAMID(geor, 'rlevel=4');
UPDATE branches SET georaster = geor WHERE id = 1;
END;
/
17 changes: 17 additions & 0 deletions ProOracleSpatialCode/Code/Appendix-D/listing-D-09.sql
@@ -0,0 +1,17 @@
-- Listing D-9. Subsetting a GeoRaster Object
DECLARE
g SDO_GEORASTER;
b BLOB;
BEGIN
SELECT georaster INTO g FROM branches WHERE id = 1;
DBMS_LOB.CREATETEMPORARY(b, true);
SDO_GEOR.GETRASTERSUBSET
(
georaster => g,
pyramidlevel => 0,
window => sdo_number_array(0,0,699,899),
bandnumbers => '0',
rasterBlob => b
);
END;
/
17 changes: 17 additions & 0 deletions ProOracleSpatialCode/Code/Appendix-D/listing-D-10.sql
@@ -0,0 +1,17 @@
-- Listing D-10. Georeferencing a GeoRaster Object
DECLARE
g SDO_GEORASTER;
b BLOB;
BEGIN
SELECT georaster INTO g FROM branches WHERE id = 1;
SDO_GEOR.GEOREFERENCE
(
georaster => g,
srid => 8307,
modelcoordinatelocation => 0, -- 0 for center of the picture
xCoefficients => sdo_number_array(30, 0, 410000.0), -- values for a, b, and c
yCoefficients => sdo_number_array(0, -30, 3759000.0) -- values for d, e, and f
);
UPDATE branches SET georaster = g WHERE id = 1;
END;
/
10 changes: 10 additions & 0 deletions ProOracleSpatialCode/Code/Appendix-D/listing-D-11.sql
@@ -0,0 +1,10 @@
-- Listing D-11. 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 a WHERE a.id=1 FOR UPDATE;
UPDATE branches a SET a.georaster.spatialextent = extent WHERE a.id=1;
COMMIT;
END;
/
14 changes: 14 additions & 0 deletions ProOracleSpatialCode/Code/Appendix-D/listing-D-12.sql
@@ -0,0 +1,14 @@
-- Listing D-12. 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
);
COMMIT;
3 changes: 3 additions & 0 deletions ProOracleSpatialCode/Code/Appendix-D/listing-D-13.sql
@@ -0,0 +1,3 @@
-- Listing D-13. Creating an Index on the Spatial Extent of the georaster Column
CREATE INDEX geor_idx ON branches(georaster.spatialextent)
INDEXTYPE IS MDSYS.SPATIAL_INDEX;
13 changes: 13 additions & 0 deletions ProOracleSpatialCode/Code/Appendix-D/listing-D-14.sql
@@ -0,0 +1,13 @@
-- Listing D-14. 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
);
11 changes: 11 additions & 0 deletions ProOracleSpatialCode/Code/Appendix-D/listing-D-15.xml
@@ -0,0 +1,11 @@
<!-- Listing D-15. 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>
7 changes: 7 additions & 0 deletions ProOracleSpatialCode/Code/Chapter-02/listing-02-01.sql
@@ -0,0 +1,7 @@
-- Listing 2-1. Creating the us_restaurants_new Table
CREATE TABLE us_restaurants_new
(
id NUMBER,
poi_name VARCHAR2(32),
location SDO_GEOMETRY -- New column to store locations
);
20 changes: 20 additions & 0 deletions ProOracleSpatialCode/Code/Chapter-02/listing-02-02.sql
@@ -0,0 +1,20 @@
-- Listing 2-2. Inserting a Value for the SDO_GEOMETRY Column in an Oracle Table
INSERT INTO us_restaurants_new VALUES
(
1,
'PIZZA HUT',
SDO_GEOMETRY
(
2001, -- SDO_GTYPE attribute: "2" in 2001 specifies dimensionality is 2.
NULL, -- other fields are set to NULL.
SDO_POINT_TYPE -- Specifies the coordinates of the point
(
-87, -- first ordinate, i.e., value in longitude dimension
-78, -- second ordinate, i.e., value in latitude dimension
NULL -- third ordinate, if any
),
NULL,
NULL
)
);
COMMIT;
13 changes: 13 additions & 0 deletions ProOracleSpatialCode/Code/Chapter-02/listing-02-03.sql
@@ -0,0 +1,13 @@
-- Listing 2-3. Converting Address Data (Implicit Spatial Information) to the SDO_GEOMETRY (Explicit Spatial Information) Object
SELECT
SDO_GCDR.GEOCODE_AS_GEOMETRY
(
'SPATIAL', -- Spatial schema storing the geocoder data
SDO_KEYWORDARRAY -- Object combining different address components
(
'3746 CONNECTICUT AVE NW',
'WASHINGTON, DC 20008'
),
'US' -- Name of the country
) geom
FROM DUAL ;
11 changes: 11 additions & 0 deletions ProOracleSpatialCode/Code/Chapter-02/listing-02-04.sql
@@ -0,0 +1,11 @@
-- Listing 2-4. Finding the Five Nearest Restaurants on I-795
SELECT poi_name
FROM
(
SELECT poi_name,
SDO_GEOM.SDO_DISTANCE(P.location, I.geom, 0.5) distance
FROM us_interstates I, us_restaurants P
WHERE I.interstate = 'I795'
ORDER BY distance
)
WHERE ROWNUM <= 5;
4 changes: 4 additions & 0 deletions ProOracleSpatialCode/Code/Chapter-02/listing-02-05.sql
@@ -0,0 +1,4 @@
-- Listing 2-5. Creating an Index on Locations (SDO_GEOMETRY Column) of Restaurants
DROP INDEX us_restaurants_sidx;
CREATE INDEX us_restaurants_sidx ON us_restaurants(location)
INDEXTYPE IS mdsys.spatial_index;
6 changes: 6 additions & 0 deletions ProOracleSpatialCode/Code/Chapter-02/listing-02-06.sql
@@ -0,0 +1,6 @@
-- Listing 2-6. Finding the Five Nearest Restaurants on Interstate I-795 Using the Spatial Index
SELECT poi_name
FROM us_interstates I, us_restaurants P
WHERE I.interstate = 'I795'
AND SDO_NN(P.location, I.geom) ='TRUE'
AND ROWNUM <= 5;
10 changes: 10 additions & 0 deletions ProOracleSpatialCode/Code/Chapter-02/listing-02-07.sql
@@ -0,0 +1,10 @@
-- Listing 2-7. Identifying All Restaurants in a 50 km Radius Around Interstate I-795
SELECT POI_NAME
FROM us_interstates I, us_restaurants P
WHERE
SDO_ANYINTERACT
(
P.location,
SDO_GEOM.SDO_BUFFER(I.geom, 50, 0.5, 'UNIT=KM')
) ='TRUE'
AND I.interstate='I795' ;
4 changes: 4 additions & 0 deletions ProOracleSpatialCode/Code/Chapter-02/listing-02-08.sql
@@ -0,0 +1,4 @@
-- Listing 2-8. Verifying That a Spatial Install Is Successful
SELECT COMP_NAME, STATUS
FROM DBA_REGISTRY
WHERE COMP_NAME = 'Spatial';
15 changes: 15 additions & 0 deletions ProOracleSpatialCode/Code/Chapter-03/listing-03-01.sql
@@ -0,0 +1,15 @@
-- Listing 3-1. Creating the customers Table
CREATE TABLE customers
(
id NUMBER,
datasrc_id NUMBER,
name VARCHAR2(35),
category VARCHAR2(30),
street_number VARCHAR2(5),
street_name VARCHAR2(60),
city VARCHAR2(32),
postal_code VARCHAR2(16),
state VARCHAR2(32),
phone_number VARCHAR2(15),
customer_grade VARCHAR2(15)
);
16 changes: 16 additions & 0 deletions ProOracleSpatialCode/Code/Chapter-03/listing-03-02.sql
@@ -0,0 +1,16 @@
-- Listing 3-2. Populating customers table.
INSERT INTO customers VALUES
(
1, -- id
1, -- datasrc_id
'Pizza Hut', -- name
'Restaurant', -- restaurant
'134', -- street_number
'12TH STREET', -- street_name
'WASHINGTON', -- city
'20003', -- postal_code
'DC', -- state
NULL, -- phone_number
'GOLD' -- customer_grade
);
COMMIT;
2 changes: 2 additions & 0 deletions ProOracleSpatialCode/Code/Chapter-03/listing-03-03.sql
@@ -0,0 +1,2 @@
-- Listing 3-3. Adding a location Column to the customers Table
ALTER TABLE customers ADD (location SDO_GEOMETRY);
4 changes: 4 additions & 0 deletions ProOracleSpatialCode/Code/Chapter-03/listing-03-04.sql
@@ -0,0 +1,4 @@
-- Listing 3-4. Sample Address for a Specific Customer in the customers Table
SELECT street_number, street_name, city, state, postal_code
FROM customers
WHERE id = 1;
14 changes: 14 additions & 0 deletions ProOracleSpatialCode/Code/Chapter-03/listing-03-05.sql
@@ -0,0 +1,14 @@
-- Listing 3-5. Geocoding Addresses to Obtain Explicit Spatial Information
UPDATE customers
SET location =
sdo_gcdr.geocode_as_geometry
(
'SPATIAL',
sdo_keywordarray
(
street_number || ' ' || street_name,
city || ', ' || state || ' ' || postal_code
),
'US'
);
COMMIT;

0 comments on commit 10fda59

Please sign in to comment.