diff --git a/spatial/README_spatial_samples.txt b/spatial/README_spatial_samples.txt new file mode 100644 index 0000000..5d09d10 --- /dev/null +++ b/spatial/README_spatial_samples.txt @@ -0,0 +1,61 @@ +README file for Db2 Spatial Analytics Samples + +* +* +* (C) COPYRIGHT INTERNATIONAL BUSINESS MACHINES CORPORATION 2000, 2021. +* + ALL RIGHTS RESERVED. +* + + +File: samples/spatial/README_spatial_samples.txt + +The Db2 Spatial Analytics samples consist of one demo program. + - One sample is based on banking (branches, customers, employees). + This banking demo is written in SQL scripts run by the command-line + processor (CLP). +This file briefly introduces the demo and indicates where to look for +further information. + + += = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = +The Banking Demo is implemented in SQL scripts that are run with the Db2 +command line processor. You can use the demo and scripts as a tutorial. +The scripts and README file "saBankDemoREADME.txt" are located in the +"bank" subdirectory (sqllib/extenders/samples/spatial/bank). +The following excerpt from that file gives an introduction to the demo: +***************************************************************************** + Banking Customer Analysis Sample + + This demo illustrates adding a spatial dimension to an existing + information system. The existing system did not contain any explicit + location (spatial) data. However, the existing system did contain implicit + location data in the form of addresses. By spatially enabling the existing + database, the user expands the business analysis capabilities of the system. + + A bank that has customers with accounts at two branches needs to use the + spatial attribute of the existing data along with census demographic data + to perform various kinds of spatial analysis. The analysis consists of + comparing customer, branch, and demographic data, as well as profiling + customers and doing market analysis. The bank looks for prospective + customers by finding average balances for customers within three miles of + the branch, determining what areas the primary customers live in, and + searching for similar areas. + + Note: Although this demo focuses on a banking application, it is equally + applicable to different businesses such as retail, insurance, and so on. +***************************************************************************** + +For UNIX, the Banking Demo is driven by a Korn shell script called +"saBankDemoRunBankDemo". To display usage information, enter + saBankDemoRunBankDemo -h + +For Windows, the Banking Demo is driven by a batch file which is TBD. + +Before you run the demo, look at the "saBankDemoREADME.txt" file. This +README file describes the prerequisites and explains how to run the demo. + +After the Banking Demo runs, the complete record of its actions can be found +in the file "sa_bank.log" which is in the "tmp", subdirectory under the home +directory of the user who ran the demo. + diff --git a/spatial/bank/saBankDemoDDL.db2 b/spatial/bank/saBankDemoDDL.db2 new file mode 100644 index 0000000..f5b87dc --- /dev/null +++ b/spatial/bank/saBankDemoDDL.db2 @@ -0,0 +1,98 @@ +---------------------------------------------------------------------------- +-- Licensed Materials - Property of IBM +-- Governed under the terms of the IBM Public License +-- +-- (C) COPYRIGHT International Business Machines Corp. 2000 - 2021 +-- All Rights Reserved. +-- +-- US Government Users Restricted Rights - Use, duplication or +-- disclosure restricted by GSA ADP Schedule Contract with IBM Corp. +---------------------------------------------------------------------------- +-- +-- Component Name: Db2 Spatial Analytics +-- +-- Source File Name: saBankDemoDDL.db2 +-- +-- Version: 11.5.6+ +-- +-- Description: Load non-spatial data into the sample database. +-- +-- SQL STATEMENTS USED: +-- DROP TABLE +-- CREATE TABLE +-- +-- The tables are created using the database default table organization. +-- Note: for column organized tables the primary keys are not enforced +-- by default. +-- +-- For more information about the Db2 Spatial Analytics Bank Demo scripts, +-- see the saBankDemoREADME.txt file. +-- +-- For more information about Db2 Spatial Analytics component, refer to the +-- documentation at +-- https://www.ibm.com/docs/en/db2/11.5?topic=data-db2-spatial-analytics. +-- +-- For the latest information on Db2 refer to the Db2 website at +-- https://www.ibm.com/analytics/db2. +---------------------------------------------------------------------------- +CREATE TABLE sa_demo.customers ( + customer_id INTEGER NOT NULL + PRIMARY KEY ENFORCED, + sa_row_id INTEGER, + name VARCHAR (20), + street VARCHAR (25), + city VARCHAR (10), + state VARCHAR (2), + zip VARCHAR (5), + phone VARCHAR (20) , + email VARCHAR (50) , + customer_type VARCHAR (10) , + date_billed DATE , + notes VARCHAR (100), + date_entered DATE, + latitude DOUBLE, + longitude DOUBLE + ) ; + +CREATE TABLE sa_demo.branches ( + branch_id INTEGER NOT NULL + PRIMARY KEY ENFORCED, + sa_row_id INTEGER, + name VARCHAR (12), + manager VARCHAR (20), + street VARCHAR (20), + city VARCHAR (10), + state VARCHAR (2), + zip VARCHAR (5), + phone VARCHAR (30), + fax VARCHAR (30), + latitude DOUBLE, + longitude DOUBLE + ) ; + +CREATE TABLE sa_demo.accounts ( + customer_id INTEGER NOT NULL, + branch_id INTEGER NOT NULL, + account_id INTEGER NOT NULL + PRIMARY KEY ENFORCED, + type VARCHAR (10) NOT NULL, + balance DECIMAL (14, 2) NOT NULL, + routing_number integer NOT NULL, + CONSTRAINT fk_branches FOREIGN KEY(branch_id) + REFERENCES sa_demo.branches(branch_id) ON DELETE CASCADE, + CONSTRAINT fk_customers FOREIGN KEY(customer_id) + REFERENCES sa_demo.customers(customer_id) ON DELETE CASCADE + ) ; + +CREATE TABLE sa_demo.transactions ( + transaction_id INTEGER NOT NULL + PRIMARY KEY, + transaction_date DATE NOT NULL, + description VARCHAR (100), + account_id INTEGER NOT NULL , + amount DECIMAL (14, 2) NOT NULL, + notes VARCHAR (100), + classification VARCHAR (30), + CONSTRAINT fk_accounts FOREIGN KEY(account_id) + REFERENCES sa_demo.accounts(account_id) ON DELETE CASCADE + ) ; diff --git a/spatial/bank/saBankDemoREADME.txt b/spatial/bank/saBankDemoREADME.txt new file mode 100644 index 0000000..8f1eafa --- /dev/null +++ b/spatial/bank/saBankDemoREADME.txt @@ -0,0 +1,260 @@ +README file for Db2 Spatial Analytics Bank Demo +Db2 LUW + + +* +* +* (C) COPYRIGHT INTERNATIONAL BUSINESS MACHINES CORPORATION 2002 - 2021. +* ALL RIGHTS RESERVED. +* + + +This sample script demonstrates Db2 Spatial Analytics administration, +SQL stored procedures, and spatial functions. + +***************************************************************************** + +WARNING: Some of these samples may change your database or database manager + configuration. Run the samples against a "test" database only, + such as the Db2 SAMPLE database. + +***************************************************************************** + +QUICKSTART + + 1. Start the database manager (with the db2start command). + + 2. Start the sample (with the saBankDemoRunBankDemo command). + +***************************************************************************** + +Documentation + + + +For more information about Db2 Spatial Analytics, see either of the following +sources. The scripts in this Bank Demo use the term "User's Guide" to refer +to both of these sources of information: + +- The equivalent Spatial Analytics topics in the Db2 Documentation. + https://www.ibm.com/docs/en/db2/11.5?topic=data-db2-spatial-analytics + +For the latest information about programming, compiling, and running Db2 +Spatial Analytics applications, refer to +TODO fix link +http://www.ibm.com/software/data/spatial/db2spatial + + + +***************************************************************************** + +Command syntax + + + saBankDemoRunBankDemo [-i | -n | -c | -b | -h] [] + + -i Interactive mode: A description of each step is shown before + you are prompted to execute the step. Explains the story + board of the bank scenario and the spatial administrative + actions necessary to set up the database. After the database + is set up, you are prompted to perform several queries. + + -n Non-interactive mode: Follows the same steps as the + interactive mode but does not prompt you at each step. + This mode can be used to set up a database for visualization + or for further spatial analysis with SQL. + + -c Completion mode: All the demo steps run in non-interactive + mode. At the end, the script notifies you of success or + failure. + + -b Basic mode: This mode is tutorial oriented, in which you + follow a written script to perform all the database setup + steps on the db2gse command-line processor (CLP) or Db2 + Command Editor. + The database is spatially enabled and only non-spatial data is + loaded. You perform the remaining steps. You also construct + a series of spatial queries using the Db2 CLP or the + DB2 Command Editor. + + If database does not exist, the demo creates it. The + default database name is sa_bank. + The schema name is sa_demo (you cannot modify the schema name). + + + +***************************************************************************** + +Prerequisites + + + + 1. Before you start the sample program, ensure that the following steps have + been done in advance: + + - Db2 Spatial Analytics is enabled, if needed. + + - The Db2 default instance is created. + + - The Database manager is started (with the db2start command). + + - The DB2PATH environment variable points to the sqllib directory. + + - The user ID under which this demo is invoked has either SYSADM + or DBADM authority. + + 2. If you are running this demo a second time, delete all of the previous + message and exception files that have the following form: + On UNIX, + ~/tmp/*.msg and ~/tmp/*.shp + + On Windows, + %TEMP%\*.msg and %TEMP%\*.shp + +The following steps are needed if the instance is not configured +as a warehouse (that is the registry DB2_WORKLOAD is not set to ANALYTICS). + 3. If you are going to create a new database or use an existing database, + ensure that the following parameters are updated to at least the listed + values: + + Parameter Min value CO Explanation/Description + ------------ --------- -- ------------------------------------------ + APPLHEAPSZ 10242 no various (also for enable_db) + STMTHEAP 16384 yes Various platforms raise "query too complex" + warnings + + CO => Configurable Online + + Note: Some of these parameters are not online configurable, and you must + stop and restart the DB2 instance for the new values to take effect. + + If these parameters are not set to the values listed above, the demo will + prompt you to ask if you want the demo to update these values for + the database. If you reply "yes," the demo stops and restarts the DB2 + instance. + + + 4. This demo requires larger buffer pools and table spaces than provided by + the default buffer pool and table space. + + CREATE object Page size Explanation/Description + -------------------------- --------- -------------------------------- + TABLESPACE 8K Import a shapefile with more columns + than fit on a 4K page size + TEMPORARY TABLESPACE 32K Complex ad hoc queries + USER TEMPORARY TABLESPACE 32K Spatial grid index advisor + BUFFERPOOL 8K Use with 8K table space + BUFFERPOOL 32K Use with 32K table space + + If these database objects do not exist, the demo will prompt you to + ask if you want the demo to create them. If you reply "yes," the demo + stops and restarts the DB2 instance for them to take effect. + + +***************************************************************************** + +File descriptions + +saBankDemoREADME.txt - This file +saBankDemoRunBankDemo - Main demo script (Korn Shell) +saBankDemoRunBankDemo.bat - Main demo script (Windows batch file) +saBankDemoDDL.db2 - Creates non-spatial data tables +saBankDemoTableData.db2 - Loads non-spatialdata +saBankDemoSpatialSQL.db2 - Miscellaneous spatial queries +saBankDemoViewDDL.db2 - Creates spatial analysis views +saBankDemoRefresh.db2 - Drops all the tables and views + +***************************************************************************** + +Background + +Time and space will become the cornerstone of 21st-century data warehouses. +The time dimension is already frequently used in OLAP and multidimensional +analysis tools. The next frontier is to add the space dimension to +data to discover and exploit the spatial intelligence of the data warehouse. + +Spatial data (also called location data and geographic data) consists of +values that denote the location of objects and areas with respect to one +another. Spatial objects include those that comprise the Earth's surface +and those that occupy it. They make up both the natural environment (for +example rivers, forests, hills and deserts) and the cultural environment +(cities, residences, office buildings, landmarks, and so on). + +Virtually every database already has spatial data -- addresses -- and +virtually every business can benefit from making their data spatially aware. + +It is estimated that 80% of the world's databases have a spatial element. +This data, however, is not usable because it is stored in text form, and +SQL does not know if 12 Main Street is close to 141 Langdon Street. This +address data is at the core of most commercial enterprises, yet the semantic +content is not exploited. The ability to leverage the value of this +existing data asset is central to spatial analysis. + +IBM has focused research efforts on creating an extensible data management +infrastructure for more than a decade. The results of these efforts have +become a major component of IBM's Db2 Database, which includes +access to heterogeneous data and to non-IBM, non-relational data sources. + +The ability to model complex data and objects (geospatial data, text, images +and other user-defined data types) directly in the database gives users +four key benefits: + +- Enhances the business value of existing applications and data +- Improves business intelligence with integrated searching across all data + types +- Facilitates the development of new applications and queries +- Improves overall application performance + + +***************************************************************************** + +Banking customer analysis sample + +This demo illustrates adding a spatial dimension to an existing information +system. The existing system did not contain any explicit location (spatial) +data. However, the existing system did contain implicit location data in the +form of addresses. By spatially enabling the existing database, the user +expands the business analysis capabilities of the system. + +Note: Although this demo focuses on a banking application, it is equally +applicable to different businesses such as retail, insurance, and so on. + +A bank that has customers with accounts at two branches needs to use the +spatial attribute of the existing data along with census demographic data +to perform various kinds of spatial analysis. The analysis consists of +comparing customer, branch, and demographic data, as well as profiling +customers and doing market analysis. The bank looks for prospective +customers by finding average balances for customers within three miles of +the branch, determining what areas the primary customers live in, and +searching for similar areas. + +The demographic and spatial reference data has an explicit spatial component. +The initial data is in shapefile format. Shapefile format is an ESRI standard +for storing spatial information and has become an industry standard. For more +information, see the ESRI Web site at +http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf. + +The customer, branch and employee tables contain the address information +and corresponding latitude and longitude values. + +The demo script illustrates how to use the spatial administration commands +and prepare a database for spatial data visualization using ESRI's +ArcExplorer. The sample also explains how to use the spatial routines, and +outlines how spatial analysis can be used in a banking scenario. + +The demo script runs in four modes that are described in the command syntax. + +***************************************************************************** + +Duration + +Most of the demo steps take seconds to run, but the steps below might +take several minutes: + +- Creating the database + +- Spatially enabling the database, if needed + +- Importing shapefile data + +***************************************************************************** diff --git a/spatial/bank/saBankDemoRefresh.db2 b/spatial/bank/saBankDemoRefresh.db2 new file mode 100644 index 0000000..e0c745b --- /dev/null +++ b/spatial/bank/saBankDemoRefresh.db2 @@ -0,0 +1,57 @@ +---------------------------------------------------------------------------- +-- Licensed Materials - Property of IBM +-- Governed under the terms of the IBM Public License +-- +-- (C) COPYRIGHT International Business Machines Corp. 2000 - 2021 +-- All Rights Reserved. +-- +-- US Government Users Restricted Rights - Use, duplication or +-- disclosure restricted by GSA ADP Schedule Contract with IBM Corp. +---------------------------------------------------------------------------- +-- +-- Component Name: Db2 Spatial Analytics v11.5 +-- +-- Source File Name: saBankDemoRefresh.db2 +-- +-- Version: 11.5.6+ +-- +-- Description: Drops all the tables and views, and spatially disables the +-- current database. +-- +-- SQL STATEMENTS USED: +-- DROP TABLE +-- DROP VIEW +-- +-- For more information about the Db2 Spatial Analytics Bank Demo scripts, +-- see the saBankDemoREADME.txt file. +-- +-- For more information about Db2 Spatial Analytics component, refer to the +-- documentation at +-- https://www.ibm.com/docs/en/db2/11.5?topic=data-db2-spatial-analytics. +-- +-- For the latest information on Db2 refer to the Db2 website at +-- https://www.ibm.com/analytics/db2. +---------------------------------------------------------------------------- + +DROP VIEW sa_demo.meridian_customers ; +DROP VIEW sa_demo.sancarlos_customers; +DROP VIEW sa_demo.closest_branch; +DROP VIEW sa_demo.customers_savings ; +DROP VIEW sa_demo.customers_checkings ; +DROP VIEW sa_demo.customers_totals ; +DROP VIEW sa_demo.closest_savings ; +DROP VIEW sa_demo.closest_checking; +DROP VIEW sa_demo.overlap_zone; +DROP VIEW sa_demo.avg_savings_block; +DROP VIEW sa_demo.prospects; +DROP TABLE sa_demo.branch_buffers ; + +DROP TABLE sa_demo.customers ; +DROP TABLE sa_demo.branches ; +DROP TABLE sa_demo.accounts ; +DROP TABLE sa_demo.transactions ; +DROP TABLE sa_demo.city_limits; +DROP TABLE sa_demo.sales_regions; +DROP TABLE sa_demo.sj_census_blocks; +DROP TABLE sa_demo.sj_zipcodes; +DROP TABLE sa_demo.sj_main_streets; diff --git a/spatial/bank/saBankDemoRunBankDemo b/spatial/bank/saBankDemoRunBankDemo new file mode 100755 index 0000000..6b35704 --- /dev/null +++ b/spatial/bank/saBankDemoRunBankDemo @@ -0,0 +1,1607 @@ +########################################################################## +# Licensed Materials - Property of IBM * +# 5765-478 * +# (c) Copyright IBM Corporation 2000-2011. * +# All rights reserved. * +# * +# US Government Users Restricted Rights - Use, duplication or * +# disclosure restricted by GSA ADP Schedule Contract with * +# IBM Corporation. * +#************************************************************************* +# Permission Notice * +# * +# Permission is granted to copy, use, modify, and merge this sample * +# software into your applications and to permit others to do any of the * +# foregoing. You may further distribute this software for * +# commercial purposes only as part of your application that adds * +# significant value and function beyond that provided by these * +# samples. * +# You must include this permission statement and retain the copyright * +# notice in all copies and modified versions of this software. * +# * +#************************************************************************* +# * +# DISCLAIMER OF WARRANTIES * +# * +# The sample software is provided to you by IBM to assist you in * +# developing your applications. THIS SOFTWARE IS PROVIDED AS-IS, * +# WITHOUT WARRANTY OF ANY KIND. IBM SHALL NOT BE LIABLE FOR ANY * +# DAMAGES ARISING OUT OF YOUR USE OR THE USE BY ANY THIRD PARTY * +# OF THE SAMPLE SOFTWARE EVEN IF IT HAS BEEN ADVISED OF THE POSSIBILITY * +# OF SUCH DAMAGES. IN ADDITION, IBM SHALL NOT BE LIABLE FOR ANY THIRD * +# PARTY CLAIMS AGAINST YOU. * +# * +#************************************************************************* +# * +# WARNING * +# * +# This sample may change your database or database manager * +# configuration. Execute the samples against a 'test' database only, * +# such as the DB2 sa_bank database. * +# * +#************************************************************************* +# Component Name: Db2 Spatial Analytics v11.5 +# +# Source File Name: saBankDemoRunBankDemo +# +# Version: 11.5.6+ +# +# Description: This script creates a sample bank database, +# ------------ creates a sample tables, insert rows into tables, +# spatially enables the database, sets up geocoder, +# runs geocoder, imports spatial data. +# S Y N T A X: +# ------------ +# saBankDemoRunBankDemo [-i | -n | -c | -b | -h] [-wh] [] +# +# If database does not exist it will be created. +# The default name that will be used is sa_bank. +# The schema name is sa_demo (you cannot modify the schema name). +# +# Command options +# +# -i Interactive mode: A description of each step is shown before +# you are prompted to execute the step. Explains the story +# board of the bank scenario and the spatial administrative +# actions necessary to set up the database. After the database +# is set up, you are prompted to perform several queries. +# +# -n Non-interactive mode: Follows the same steps as the +# interactive mode but does not prompt you at each step. +# This mode can be used to set up a database for visualization +# or for further spatial analysis with SQL. +# +# -c Completion mode: All the demo steps run in non-interactive +# mode. At the end, the script notifies you of success or +# failure. +# +# -b Basic mode: This mode is tutorial oriented, in which you +# follow a written script to perform all the database setup +# steps on the db2gse command-line processor (CLP) or Db2 +# Command Editor. +# The database is spatially enabled and only non-spatial data is +# loaded. You perform the remaining steps. You also construct +# a series of spatial queries using the Db2 CLP or the +# Db2 Command Editor. +# +# -wh Configures the instance as a warehouse by setting DB2_WORKLOAD +# to ANALYTICS (UNIX/LINUX only currently.) +# +#************************************************************************* +# +# Notes: +# ------ +# 0. Before proceeding, the following steps have been done in advance: +# - Db2 default instance has been created and configured as needed. +# - Start the database manager (with the db2start command). +# - DB2PATH environment variable points to the sqllib directory +# - The user ID under which this demo is invoked must have either SYSADM +# or DBADM authority. +# 1. If you are going to create a new database or use an existing database +# certain database configuration parameters must be updated. +# The following parameters must be updated to at least the listed +# values: +# Parameter min value CO description +# ------------ --------- -- ------------------------------------------- +# APPLHEAPSZ 2048 no various (also for enable_db) +# STMTHEAP 4096 yes Various platforms raise "query too complex" +# warnings +# CO => Configurable Online +# If these parameters are not to the values listed above the demo will +# prompt the user if they would like the demo to update these values for +# the database. NOTE, that some of the values are not online +# configurable which requires a db2stop and db2start for these values to +# take effect. +# 2. This demo Creates buffer pool and temporary table space which requires +# the database manager to be stopped(db2stop) and started(db2start) for +# them to take effect. +# 3. If you are running this demo for the second time make sure all the +# previous messages files in the ~/tmp/msg* are deleted. +# +#************************************************************************* +# +# Environment: Unix +# +#************************************************************************* +# +# For more information about the Db2 Spatial Analytics Bank demo script, +# see the file: saBankDemoREADME.txt +# +# For information on using Db2 Spatial Analytics, see the +# https://www.ibm.com/docs/en/db2/11.5?topic=data-db2-spatial-analytics +# documentation. +# In this Demo, this document is referred to simply as the [User's Guide]. +# +# For the latest information on Db2 refer to the Db2 website at +# https://www.ibm.com/analytics/db2. +# +########################################################################## + +#========================================================================= +# Environment settings: +# +# This is a Korn Shell script. It can not be interpreted on all platforms +# with a Bourne Shell interpreter. We will only proceed below this point +# if ksh is found in /usr/bin or /bin for compatibility reasons. +# +# If only sh exists the script might still work. You might then try to +# comment the lines below and run the script again. +#======================================================================== +if [[ $PPID -eq $BANK_ID ]] ; then + exit $? +fi + +export BANK_ID=$$ + +if [[ -x $(which ksh) ]] ; then + $(which ksh) $0 $@ +else + echo "This script requires a Korn-Shell to run. Please make sure that 'ksh' is installed." + exit 1 +fi + +#===================================================================== +# Name: create_db +# Purpose: Create Database for bank spatial sample +# Input: +# $1 => mode +# $2 => db_name +#===================================================================== +function create_db { + # local function variables + typeset mode=$1 + typeset db_name=$2 + + typeset result='' # result of executing statement + typeset rc='' + typeset first='' # SQL error message number + + # Init log file + outfile=~/tmp/create_db.out + rm -f $outfile 2>/dev/null + + if [[ $mode = i ]] || [[ $mode = b ]]; then + echo "========================================================================" + echo "|> Create database" $db_name and introduction + + echo "========================================================================" + echo " Welcome to Db2 Spatial Analytics Bank Demo!" + echo " " + echo " This demo will present the commands to create a banking database " + echo " and perform some basic spatial administration. " + echo " " + echo " During the demo you will be presented with the command and also " + echo " an explanation of the command and hints and tips." + echo " " + echo " The following is a list of places to find out more information " + echo " about Db2 Spatial Analytics:" + echo " - For more information about this demo please refer to the " + echo " readme saBankDemoREADME.txt. " + echo " - For more information about the commands used in this " + echo " demo please refer to the documentation " + echo " https://www.ibm.com/docs/en/db2/11.5?topic=data-db2-spatial-analytics." + echo " In the demo, we refer" + echo " to this document simply as the [User's Guide]. " + echo " " + echo " This demo is a shell script and can be stopped at any time by " + echo " pressing Control-C." + echo "------------------------------------------------------------------------" + echo "db2 create database" $db_name ". Please wait ..." + fi + + result=$(db2 create db $db_name) + rc=$? + echo "db2 create db $db_name" >>$outfile ; echo $result >>$outfile + + first=`expr "$result" | cut -d" " -f1` + + if [[ $rc = 0 ]] ; then + if [[ $mode = i ]] || [[ $mode = b ]]; then + echo $result + press_any_key_to_continue + fi + else + if [[ $mode = i ]] || [[ $mode = b ]]; then + echo "* Create database was not successful" + echo $result + fi + # Check if the database already exists + if [[ $first = SQL1005* ]]; then + if [[ $mode = i ]] || [[ $mode = b ]]; then + press_any_key_to_continue + fi + else # The error message is not 'database already exists' + return 1 + fi + fi + + if [[ $rc = 0 ]] || [[ $first = SQL1005* ]] ; then + return 0 + else + return 1 + fi +} #//end of create_db function + + +#===================================================================== +# Name: update_cfg +# Purpose: Update database and database management configuration +# parameters necessary for the sample +# +# Parameter min value CO description +# ------------ --------- -- ------------------------------------------- +# APPLHEAPSZ 2048 no various and for enable_db +# STMTHEAP 4096 yes Various platforms raise "query too complex" +# warnings +# CO => Configurable Online +# << TO DO >> +# 1) It might be good to add a force application all if the disconnect failed +# 2) Add a refresh option +# 3) Add all the samples to the saBankDemoSpatialSQL.db2 +#===================================================================== +function update_cfg { + # Input Parameters + # $1 => mode + # $2 => db_name + # typeset declares local function variables + typeset mode=$1 + typeset db_name=$2 + + #return codes of executing statements + typeset rc1=0 ; typeset rc2=0 ; typeset rc3=0 + typeset rc4=0 ; typeset rc5=0 + typeset rc_reset=0 ; rc_terminate=0 + typeset ans='' + + # Init log file + outfile=~/tmp/update_cfg.out + rm -f $outfile 2>/dev/null + + if [[ $mode = i ]] || [[ $mode = b ]]; then + echo "========================================================================" + echo "|> Update Database configuration parameters" + echo "========================================================================" + echo " For this demo to operate correctly certain database configuration" + echo " parameters may need to be updated. The suggested values are:" + echo + echo " Parameter min value CO reason" + echo " ------------ --------- -- -------------------------------------------" + echo " APPLHEAPSZ 2048 no various SE commands, in particular enable_db" + echo " STMTHEAP 4096 yes Various platforms raise \"query too complex\"" + echo " warnings with some spatial queries" + echo " CO => Configurable Online" + echo + echo " Parameters that are NOT online configurable require all applications" + echo " to be disconnected from the database before they take effect." + echo + echo " This demo expects that you are the only one connected to this database" + echo " while this demo is running. If you elected for this demo to create" + echo " the database, you will be the only user connected to the database." + echo + echo " For more information about the parameters above and tuning your database " + echo " please refer to the Db2 Performance Tuning Guide. Please note that" + echo " the suggested parameters above are not a complete set of parameters" + echo " to be considering for tuning your spatial database nor are they" + echo " necessary the optimal values. The optimal values can vary depending on" + echo " the database, application and hardware requirements, however the" + echo " values above are adequate for this demo." + echo + echo " To view your current database configuration parameters use the DB2" + echo " command: db2 get database configuration. Details about this command" + echo " can be found in the Db2 Command Line Processor manual." + echo + echo " For more information about the required minimum configuration parameter" + echo " values for your spatial database refer to Chapter \"Setting up a " + echo " database\" in the User's Guide." + echo + echo " This next section of the demo will disconnect your id from the database" + echo " and update the database configuration variables to the values above." + echo + echo "------------------------------------------------------------------------" + fi + + while : + do + if [[ $mode = i ]] || [[ $mode = b ]]; then + echo + echo "Do you want this script to update the database configuration parameters?" + echo "<> Answer y or n, then press RETURN:" + read ans + else + ans=y + fi + case "$ans" in + y)# The update commands for online configurable parameters below + # return 0 when successful, however setting the non-online + # configurable parameters returns 2 when successful because the + # user must disconnect all applications before the updated + # values take effect. To get all 0\'s, you have to first + # disconnect all applications before issuing update commands. + # + # The update command returns a 4 when a syntax error occurs. + + if [[ $mode = i ]] || [[ $mode = b ]]; then + echo 'Updating database configuration parameters. Please wait ...' + fi + + log db2 connect reset + rc_reset=$? + log db2 terminate + rc_terminate=$? + + log db2 "update db cfg for $db_name using APPLHEAPSZ 2048" + rc2=$? + log db2 "update db cfg for $db_name using STMTHEAP 4096" + rc5=$? + + showlog_pause + break ;; + + n) echo + echo "|| The database configuration parameters were not updated." + echo + break ;; + + *) echo "${ans}? Please answer y or n." + esac + done + + if [[ $rc2 = 0 ]] && \ + [[ $rc5 = 0 ]] ; then + return 0 + else + return 1 + fi +} #//end of update_cfg function + + +#===================================================================== +# Name: setup_db +# Purpose: Create tablespaces and bufferpools for demo +#===================================================================== +function setup_db { + # Input Parameters + # $1 => mode + # $2 => db_name + # typeset declares local function variables + typeset mode=$1 + typeset db_name=$2 + + #return codes of executing statements + typeset rc_connect=0 + typeset rc_create_32k_bp=0; typeset rc_create_8k_bp=0 + typeset rc_create_temp_ts=0 ; typeset rc_create_user_temp_ts=0 + typeset rc_create_8k_ts=0 ; + typeset rc_grant1=0 ; typeset rc_grant2=0 + typeset rc_stop=0 ; typeset rc_start=0 + typeset rc_reset1=0 ; typeset rc_reset2=0 + + typeset ans='' + + # Init log file + outfile=~/tmp/setup_db.out + rm -f $outfile 2>/dev/null + + if [[ $mode = i ]] || [[ $mode = b ]]; then + echo "========================================================================" + echo "|> Create bufferpools and tablespaces and grant public authority to" + echo "|> tablespaces." + echo "========================================================================" + echo " This is needed if the environment is not set to create a warehouse." + echo " In a warehouse environment the default database page size is 32k." + echo + echo " This part of the demo is going to create two buffer pools and two" + echo " tablespaces. The default tablespace has a 4k page size and the demo" + echo " requires one 8k page size and two 32k page size tablespaces. The 8k " + echo " page tablespace is for importing a shapefile with more columns than fit" + echo " on a 4k page size. The temporary table space is used for complex ad hoc" + echo " queries." + echo " The temporary tablespace uses a 32k page size." + echo + echo " Each tablespace must have an associated bufferpool. Since the default" + echo " bufferpool is of a small 4k page, therefore I need to create two other" + echo " bufferpools for the 8k and 32k tablespaces." + echo + echo " When a new bufferpool is created is requires the database to be stopped" + echo " before it goes into affect. Therefore, this next section will stop and" + echo " start the database manager." + echo + echo " This section also grants access to these new tablespaces to public, so" + echo " that anyone can create tables in these tablespaces." + echo + echo " For more information about bufferpools and tablespaces, please refer to" + echo " the Db2 SQL Reference." + echo "------------------------------------------------------------------------" + fi + + while : + do + if [[ $mode = i ]] || [[ $mode = b ]]; then + echo + echo 'Do you want this script to create the bufferpools and tablespaces,' + echo ' which requires a stop and start of the database manager?' + echo '<> Answer y or n, then press RETURN: ' + read ans + else + ans=y + fi + case "$ans" in + y) if [[ $mode = i ]] || [[ $mode = b ]]; then + echo 'Creating the bufferpools and tablespaces. Please wait ...' + fi + + log db2 CONNECT RESET + rc_reset1=$? + log db2 CONNECT TO $db_name + rc_connect=$? + log db2 CREATE BUFFERPOOL sa_bank_32k_bp SIZE 1024 PAGESIZE 32 K + rc_create_32k_bp=$? + log db2 CREATE BUFFERPOOL sa_bank_8k_bp SIZE 1024 PAGESIZE 8 K + rc_create_8k_bp=$? + + log db2 "CREATE TEMPORARY TABLESPACE sa_bank_temp_ts \ + PAGESIZE 32 K MANAGED BY SYSTEM USING ('sa_bank_container_32k_tt') \ + EXTENTSIZE 64 PREFETCHSIZE 32 BUFFERPOOL sa_bank_32k_bp" + rc_create_ts=$? + + #log db2 "CREATE USER TEMPORARY TABLESPACE \ + # sa_bank_u_temp_ts \ + # PAGESIZE 32 K MANAGED BY SYSTEM USING ('sa_bank_container_32k_utt') \ + # EXTENTSIZE 64 PREFETCHSIZE 32 BUFFERPOOL sa_bank_32k_bp" + #rc_create_user_ts=$? + + log db2 "CREATE TABLESPACE sa_bank_8k_ts\ + PAGESIZE 8 K MANAGED BY SYSTEM USING ('sa_bank_container_8k') \ + EXTENTSIZE 16 PREFETCHSIZE 8 BUFFERPOOL sa_bank_8k_bp" + rc_create_8k_ts=$? + + log db2 GRANT USE OF TABLESPACE sa_bank_u_temp_ts TO PUBLIC + rc_grant1=$? + + log db2 GRANT USE OF TABLESPACE sa_bank_8k_ts TO PUBLIC + rc_grant2=$? + + log db2 CONNECT RESET + rc_reset2=$? + + log db2stop force + rc_stop=$? + + log db2start + rc_start=$? + + showlog_pause + break ;; + n) echo ; echo "|| The bufferpools and tablespaces were not created." + break ;; + *) echo ; echo "${ans}? Please answer y or n." + esac + done + + if [[ $rc_create_8k_bp = 0 ]] && \ + [[ $rc_create_temp_ts = 0 ]] && [[ $rc_create_user_temp_ts = 0 ]] && \ + [[ $rc_create_8k_ts = 0 ]] && [[ $rc_grant1 = 0 ]] && [[ $rc_grant2 = 0 ]] + then + return 0 + else + return 1 + fi +} #//end of setup_db function + + +#===================================================================== +# Name: enable_db +# Purpose: Spatially enable bank sample database +#===================================================================== +function enable_db { + # Input Parameters + # $1 => mode + # $2 => db_name + # typeset declares local function variables + typeset mode=$1 + typeset db_name=$2 + typeset rc_connect='' + typeset rc='' + + # Init log file + outfile=~/tmp/enable_db.out + rm -f $outfile 2>/dev/null + + if [[ $mode = i ]] || [[ $mode = b ]]; then + echo "========================================================================" + echo "|> Spatially enable database" + echo "========================================================================" + echo " Most of Db2's Spatial Analytics administration is handled by a set of " + echo " stored procedures. User friendly mechanisms for calling these" + echo " stored procedures is provided via the command line tool db2se. " + echo " You will have access to these tools once Spatial Analytics is enabled." + echo " " + echo " The first step that must be performed on every database that you want to" + echo " store spatial data in is to spatially enable the database. Spatially " + echo " enabling your database creates the infrastructure to " + echo " perform all spatial tasks. The spatially enabling step creates all of" + echo " the spatial types, some spatial routines, spatial administrative" + echo " stored procedures, and the spatial catalog." + echo " " + echo " For syntax help on using db2se, typing db2se -h will give you usage" + echo " options." + echo " " + echo "------------------------------------------------------------------------" + echo " " + echo " Spatially enabling database" $db_name ". Please wait..." + fi + + log db2 CONNECT TO $db_name + rc_connect=$? + +if [[ $rc_connect = 0 ]] ; then + # Successful connection - run the script + log db2 "CALL SYSPROC.SYSINSTALLOBJECTS('GEO', 'C', NULL, NULL)" + rc=$? + if [[ $rc = 0 ]] ; then + showlog_pause + else + echo "* Spatially enabling the database " $db_name " was not successful:" + showlog + + # not successful + return 1 + fi + + # Make sure db2se will work + echo " Re-running a bind to make sure db2se works." + log db2 "bind $DB2PATH/bnd/@db2gse.lst" + rc=$? + if [[ $rc = 0 || $rc = 2 ]] ; then + showlog_pause + else + echo "* Binding db2se in database " $db_name " was not successful:" + showlog + + # not successful + return 1 + fi + + else + echo "* Could not connect to " $db_name ":" + showlog + + # not successful + return 1 + fi + + return 0 +} #//end of enable_db function + + +#===================================================================== +# Name: create_tables +# Purpose: Create tables +#===================================================================== +function create_tables { + # Input Parameters + # $1 => mode + # $2 => db_name + # typeset declares local function variables + typeset mode=$1 + typeset db_name=$2 + typeset rc_connect='' + typeset rc='' + + # Init log file + outfile=~/tmp/create_tables.out + rm -f $outfile 2>/dev/null + + if [[ $mode = i ]] || [[ $mode = b ]]; then + echo "========================================================================" + echo "|> Create tables for Banking Demo" + echo "========================================================================" + echo " The definition for the tables is located in saBankDemoDDL.db2." + echo " All the tables are created in the sa_demo schema." + echo " Name Description" + echo " ----------- -----------------------------------------------------" + echo " Customers Information about each customer" + echo " Branches Information about each bank branch office" + echo " Accounts Information about the customers checking & saving accounts" + echo " Transactions Information about each banking transaction a customer makes" + echo + echo "------------------------------------------------------------------------" + echo "db2 connect to" $db_name " Please wait ..." + fi + + log db2 CONNECT TO $db_name + rc_connect=$? + + if [[ $rc_connect = 0 ]] ; then + # Successful connection - run the script + log db2 -tvf $SCRIPTDIR/saBankDemoDDL.db2 + rc=$? + + if [[ $rc = 0 ]] ; then + showlog_pause + else + echo "* Create tables for Banking Demo not successful:" + showlog + + # not successful + return 1 + fi + else + echo "* Could not connect to " $db_name ":" + showlog + + # not successful + return 1 + fi + + return 0 +} #//end of create_tables function + + + +#===================================================================== +# Name: insert_data +# Purpose: Insert non-spatial data. +#===================================================================== +function insert_data { + # Input Parameters + # $1 => mode + # $2 => db_name + # typeset declares local function variables + typeset mode=$1 + typeset db_name=$2 + typeset rc='' + typeset rc_connect='' + + # Init log file + outfile=~/tmp/insert_data.out + rm -f $outfile 2>/dev/null + + if [[ $mode = i ]] || [[ $mode = b ]]; then + echo "========================================================================" + echo "|> Populate tables with records" + echo "========================================================================" + echo " This step is going to insert data into the previously created tables." + echo "------------------------------------------------------------------------" + echo "db2 connect to" $db_name " Please wait ..." + fi + + log db2 connect to $db_name + rc_connect=$? + + if [[ $rc_connect = 0 ]] ; then + # Successful connection - run the script + log db2 -tvf $SCRIPTDIR/saBankDemoTableData.db2 + rc=$? + + if [[ $rc = 0 ]] ; then + showlog_pause + else + echo "* Populate tables not successful:" + showlog + + # not successful + return 1 + fi + else + echo "* Could not connect to " $db_name ":" + showlog + + # not successful + return 1 + fi + + return 0 +} #//end of insert_data function + + + +#===================================================================== +# Name: add_spatial_column +# Purpose: Alter tables and add spatial column +#===================================================================== +function add_spatial_column { + # Input Parameters + # $1 => mode + # $2 => db_name + # typeset declares local function variables + typeset mode=$1 + typeset db_name=$2 + + typeset rc_connect='' + typeset rc_customers=''; typeset rc_branches='' + + # Init log file + outfile=~/tmp/add_spatial_column.out + rm -f $outfile 2>/dev/null + + if [[ $mode = i ]] || [[ $mode = b ]]; then + echo "========================================================================" + echo "|> Add spatial column to business tables" + echo "========================================================================" + echo " There are 13 spatial types that comply to the OGC and SQL/MM object" + echo " hierarchy. The spatial types are all part of the SYSIBM schema. The" + echo " spatial types are of type BLOB(4M) that are created during" + echo " the spatial enable database step. These spatial types can be used just" + echo " like any other SQL data types." + echo + echo " In the following step, we are going to alter the customers and branches" + echo " tables and add a spatial column to store the location of customers and" + echo " branches." + echo + echo "------------------------------------------------------------------------" + echo + echo "Adding spatial columns to business tables. Please wait ..." + fi + + log db2 connect to $db_name + rc_connect=$? + + if [[ $rc_connect = 0 ]] ; then + # Successful connection + log db2 "ALTER TABLE sa_demo.customers ADD COLUMN location ST_Point" + rc_customers=$? + + log db2 "ALTER TABLE sa_demo.branches ADD COLUMN location ST_Point" + rc_branches=$? + + showlog_pause + else + echo "* Could not connect to " $db_name ":" + showlog + return 1 + fi + + if [[ $rc_customers = 0 ]] && [[ $rc_branches = 0 ]] ; then + return 0 + else + return 1 + fi +} #//end of add_spatial_column function + + + +#===================================================================== +# Name: check_srs +# Purpose: Checks if an appropriate spatial reference system exists +#===================================================================== +function check_srs { + # Input Parameters + # $1 => mode + # $2 => db_name + # typeset declares local function variables + typeset mode=$1 + typeset db_name=$2 + typeset rc_info=''; typeset rc_connect='' + + # Init log file + outfile=~/tmp/check_srs.out + rm -f $outfile 2>/dev/null + + if [[ $mode = i ]] || [[ $mode = b ]]; then + echo "========================================================================" + echo "|> Check spatial reference system" + echo "========================================================================" + echo " A spatial reference system defines the spatial domain and precision" + echo " of the spatial data being stored in a column. The spatial domain " + echo " consists of the maximum possible spatial extent of your coordinate" + echo " values and the coordinate system associated with the spatial data." + echo + echo " The spatial extent is defined by X, Y, Z, and M offset values. The " + echo " coordinate system geo-references your data in space. It defines the" + echo ' origin, units and possibly a projection used (only for projected' + echo ' coordinate systems). For performance reasons, Db2 SA internally ' + echo " stores all spatial data as positive integer values. When you " + echo " define your spatial extent, you must consider your minimum and maximum " + echo ' X, Y (and Z, M) values, and provide offsets so that all your values' + echo " can be converted to positive numbers in the coordinate space. The " + echo " conversions are only for internal purposes and handled automatically " + echo " once they are set." + echo + echo " db2se shape_info command can help you determine the spatial extent" + echo " of a shapefile and possibly the coordinate system if a *.prj file" + echo " exists." + echo + echo " The spatial precision for your data is defined by the X, Y, Z, and M " + echo " scale factors. The spatial precision also factors into the spatial" + echo " extent. The spatial precision is reversely proportional to the" + echo " spatial extent. As the spatial precision goes up (you can " + echo " store more precise values) the size of your extent goes down (you" + echo " have a smaller extent). Conversely, as spatial precision does down" + echo " your extent goes up. Therefore, the spatial precision defines the" + echo " upper limit of your spatial extent, the max X, Y and Z (and M)." + echo + echo "For more information, please refer to the User's Guide chapter " + echo "\"Setting up spatial resources for a database\"." + echo + echo "The following are the commands associated with spatial systems:" + echo " db2se create_cs [-h]" + echo " db2se alter_cs [-h]" + echo " db2se drop_cs [-h]" + echo " db2se create_srs [-h]" + echo " db2se alter_srs [-h]" + echo " db2se drop_srs [-h]" + echo + echo "In this step we are going to use db2se shape_info to get information" + echo "about a shapefile and in particular determine if there is an " + echo "existing spatial reference system that can contain the spatial data." + echo "------------------------------------------------------------------------" + echo + echo "db2 connect to" $db_name ". Please wait ..." + fi + + log db2 connect to $db_name + rc_connect=$? + + if [[ $rc_connect = 0 ]] ; then + # Successful connection + + log db2se shape_info -fileName $SCRIPTDIR/../data/cityLimits -database $db_name -sa 1 + rc_info=$? + + showlog_pause + else + echo "* Could not connect to " $db_name ":" + showlog + return 1 + fi + + if [[ $rc_info = 0 ]] ; then + return 0 + else + return 1 + fi +} #//end of check_srs function + + +#===================================================================== +# Name: populate_location +# Purpose: Setup geocoding and auto_gc for customers and branches table +#===================================================================== +function populate_location { + # Input Parameters + # $1 => mode + # $2 => db_name + # typeset declares local function variables + typeset mode=$1 + typeset db_name=$2 + + typeset rc_register_gc1=0 ; typeset rc_auto_gc1=0 + typeset rc_register_gc2=0 ; typeset rc_auto_gc2=0 + typeset rc_cp_ref=0 ; typeset rc_cp_loc=0 + + # Init log file + outfile=~/tmp/populate_location.out + rm -f $outfile 2>/dev/null + + echo "========================================================================" + echo "|> Set location column from latitude and longitude values" + echo "========================================================================" + + log db2 "update sa_demo.customers set location = st_point(longitude, latitude, 1)" + rc_auto_gc1=$? + + log db2 "update sa_demo.branches set location = st_point(longitude, latitude, 1)" + rc_auto_gc2=$? + + showlog_pause + + if [[ $rc_auto_gc1 = 0 ]] && [[ $rc_auto_gc2 = 0 ]] ; then + return 0 + else + return 1 + fi +} #//end of populate_location function + + +#===================================================================== +# Name: geo_queries +# Purpose: Basic spatial queries with customer and branch +# data +#===================================================================== +function geo_queries { + # Input Parameters + # $1 => mode + # $2 => db_name + # typeset declares local function variables + typeset mode=$1 + typeset db_name=$2 + + typeset rc_connect=''; typeset rc_function_path='' + typeset rc_query1=''; typeset rc_query2=''; typeset rc_query3=''; + + # Init log file + outfile=~/tmp/geo_queries.out + rm -f $outfile 2>/dev/null + + if [[ $mode = i ]] || [[ $mode = b ]]; then + echo "========================================================================" + echo "|> Basic spatial queries with customer and branch data" + echo "========================================================================" + echo " In this step you will have a chance to perform a few basic spatial " + echo " queries." + echo + echo " All the spatial routines are built-in into SYSIBM or SYSPROC function path. " + echo "------------------------------------------------------------------------" + echo + echo "db2 connect to" $db_name " Please wait ..." + fi + + log db2 connect to $db_name + rc_connect=$? + + if [[ $mode = i ]] || [[ $mode = b ]]; then + typeset q3="db2 SELECT c.name AS cust_name, b.name AS branch_name, DECIMAL(st_distance(b.location, c.location, 'KILOMETER'), 6, 2) AS distance FROM sa_demo.branches b, sa_demo.customers c WHERE st_distance(b.location, c.location, 'KILOMETER') < 1 ORDER BY distance" + + PS3='Basic Query? ' + select choice in \ + 'describe branches table', \ + 'view branches location coordinates', \ + 'find branch customers within 1 kilometer of my branches' \ + 'continue demo' + do + case $REPLY in + 1 ) db2 DESCRIBE TABLE sa_demo.branches ;; + 2 ) db2 'SELECT name, VARCHAR(ST_AsText(location), 50) FROM sa_demo.branches' ;; + 3 ) $q3 ;; + 4 ) break ;; + * ) echo "Please select a number 1-4 or ENTER to see the menu" ;; + esac + done + + press_any_key_to_continue + fi + + return 0 +} #//end of geo_queries function + + +#===================================================================== +# Name: import_shapefiles +# Purpose: Template to use for the rest of the functions +#===================================================================== +function import_shapefiles { + # Input Parameters + # $1 => mode + # $2 => db_name + # typeset declares local function variables + typeset mode=$1 + typeset db_name=$2 + + typeset rc_city=''; typeset rc_main=''; typeset rc_zip='' + typeset rc_census=''; typeset rc_sales='' + + # Init temporary log file + outfile=~/tmp/import_shapefiles.tmp + + # Init log file + outfile1=~/tmp/import_shapefiles.out + rm -f $outfile1 2>/dev/null + + if [[ $mode = i ]] || [[ $mode = b ]]; then + echo "========================================================================" + echo "|> Import Reference and Demographic Census Shapefiles" + echo "========================================================================" + echo " Many data providers and GIS products can produce shapefiles. Db2" + echo " provides a set of spatial data CD's with sample spatial data in " + echo " shapefile format." + echo + echo " In this step we will import a set of shapefiles. The shapefiles " + echo " contain census demographic data and spatial background data. The " + echo " spatial background data helps reference your data when viewing it on" + echo " a map." + echo + echo " When you import shapefile data you need to provide a spatial reference" + echo " system that the spatial data is going to belong to. For this example" + echo " we are going to use spatial reference system NAD83_SRS_1. " + echo + echo " When you spatial data via db2se you can also specify whether you want" + echo " Spatial Extender to look for the file on the client or server " + echo " filesystem via the createTableFlag option." + echo + echo " When you import shapefiles you can optionally create two other files" + echo " an exception and message file. The message file contains a status " + echo " of the import process and provides information about how many shapes" + echo " were imported. It also says whether a block of shapes failed. If it" + echo " fails it writes the block of shapes out the exception file. Note, " + echo " the block is defined by the commit scope and if within that block there" + echo " is one invalid shape the entire block is rejected. If this happens" + echo " import the exception file with a small commit scope to identify the " + echo " shape that is failing." + echo "------------------------------------------------------------------------" + echo " Please wait - this operation might take several minutes to complete." + echo + fi + + file1=~/tmp/parcels + do_import cityLimits city_limits $file1 1 200 $db_name + rc_city=$? + + file2=~/tmp/main_streets + do_import sjMainStreets sj_main_streets $file2 1 200 $db_name + rc_main=$? + + file3=~/tmp/zip_codes + do_import sjZipCodes sj_zipcodes $file3 1 200 $db_name + rc_zip=$? + + file4=~/tmp/census + do_import sjCensusBlocks sj_census_blocks $file4 1 200 $db_name + rc_census=$? + + file5=~/tmp/sales + do_import salezones sales_regions $file5 0 200 $db_name + rc_sales=$? + + if [[ $mode = i ]] || [[ $mode = b ]]; then + press_any_key_to_continue + fi + + outfile=$outfile1 + + if [[ $rc_city = 0 ]] && [[ $rc_main = 0 ]] && [[ $rc_zip = 0 ]] && \ + [[ $rc_census = 0 ]] && [[ $rc_sales = 0 ]] ; then + return 0 + else + return 1 + fi +} #//end of import_shapefiles function + + +#===================================================================== +# Name: do_import (called by imp_shape) +# Purpose: Imports a shapefile and prints/logs the results. +# Input: $1 => shapefile name +# $2 => table name +# $3 => exception (.shp) and message (.msg) files name +# $4 => if 1 then an id_column with name SA_ROW_ID is created +# otherwise, no id_column +# $5 => commitScope +# $6 => db_name +# Global vars: +# $outfile => temporary log file +# $outfile1 => permanent log file +# $db_name => database name +# Returns: return code of import command +#===================================================================== +function do_import { + typeset id_col=''; typeset rc=''; typeset line='' + typeset db_name=$6 + + if [[ $4 = 1 ]]; then + id_col="-idColumn sa_row_id -idColumnIsIdentity 1" + fi + SHAPEDIR=$(cd $SCRIPTDIR; cd ..; cd data; echo $PWD) + + # Prepare the command line + line="db2se import_shape $db_name -sa 1 -client 1" + line="$line -fileName $SHAPEDIR/$1" + line="$line -srsName NAD83_SRS_1 -tableSchema sa_demo" + line="$line -tableName $2" + line="$line -spatialcolumn geometry -createTableFlag 1 -commitScope $5" + line="$line $id_col" + line="$line -exceptionFile $3.shp" + line="$line -messagesFile $3.msg" + + # Run import, then show and log results + rm -f $outfile $3.shp $3.msg 2>/dev/null + log2 $line + rc=$? + + showlog + + echo $line >>$outfile1 + echo " " >>$outfile1 + cat $outfile >>$outfile1 2>/dev/null + echo " " >>$outfile1 + + return $rc +} #//end of do_import function + + +#===================================================================== +# Name: create_views +# Purpose: Template to use for the rest of the functions +#===================================================================== +function create_views { + # Input Parameters + # $1 => mode + # $2 => db_name + # typeset declares local function variables + typeset mode=$1 + typeset db_name=$2 + + typeset rc_connect=1; typeset rc=1 + + # Init log file + outfile=~/tmp/create_views.out + rm -f $outfile 2>/dev/null + + if [[ $mode = i ]] || [[ $mode = b ]]; then + echo "========================================================================" + echo "|> Create Views" + echo "========================================================================" + echo " This step is going to create a series of views that could be used " + echo " by a geobrowser to visualize the spatial analysis performed by the " + echo " query." + echo + echo " The views are defined in the file saBankDemoViewDDL.db2" + echo + echo " For more information about creating views refer to the Db2 SQL " + echo " reference book." + echo "------------------------------------------------------------------------" + echo + echo " Creating the views. Please wait ..." + fi + + log db2 connect to $db_name + rc_connect=$? + + if [[ $rc_connect = 0 ]] ; then + # Successful connection + log db2 -tvf $SCRIPTDIR/../bank/saBankDemoViewDDL.db2 + rc=$? + + if [[ $rc = 0 ]] ; then + showlog_pause + else + echo "* Db2 Spatial View Creation not successful:" + showlog + + # not successful + return 1 + fi + else + echo "* Could not connect to " $db_name ":" + showlog + + # not successful + return 1 + fi + + if [[ $rc = 0 ]] ; then + return 0 + else + return 1 + fi +} #//end of create_views function + + +#===================================================================== +# Name: register_spatial_columns +# Purpose: Register the spatial columns created in tables and view +# by this demo. +#===================================================================== +function register_spatial_columns { +# Input Parameters +# $1 => mode +# $2 => db_name + + typeset mode=$1 + typeset db_name=$2 + + typeset rc_register1=''; typeset rc_register2=''; typeset rc_register3=''; + typeset rc_register4=''; typeset rc_register5=''; typeset rc_register6=''; + typeset rc_register7=''; + + # Init log file + outfile=~/tmp/register_spatial_columns.out + rm -f $outfile 2>/dev/null + + if [[ $mode = i ]] || [[ $mode = b ]]; then + echo "========================================================================" + echo "|> Register Spatial Columns" + echo "========================================================================" + echo " Spatial Analytics allows you to create a constraint on a spatial" + echo " column that enforces the constraint that all spatial data in the " + echo " column must belong to the same spatial reference system." + echo + echo " Many spatial visualization tools require that all the spatial data" + echo " in one column being visualized belong to the same spatial reference " + echo " system." + echo + echo " For more information about registering spatial columns refer to " + echo " chapter \"Setting up spatial columns\" in the User's Guide." + echo "------------------------------------------------------------------------" + echo + echo " Registering spatial columns. Please wait ..." + fi + + log db2se register_spatial_column $db_name -tableSchema SA_DEMO \ + -tableName BRANCHES -columnName LOCATION -srsName NAD83_SRS_1 -sa 1 + rc_register1=$? + + log db2se register_spatial_column $db_name -tableSchema SA_DEMO \ + -tableName CUSTOMERS -columnName LOCATION -srsName NAD83_SRS_1 -sa 1 + rc_register2=$? + + log db2se register_spatial_column $db_name -tableSchema SA_DEMO \ + -tableName CITY_LIMITS -columnName GEOMETRY -srsName NAD83_SRS_1 -sa 1 + rc_register3=$? + + log db2se register_spatial_column $db_name -tableSchema SA_DEMO \ + -tableName SALES_REGIONS -columnName GEOMETRY -srsName NAD83_SRS_1 -sa 1 + rc_register4=$? + + log db2se register_spatial_column $db_name -tableSchema SA_DEMO \ + -tableName SJ_CENSUS_BLOCKS -columnName GEOMETRY -srsName NAD83_SRS_1 -sa 1 + rc_register5=$? + + log db2se register_spatial_column $db_name -tableSchema SA_DEMO \ + -tableName SJ_MAIN_STREETS -columnName GEOMETRY -srsName NAD83_SRS_1 -sa 1 + rc_register6=$? + + log db2se register_spatial_column $db_name -tableSchema SA_DEMO \ + -tableName SJ_ZIPCODES -columnName GEOMETRY -srsName NAD83_SRS_1 -sa 1 + rc_register7=$? + + showlog_pause + + if [[ $rc_register1 = 0 ]] && [[ $rc_register2 = 0 ]] && \ + [[ $rc_register3 = 0 ]] && [[ $rc_register4 = 0 ]] && \ + [[ $rc_register5 = 0 ]] && [[ $rc_register6 = 0 ]] && \ + [[ $rc_register7 = 0 ]] ; then + return 0 + else + return 1 + fi +} #//end of register_spatial_columns function + + +#===================================================================== +# Name: press_any_key_to_continue +# Purpose: Pause before starting next part of demo +#===================================================================== +function press_any_key_to_continue { + # typeset declares local function variables + typeset ans='' + echo ; echo "<> Press RETURN to continue..." + read ans +} #//end of press_any_key_to_continue function + + +#===================================================================== +# Name: log +# Purpose: Execute a command and append its output to the file +# indicated by $outfile +# Input: +# $* => the command +#===================================================================== +function log { + echo "$*" >>$outfile + $* >>$outfile 2>&1 + return $? +} + + +#===================================================================== +# Name: log2 +# Purpose: Echo a command to stdout immediately, then execute it and +# append its output to the file indicated by %log% +# Input: +# $* => the command +#===================================================================== +function log2 { + if [[ $mode = i ]] || [[ $mode = b ]]; then + echo "$*" + fi + $* >>$outfile 2>&1 + return $? +} + + +#===================================================================== +# Name: showlog +# Purpose: If $mode is b or i, then sends the file specified by +# $outfile to the standard output -- no pause afterwards. +# Input: +# $mode (must be b or i for the log to go to stdout) +#===================================================================== +function showlog { + if [[ $mode = i ]] || [[ $mode = b ]]; then + echo ; cat $outfile 2>/dev/null ; echo + fi +} + + +#===================================================================== +# Name: showlog_pause +# Purpose: If $mode is b or i, then sends the file specified by +# $outfile to the standard output, then pauses. +# Input: +# $mode (must be b or i for the log to go to stdout) +#===================================================================== +function showlog_pause { + if [[ $mode = i ]] || [[ $mode = b ]]; then + echo ; cat $outfile 2>/dev/null ; echo + press_any_key_to_continue + fi +} + + +#===================================================================== +# Name: loglog +# Purpose: Appends a timestamp and current file $1 to main log file $2 +# Input: +# $1 => current file +# $2 => main log file +#===================================================================== +function loglog { + if [[ -n $2 ]] ; then + echo "##############################################################" >>$2 + echo "`date` - $1" >>$2 + echo "##############################################################" >>$2 + cat $1 >>$2 2>/dev/null + echo " " >>$2 + fi +} + + +#===================================================================== +# Name: usage +# Purpose: Echoes on stdout a command help message. +#===================================================================== +function usage { + echo "Usage: saBankDemoRunBankDemo -i | -n | -c | -b | -h [-a] []" + echo " -i = interactive mode (the default mode)" + echo " -n = non-interactive mode: runs all the sample steps without" + echo " prompting the user" + echo " -c = installation confirmation test" + echo " -b = basic mode: creates database, tables, and inserts non-spatial data" + echo " -h = help: prints this usage message" + echo " -a = configure instance as warehouse (analytics)" + echo " The default database name is sa_bank." + echo +} + + +#===================================================================== +# Name: scripterr +# Purpose: Called whenever an error occurs +#===================================================================== +function scripterr { + # may do some cleanup here ... + if [[ $mode = c ]] ; then + echo "Db2 SA failed the confirmation test" + fi + exit 1 +} + +#===================================================================== +# Name: returncodes +# Purpose: Called when we are done with everything +#===================================================================== +function returncodes { + echo "Function return codes:" + echo "create_db : $rc_create_db" + echo "update_cfg : $rc_update_cfg" + echo "setup_db : $rc_setup_db" + echo "enable_db : $rc_enable_db" + echo "create_tables : $rc_create_tables" + echo "insert_data : $rc_insert_data" + echo "add_spatial_column : $rc_add_spatial_column" + echo "chk_srs : $rc_check_srs" + echo "populate_location : $rc_populate_location" + echo "geo_queries : $rc_geo_queries" + echo "import_shapefiles : $rc_import_shapefiles" + echo "create_views : $rc_create_views" + echo "register_spatial_columns: $rc_register_spatial_columns" + echo "Please check logfiles in ~/tmp/ for details." +} + +#--------------------------------------------------------------------- +# Main script +#--------------------------------------------------------------------- +# Check environment +# Check environment +if [[ -z $DB2PATH ]] ; then + # Must have DB2PATH set + echo "Please set the DB2PATH environment variable to point to the" + echo "sqllib directory of your Db2 installation." + echo "Example: export DB2PATH=~/sqllib" + exit 1 +fi + + +export SCRIPTDIR=$(cd $(dirname $0);echo $PWD) +echo "Instance found in $DB2PATH" +echo "Working from $SCRIPTDIR" + +# Handle options and arguments +mode=0 +let number_of_options=0 +analytics=0 + +while getopts ":incbha" opt; do + # counter keeps track how many options are specified + ((number_of_options= number_of_options + 1)) + + # set the correction more for the various options + case $opt in + i) mode=i ;; + n) mode=n ;; + c) mode=c ;; + b) mode=b ;; + a) analytics=1 ;; + \?) usage + exit 1 ;; + *) usage + exit 1 ;; + esac +done +shift $(($OPTIND - 1)) + +if ((number_of_options == 0)); then + #Default mode is (i)nteractive + mode=i +fi + +# Make sure that 1 or less arguments are specified +if (($# > 1)); then + usage + echo "You can only specify one argument after the options, and you specified" + echo " " $# "arguments: " $@ + exit 1 +fi + +# Set the first argument as the database name +database_name=$1 + +# If database_name is null then set it to default of se_bank +database_name=${database_name:=sa_bank} + + +#--------------------------------------------------------------------- +# Start demo +#--------------------------------------------------------------------- +rc_create_db=0; rc_update_cfg=0; rc_setup_db=0; rc_enable_db=0; +rc_create_tables=0; rc_insert_data=0; rc_add_spatial_column=0; +rc_check_srs=0; rc_setup_geocoder=0; rc_run_geocoder=0; +rc_geo_queries=0; rc_import_shapefiles=0; +rc_create_views=0; rc_register_spatial_columns=0; rc_db2set=0 + + +# create the directory to write the output to +mkdir -m 755 ~/tmp 2>/dev/null + +# Init and timestamp the log file +logg=~/tmp/${database_name}.log +rm -f $logg >/dev/null 2>&1 +echo "`date` - seBankDemoRunBankDemo starting..." >>$logg +outfile=~/tmp/create_db.out + +# If warehouse instance was specified set registry. +if [[ $analytics -eq 1 ]] ; then + echo "Setting up warehouse environment ..." + log db2set DB2_WORKLOAD=ANALYTICS + rc_db2set=$? + [[ $mode != c ]] && ([[ $rc_db2set -eq 0 ]] || scripterr) +fi + +# start the database instance +db2start + +# Create and configure the database, create tables and insert +# non-spatial data +create_db $mode $database_name ; rc_create_db=$? +loglog $outfile $logg +[[ $mode != c ]] && ([[ $rc_create_db -eq 0 ]] || scripterr) + +# we no longer need to update the configuration +# update_cfg $mode $database_name ; rc_update_cfg=$? +loglog $outfile $logg +[[ $mode != c ]] && ([[ $rc_update_cfg -eq 0 ]] || scripterr) + + +if [[ $analytics -eq 0 ]] ; then + setup_db $mode $database_name ; rc_setup_db=$? + loglog $outfile $logg + [[ $mode != c ]] && ([[ $rc_setup_db -eq 0 ]] || scripterr) +fi + +enable_db $mode $database_name ; rc_enable_db=$? +loglog $outfile $logg +[[ $mode != c ]] && ([[ $rc_enable_db -eq 0 ]] || scripterr) + +create_tables $mode $database_name ; rc_create_tables=$? +loglog $outfile $logg +[[ $mode != c ]] && ([[ $rc_create_tables -eq 0 ]] || scripterr) + +insert_data $mode $database_name ; rc_insert_data=$? +loglog $outfile $logg +[[ $mode != c ]] && ([[ $rc_insert_data -eq 0 ]] || scripterr) + +if [[ $mode = i ]] || [[ $mode = n ]] || [[ $mode = c ]]; then + add_spatial_column $mode $database_name ; rc_add_spatial_column=$? + loglog $outfile $logg + [[ $mode != c ]] && ([[ $rc_add_spatial_column -eq 0 ]] || scripterr) + + check_srs $mode $database_name ; rc_check_srs=$? + loglog $outfile $logg + [[ $mode != c ]] && ([[ $rc_check_srs -eq 0 ]] || scripterr) + + populate_location $mode $database_name ; rc_populate_location=$? + loglog $outfile $logg + [[ $mode != c ]] && ([[ $rc_populate_location -eq 0 ]] || scripterr) + + if [[ $mode = i ]] ; then + # Run queries only in interactive mode + geo_queries $mode $database_name ; rc_geo_queries=$? + loglog $outfile $logg + [[ $mode != c ]] && ([[ $rc_geo_queries -eq 0 ]] || scripterr) + fi + + typeset file1=''; typeset file2=''; typeset file3='' + typeset file4=''; typeset file5='' + import_shapefiles $mode $database_name ; rc_import_shapefiles=$? + loglog $outfile $logg + # copy msg and exp files to the main log + [[ -f ${file1}.msg ]] && loglog ${file1}.msg $logg + [[ -f ${file2}.msg ]] && loglog ${file2}.msg $logg + [[ -f ${file3}.msg ]] && loglog ${file3}.msg $logg + [[ -f ${file4}.msg ]] && loglog ${file4}.msg $logg + [[ -f ${file5}.msg ]] && loglog ${file5}.msg $logg + [[ $mode != c ]] && ([[ $rc_import_shapefiles -eq 0 ]] || scripterr) + + create_views $mode $database_name ; rc_create_views=$? + loglog $outfile $logg + [[ $mode != c ]] && ([[ $rc_create_views -eq 0 ]] || scripterr) + + register_spatial_columns $mode $database_name ; rc_register_spatial_columns=$? + loglog $outfile $logg + [[ $mode != c ]] && ([[ $rc_register_spatial_columns -eq 0 ]] || scripterr) +fi + +if [[ $rc_create_db -eq 0 ]] && [[ $rc_update_cfg -eq 0 ]] && \ + [[ $rc_setup_db -eq 0 ]] && [[ $rc_enable_db -eq 0 ]] && \ + [[ $rc_create_tables -eq 0 ]] && [[ $rc_insert_data -eq 0 ]] && \ + [[ $rc_add_spatial_column -eq 0 ]] && [[ $rc_check_srs -eq 0 ]] && \ + [[ $rc_populate_location -eq 0 ]] && \ + [[ $rc_geo_queries -eq 0 ]] && [[ $rc_import_shapefiles -eq 0 ]] && \ + [[ $rc_create_views -eq 0 ]] && \ + [[ $rc_register_spatial_columns -eq 0 ]] ; then + + if [[ $mode = c ]] ; then + echo "Db2 Spatial Analytics ran the confirmation test successfully." + returncodes + else + echo "DB2 Spatial Analytics test has finished successfully." + returncodes + fi + +else + + if [[ $mode = c ]] ; then + echo "Db2 Spatial Analytics failed the confirmation test." + returncodes + else + echo "Db2 Spatial Analytics terminated with errors." + returncodes + fi + exit 1 +fi +exit 0 + +#********************************************************************** +# End of Db2 Spatial Extender sample 'saBankDemoRunBankDemo' +#********************************************************************** diff --git a/spatial/bank/saBankDemoSpatialSQL.db2 b/spatial/bank/saBankDemoSpatialSQL.db2 new file mode 100644 index 0000000..5d1c53f --- /dev/null +++ b/spatial/bank/saBankDemoSpatialSQL.db2 @@ -0,0 +1,1424 @@ +---------------------------------------------------------------------------- +-- Licensed Materials - Property of IBM +-- Governed under the terms of the IBM Public License +-- +-- (C) COPYRIGHT International Business Machines Corp. 2000 - 2014 +-- All Rights Reserved. +-- +-- US Government Users Restricted Rights - Use, duplication or +-- disclosure restricted by GSA ADP Schedule Contract with IBM Corp. +---------------------------------------------------------------------------- +-- +-- Component Name: Db2 Spatial Analytics v11.5 +-- +-- Source File Name: saBankDemoSpatialSQL.db2 +-- +-- Version: 11.5.6+ +-- +-- Description: examples spatial routines +-- unless specified geometries use the default SRSID of 4326 (WGS-84). +-- +-- For more information about the Db2 Spatial Analytics Bank Demo scripts, +-- see the saBankDemoREADME.txt file. +-- +-- For more information about Db2 Spatial Analytics component, refer to the +-- documentation at +-- https://www.ibm.com/docs/en/db2/11.5?topic=data-db2-spatial-analytics. +-- +-- For the latest information on Db2 refer to the Db2 website at +-- https://www.ibm.com/analytics/db2. +---------------------------------------------------------------------------- +--connect to sa_bank; + +--=============================================================== +-- ST_Area(geometry) +--=============================================================== +--!db2se drop_srs sa_bank -srsName new_york1983 -sa 1; + +--!db2se create_srs sa_bank -srsId 4000 -srsName new_york1983 -xOffset 0 -yOffset 0 -xScale 1 -yScale 1 -coordsysName NAD_1983_StatePlane_New_York_East_FIPS_3101_Feet -sa 1; + +--DROP TABLE sample_polygons; +--CREATE TABLE sample_polygons (id SMALLINT, geometry ST_POLYGON); + +--INSERT INTO sample_polygons (id, geometry) +--VALUES +-- (1, ST_Polygon('polygon((0 0, 0 10, 10 10, 10 0, 0 0))', 4000) ), +-- (2, ST_Polygon('polygon((20 0, 30 20, 40 0, 20 0 ))', 4000) ), +-- (3, ST_Polygon('polygon((20 30, 25 35, 30 30, 20 30))', 4000)); + +--SELECT id, ST_Area(geometry) AS area +--FROM sample_polygons; + +----The following does the same as the above only with method notation +--SELECT id, ST_AREA(geometry) AS area +--FROM sample_polygons; + +--SELECT id, +-- ST_Area(geometry) square_feet, +-- ST_Area(geometry, 'METER') square_meters, +-- ST_Area(geometry, 'STATUTE MILE') square_miles +--FROM sample_polygons; + +--=============================================================== +-- ST_AsBinary(geometry) +--=============================================================== +--DROP TABLE sample_points; +--CREATE TABLE sample_points(id SMALLINT, geometry ST_POINT, wkb BLOB(32k)); + +--INSERT INTO sample_points(id, geometry) +--VALUES +-- (1100, ST_Point(10, 20, 1)); + +--INSERT INTO sample_points(id, wkb) +--VALUES (2222, +-- (SELECT ST_AsBinary(geometry) +-- FROM sample_points +-- WHERE id = 1100)); + +--SELECT id, cast(ST_AsText(ST_Point(wkb)) AS varchar(35)) AS point +--FROM sample_points +--WHERE id = 2222; + +--SELECT id, substr(ST_AsBinary(geometry), 1, 21) AS point_wkb +--FROM sample_points +--WHERE id = 1100; + +--=============================================================== +-- ST_AsGML(geometry) +--=============================================================== +--DROP TABLE sample_points; +--CREATE TABLE sample_points(id SMALLINT, geometry ST_POINT, gml CLOB(32K)); + +--INSERT INTO sample_points(id, geometry) +--VALUES +-- (1100, ST_Point(10, 20, 1)); + +--INSERT INTO sample_points(id, gml) +--VALUES (2222, +-- (SELECT ST_AsGML(geometry) +-- FROM sample_points +-- WHERE id = 1100)); + +--SELECT id, cast(ST_AsGML(geometry) AS varchar(110)) AS gml_fragment +--FROM sample_points +--WHERE id = 1100; + +--=============================================================== +-- ST_AsShape(geometry) +--=============================================================== +--DROP TABLE sample_points; +--CREATE TABLE sample_points(id SMALLINT, geometry ST_POINT, shape BLOB(32K)); + +--INSERT INTO sample_points(id, geometry) +--VALUES +-- (1100, ST_Point(10, 20, 1)); + +--INSERT INTO sample_points(id, shape) +--VALUES (2222, +-- (SELECT ST_AsShape(geometry) +-- FROM sample_points +-- WHERE id = 1100)); + +--SELECT id, substr(ST_AsShape(geometry), 1, 20) AS shape +--FROM sample_points +--WHERE id = 1100; + +--=============================================================== +-- ST_AsText(geometry) +--=============================================================== +--DROP TABLE sample_geometries; +--CREATE TABLE sample_geometries(id SMALLINT, spatial_type varchar(18), geometry ST_GEOMETRY); + +--INSERT INTO sample_geometries(id, spatial_type, geometry) +--VALUES +-- (1, 'st_point', ST_Point(50, 50) ), +-- (2, 'st_linestring', ST_LineString('linestring(200 100, 210 130, 220 140)') ), +-- (3, 'st_polygon', ST_Polygon('polygon((110 120, 110 140, 130 140, 130 120, 110 120))') ); + +--SELECT id, spatial_type, cast(ST_AsText(geometry) AS varchar(150)) AS wkt +--FROM sample_geometries; + +--=============================================================== +-- ST_AsGeoJSON(geometry) +--=============================================================== +--DROP TABLE sample_geometries; +--CREATE TABLE sample_geometries(id SMALLINT, spatial_type varchar(18), geometry ST_GEOMETRY); + +--INSERT INTO sample_geometries(id, spatial_type, geometry) +--VALUES +-- (1, 'st_point', ST_Point(50, 50) ), +-- (2, 'st_linestring', ST_LineString('linestring(200 100, 210 130, 220 140)') ), +-- (3, 'st_polygon', ST_Polygon('polygon((110 120, 110 140, 130 140, 130 120, 110 120))') ); + +--SELECT id, spatial_type, cast(ST_AsGeoJSON(geometry) AS varchar(150)) AS wkt +--FROM sample_geometries; + +--=============================================================== +-- ST_Buffer(geometry, radius) +-- ST_Buffer(geometry, radius, unit) +--=============================================================== +--!db2se drop_srs sa_bank -srsName new_york1983 -sa 1; + +--!db2se create_srs sa_bank -srsId 4000 -srsName new_york1983 -xOffset 0 -yOffset 0 -xScale 1 -yScale 1 -coordsysName NAD_1983_StatePlane_New_York_East_FIPS_3101_Feet -sa 1; + +--DROP TABLE sample_geometries; +--CREATE TABLE sample_geometries(id INTEGER, spatial_type varchar(18), geometry ST_GEOMETRY); + +--INSERT INTO sample_geometries(id, spatial_type, geometry) +--VALUES +-- (1, 'st_point', ST_Point(50, 50, 4000) ), +-- (2, 'st_linestring', ST_LineString('linestring(200 100, 210 130, 220 140)', 4000) ), +-- (3, 'st_polygon', ST_Polygon('polygon((110 120, 110 140, 130 140, 130 120, 110 120))', 4000) ), +-- (4, 'st_multipolygon', ST_MultiPolygon('multipolygon(( +-- (30 30, 30 40, 35 40, 35 30, 30 30), +-- (35 30, 35 40, 45 40, 45 30, 35 30)))', 4000)); + +--SELECT id, spatial_type, +-- cast(ST_AsText(ST_Buffer(geometry, 10)) AS varchar(470)) AS buffer_10 +--FROM sample_geometries; + +-- Defect -- SQL0440N No authorized routine named "ST_NUMPOLYGONS" of type "FUNCTION" having compatible arguments was found. SQLSTATE=42884 +--SELECT id, spatial_type, +-- cast(ST_AsText(ST_Buffer(geometry, 10)) AS varchar(470)) AS buffer, +-- ST_NumPolygons(ST_Buffer(geometry, 10)) +--FROM sample_geometries +--WHERE id = 4; + +--SELECT id, spatial_type, +-- cast(ST_AsText(ST_Buffer(geometry, -5)) AS varchar(150)) AS buffer_negative_5 +--FROM sample_geometries +--WHERE id = 3; + +--SELECT id, spatial_type, +-- cast(ST_AsText(ST_Buffer(geometry, 10, 'METER')) AS varchar(680)) AS buffer_10_meter +--FROM sample_geometries +--WHERE id = 3; + + +--=============================================================== +-- ST_Contains(geometry, geometry) +--=============================================================== +--DROP TABLE sample_points; +--DROP TABLE sample_lines; +--DROP TABLE sample_polygons; + +--CREATE TABLE sample_points(id SMALLINT, geometry ST_POINT); +--CREATE TABLE sample_lines(id SMALLINT, geometry ST_LINESTRING); +--CREATE TABLE sample_polygons(id SMALLINT, geometry ST_POLYGON); + +--INSERT INTO sample_points (id, geometry) +--VALUES +-- (1, ST_Point(10, 20)), +-- (2, ST_Point('point(41 41)')); + +--INSERT INTO sample_lines (id, geometry) +--VALUES +-- (10, ST_LineString('linestring (1 10, 3 12, 10 10)') ), +-- (20, ST_LineString('linestring (50 10, 50 12, 45 10)') ); + +--INSERT INTO sample_polygons(id, geometry) +--VALUES +-- (100, ST_Polygon('polygon((0 0, 0 40, 40 40, 40 0, 0 0))') ); + +--SELECT poly.id AS polygon_id, +-- CASE ST_Contains(poly.geometry, pts.geometry) +-- WHEN 0 THEN 'does not contain' +-- WHEN 1 THEN 'does contain' +-- END AS contains, +-- pts.id AS point_id +--FROM sample_points pts, sample_polygons poly; + +--SELECT poly.id AS polygon_id, +-- CASE ST_Contains(poly.geometry, line.geometry) +-- WHEN 0 THEN 'does not contain' +-- WHEN 1 THEN 'does contain' +-- END AS contains, +-- line.id AS line_id +--FROM sample_lines line, sample_polygons poly; + +--=============================================================== +-- ST_ConvexHull(geometry) +--=============================================================== +--DROP TABLE sample_geometries; +--CREATE TABLE sample_geometries (id SMALLINT, spatial_type varchar(18), geometry ST_GEOMETRY); + +--INSERT INTO sample_geometries(id, spatial_type, geometry) +--VALUES +-- (1, 'ST_LineString', ST_LineString('linestring(20 20, 30 30, 20 40, 30 50)') ), +-- (2, 'ST_Polygon', ST_Polygon('polygon((110 120, 110 140, 120 130, 110 120))', 0) ), +-- (3, 'ST_Polygon', ST_Polygon('polygon((30 30, 25 35, 15 50, 35 80, 40 85, 80 90, 70 75, 65 70, 55 50, 75 40, 60 30, 30 30))') ), +-- (4, 'ST_MultiPoint', ST_MultiPoint('multipoint(20 20, 30 30, 20 40, 30 50)') ); + +--SELECT id, spatial_type, cast(ST_AsText(ST_ConvexHull(geometry)) AS varchar(300)) AS convexhull +--FROM sample_geometries; + +--=============================================================== +-- ST_Distance(geometry, geometry) +--=============================================================== +--DROP TABLE sample_geometries1; +--DROP TABLE sample_geometries2; +--CREATE TABLE sample_geometries1 (id SMALLINT, spatial_type varchar(13), geometry ST_GEOMETRY); +--CREATE TABLE sample_geometries2 (id SMALLINT, spatial_type varchar(13), geometry ST_GEOMETRY); + +--INSERT INTO sample_geometries1(id, spatial_type, geometry) +--VALUES +-- ( 1, 'ST_Point', ST_Point('point(100 100)', 1) ), +-- (10, 'ST_LineString', ST_LineString('linestring(125 125, 125 175)', 1) ), +-- (20, 'ST_Polygon', ST_Polygon('polygon((50 50, 50 150, 150 150, 150 50, 50 50))', 1) ); + +--INSERT INTO sample_geometries2(id, spatial_type, geometry) +--VALUES +-- (101, 'ST_Point', ST_Point('point(200 200)', 1) ), +-- (102, 'ST_Point', ST_Point('point(200 300)', 1) ), +-- (103, 'ST_Point', ST_Point('point(200 0)', 1) ), +-- (110, 'ST_LineString', ST_LineString('linestring(200 100, 200 200)', 1) ), +-- (120, 'ST_Polygon', ST_Polygon('polygon((200 0, 200 200, 300 200, 300 0, 200 0))', 1) ); + +--SELECT sg1.id AS sg1_id, sg1.spatial_type AS sg1_type, +-- sg2.id AS sg1_id, sg2.spatial_type AS sg2_type, +-- cast(ST_Distance(sg1.geometry, sg2.geometry) AS Decimal(8, 4)) AS distance +--FROM sample_geometries1 sg1, sample_geometries2 sg2 +--ORDER BY sg1.id; + +--SELECT sg1.id AS sg1_id, sg1.spatial_type AS sg1_type, +-- sg2.id AS sg1_id, sg2.spatial_type AS sg2_type, +-- cast(ST_Distance(sg1.geometry, sg2.geometry) AS Decimal(8, 4)) AS distance +--FROM sample_geometries1 sg1, sample_geometries2 sg2 +--WHERE ST_Distance(sg1.geometry, sg2.geometry) <= 100; + +--SELECT sg1.id AS sg1_id, sg1.spatial_type AS sg1_type, +-- sg2.id AS sg1_id, sg2.spatial_type AS sg2_type, +-- cast(ST_Distance(sg1.geometry, sg2.geometry, 'KILOMETER') AS DECIMAL(10, 4)) AS distance +--FROM sample_geometries1 sg1, sample_geometries2 sg2 +--ORDER BY sg1.id; + +--=============================================================== +-- St_FindMeasure(geometry, measure) +--=============================================================== +--DROP TABLE sample_geometries; +--CREATE TABLE sample_geometries (id SMALLINT, geometry ST_GEOMETRY); + +--INSERT INTO sample_geometries(id, geometry) +--VALUES +-- (1, ST_LineString('linestring m (2 2 3, 3 5 3, 3 3 6, 4 4 8)', 1)), +-- (2, ST_MultiPoint('multipoint m (2 2 3, 3 5 3, 3 3 6, 4 4 6, 5 5 6, 6 6 8)', 1)); + +--SELECT id, cast(ST_AsText(ST_FindMeasure(geometry, 7)) AS varchar(45)) AS measure_7 +--FROM sample_geometries; + +--SELECT id, cast(ST_AsText(ST_FindMeasure(geometry, 6)) AS varchar(120)) AS measure_6 +--FROM sample_geometries; + + +--=============================================================== +-- ST_GeomCollection(LOB) +--=============================================================== +--DROP TABLE sample_geomcollections; +--CREATE TABLE sample_geomcollections (id SMALLINT, geometry ST_GEOMCOLLECTION); + +--INSERT INTO sample_geomcollections(id, geometry) +--VALUES +-- (4001, ST_GeomCollection('multipoint(1 2, 4 3, 5 6)', 1) ), +-- (4002, ST_GeomCollection('multilinestring( +-- (33 2, 34 3, 35 6), +-- (28 4, 29 5, 31 8, 43 12), +-- (39 3, 37 4, 36 7))', 1) ), +-- (4003, ST_GeomCollection('multipolygon(((3 3, 4 6, 5 3, 3 3), +-- (8 24, 9 25, 1 28, 8 24), +-- (13 33, 7 36, 1 40, 10 43, 13 33)))', 1)), +-- (4004, ST_GeomCollection('10203040', 1)); + +--SELECT id, cast(ST_AsText(geometry) AS varchar(350)) AS geomcollection +--FROM sample_geomcollections; + +--=============================================================== +-- ST_GeomCollFromTxt(WKT) +--=============================================================== +--DROP TABLE sample_geomcollections; +--CREATE TABLE sample_geomcollections (id SMALLINT, geometry ST_GEOMCOLLECTION); + +--INSERT INTO sample_geomcollections(id, geometry) +--VALUES +-- (4011, ST_GeomCollFromTxt('multipoint(1 2, 4 3, 5 6)', 1) ), +-- (4012, ST_GeomCollFromTxt('multilinestring( +-- (33 2, 34 3, 35 6), +-- (28 4, 29 5, 31 8, 43 12), +-- (39 3, 37 4, 36 7))', 1) ), +-- (4013, ST_GeomCollFromTxt('multipolygon(((3 3, 4 6, 5 3, 3 3), +-- (8 24, 9 25, 1 28, 8 24), +-- (13 33, 7 36, 1 40, 10 43, 13 33)))', 1)); + +--SELECT id, cast(ST_AsText(geometry) AS varchar(340)) AS GeomCollection +--FROM sample_geomcollections; + +--=============================================================== +-- ST_GeomCollFromWKB(WKB) +--=============================================================== +--DROP TABLE sample_geomcollections; +--CREATE TABLE sample_geomcollections (id SMALLINT, geometry ST_GEOMCOLLECTION, wkb BLOB(32k)); + +--INSERT INTO sample_geomcollections(id, geometry) +--VALUES +-- (4021, ST_GeomCollFromTxt('multipoint(1 2, 4 3, 5 6)', 1) ), +-- (4022, ST_GeomCollFromTxt('multilinestring( +-- (33 2, 34 3, 35 6), +-- (28 4, 29 5, 31 8, 43 12))', 1)); + +--UPDATE sample_geomcollections AS temp_correlated +--SET wkb = ST_AsBinary(geometry) +--WHERE id = temp_correlated.id; + +--SELECT id, cast(ST_AsText(ST_GeomCollFromWKB(wkb)) AS varchar(190)) AS GeomCollection +--FROM sample_geomcollections; + +--=============================================================== +-- ST_Geometry(LOB) +--=============================================================== +--DROP TABLE sample_geometries; +--CREATE TABLE sample_geometries (id SMALLINT, geometry ST_GEOMETRY); + +--INSERT INTO sample_geometries(id, geometry) +--VALUES +-- (7001, ST_Geometry('point(1 2)', 1) ), +-- (7002, ST_Geometry('linestring(33 2, 34 3, 35 6)', 1) ), +-- (7003, ST_Geometry('polygon((3 3, 4 6, 5 3, 3 3))', 1)), +-- (7004, ST_Geometry('5060', 1)); + +--SELECT id, cast(ST_AsText(geometry) AS varchar(120)) AS Geometry +--FROM sample_geometries; + +--=============================================================== +-- ST_GeometryN(ST_GeomCollection) +--=============================================================== +--DROP TABLE sample_geomcollections; +--CREATE TABLE sample_geomcollections (id SMALLINT, geometry ST_GEOMCOLLECTION); + +--INSERT INTO sample_geomcollections(id, geometry) +--VALUES +-- (4001, ST_GeomCollection('multipoint(1 2, 4 3)', 1) ), +-- (4002, ST_GeomCollection('multilinestring( +-- (33 2, 34 3, 35 6), +-- (28 4, 29 5, 31 8, 43 12), +-- (39 3, 37 4, 36 7))', 1) ), +-- (4003, ST_GeomCollection('multipolygon(((3 3, 4 6, 5 3, 3 3), +-- (8 24, 9 25, 1 28, 8 24), +-- (13 33, 7 36, 1 40, 10 43, 13 33)))', 1)); + +--SELECT id, cast(ST_AsText(ST_GeometryN(geometry, 2)) AS varchar(110)) AS second_geometry +--FROM sample_geomcollections; + +--=============================================================== +-- ST_GeometryType(ST_Geometry) +--=============================================================== +--DROP TABLE sample_geometries; +--CREATE TABLE sample_geometries (id SMALLINT, geometry ST_GEOMETRY); + +--INSERT INTO sample_geometries(id, geometry) +--VALUES +-- (7101, ST_Geometry('point(1 2)', 1) ), +-- (7102, ST_Geometry('linestring(33 2, 34 3, 35 6)', 1) ), +-- (7103, ST_Geometry('polygon((3 3, 4 6, 5 3, 3 3))', 1)), +-- (7104, ST_Geometry('multipoint(1 2, 4 3)', 1) ); + +--SELECT id, ST_GeometryType(geometry) AS geometry_type +--FROM sample_geometries; + +--=============================================================== +-- ST_GeomFromTxt(WKT) +--=============================================================== +--DROP TABLE sample_geometries; +--CREATE TABLE sample_geometries (id SMALLINT, geometry ST_GEOMETRY); + +--INSERT INTO sample_geometries(id, geometry) +--VALUES +-- (1251, ST_GeomFromText('point(1 2)', 1) ), +-- (1252, ST_GeomFromText('linestring(33 2, 34 3, 35 6)', 1) ), +-- (1253, ST_GeomFromText('polygon((3 3, 4 6, 5 3, 3 3))', 1)); + +--SELECT id, cast(ST_AsText(geometry) AS varchar(105)) AS Geometry +--FROM sample_geometries; + +--=============================================================== +-- ST_GeomFromWKB(WKB) +--=============================================================== +--DROP TABLE sample_geometries; +--CREATE TABLE sample_geometries (id SMALLINT, geometry ST_GEOMETRY, wkb BLOB(32K)); + +--INSERT INTO sample_geometries(id, geometry) +--VALUES +-- (1901, ST_GeomFromText('point(1 2)', 1) ), +-- (1902, ST_GeomFromText('linestring(33 2, 34 3, 35 6)', 1) ), +-- (1903, ST_GeomFromText('polygon((3 3, 4 6, 5 3, 3 3))', 1)); + +--UPDATE sample_geometries AS temp_correlated +--SET wkb = ST_AsBinary(geometry) +--WHERE id = temp_correlated.id; + +--SELECT id, cast(ST_AsText(ST_GeomFromWKB(wkb)) AS varchar(190)) AS Geometry +--FROM sample_geometries; + +--=============================================================== +-- ST_Intersects(geometry, geometry) +--=============================================================== +--DROP TABLE sample_geometries1; +--DROP TABLE sample_geometries2; +--CREATE TABLE sample_geometries1 (id SMALLINT, spatial_type varchar(13), geometry ST_GEOMETRY); +--CREATE TABLE sample_geometries2 (id SMALLINT, spatial_type varchar(13), geometry ST_GEOMETRY); + +--INSERT INTO sample_geometries1(id, spatial_type, geometry) +--VALUES +-- ( 1, 'ST_Point', ST_Point('point(550 150)', 1) ), +-- (10, 'ST_LineString', ST_LineString('linestring(800 800, 900 800)', 1) ), +-- (20, 'ST_Polygon', ST_Polygon('polygon((500 100, 500 200, 700 200, 700 100, 500 100))', 1) ); + +--INSERT INTO sample_geometries2(id, spatial_type, geometry) +--VALUES +-- (101, 'ST_Point', ST_Point('point(550 150)', 1) ), +-- (102, 'ST_Point', ST_Point('point(650 200)', 1) ), +-- (103, 'ST_Point', ST_Point('point(800 800)', 1) ), +-- (110, 'ST_LineString', ST_LineString('linestring(850 250, 850 850)', 1) ), +-- (120, 'ST_Polygon', ST_Polygon('polygon((650 50, 650 150, 800 150, 800 50, 650 50))', 1) ), +-- (121, 'ST_Polygon', ST_Polygon('polygon((20 20, 20 40, 40 40, 40 20, 20 20))', 1) ); + +--SELECT sg1.id AS sg1_id, sg1.spatial_type AS sg1_type, +-- sg2.id AS sg1_id, sg2.spatial_type AS sg2_type, +-- CASE ST_Intersects(sg1.geometry, sg2.geometry) +-- WHEN 0 THEN 'Geometries do not intersect' +-- WHEN 1 THEN 'Geometries intersect' +-- END AS intersects +--FROM sample_geometries1 sg1, sample_geometries2 sg2 +--ORDER BY sg1.id; + + +--=============================================================== +-- ST_Length(geometry) +--=============================================================== +DROP TABLE sample_geometries; +CREATE TABLE sample_geometries(id SMALLINT, spatial_type varchar(20), geometry ST_GEOMETRY); + +INSERT INTO sample_geometries(id, spatial_type, geometry) +VALUES + (1110, 'ST_LineString', ST_LineString('linestring(50 10, 50 20)', 1) ), + (1111, 'ST_MultiLineString', ST_MultiLineString('multilinestring( + (33 2, 34 3, 35 6), + (28 4, 29 5, 31 8, 43 12), + (39 3, 37 4, 36 7))', 1) ); + +SELECT id, spatial_type, cast(ST_Length(ST_ToLineString(geometry)) AS DECIMAL(7, 2)) AS line_length +FROM sample_geometries +WHERE id = 1110; + +----Currently this is failing with a GSE3016 defect +SELECT id, spatial_type, ST_Length(ST_ToMultiLine(geometry)) AS multiline_length +FROM sample_geometries +WHERE id = 1111; + + +--=============================================================== +-- ST_LineFromText(WKT) +--=============================================================== +--DROP TABLE sample_lines; +--CREATE TABLE sample_lines(id SMALLINT, geometry ST_LineString); + +--INSERT INTO sample_lines(id, geometry) +--VALUES +-- (1110, ST_LineFromText('linestring(850 250, 850 850)', 1) ), +-- (1111, ST_LineFromText('linestring empty', 1) ); + +--SELECT id, cast(ST_AsText(geometry) AS varchar(75)) AS LineString +--FROM sample_lines; + +--=============================================================== +-- ST_LineFromWKB(WKB) +--=============================================================== +--DROP TABLE sample_lines; +--CREATE TABLE sample_lines(id SMALLINT, geometry ST_LineString, wkb BLOB(32k)); + +--INSERT INTO sample_lines(id, geometry) +--VALUES +-- (1901, ST_LineString('linestring(850 250, 850 850)', 1) ), +-- (1902, ST_LineString('linestring(33 2, 34 3, 35 6)', 1) ); + +--UPDATE sample_lines AS temp_correlated +--SET wkb = ST_AsBinary(geometry) +--WHERE id = temp_correlated.id; + +--SELECT id, cast(ST_AsText(ST_LineFromWKB(wkb)) AS varchar(90)) AS Line +--FROM sample_lines; + +--=============================================================== +-- ST_LineString(LOB) +--=============================================================== +--DROP TABLE sample_lines; +--CREATE TABLE sample_lines(id SMALLINT, geometry ST_LineString); + +--INSERT INTO sample_lines(id, geometry) +--VALUES +-- (1110, ST_LineString('linestring(850 250, 850 850)', 1) ), +-- (1111, ST_LineString('9090100100', 1) ); + +--SELECT id, cast(ST_AsText(geometry) AS varchar(75)) AS linestring +--FROM sample_lines; + +--=============================================================== +-- ST_LineStringN(ST_MultiLineString) +--=============================================================== +--DROP TABLE sample_mlines; +--CREATE TABLE sample_mlines (id SMALLINT, geometry ST_MULTILINESTRING); + +--INSERT INTO sample_mlines(id, geometry) +--VALUES +-- (1110, ST_MultiLineString('multilinestring( +-- (33 2, 34 3, 35 6), +-- (28 4, 29 5, 31 8, 43 12), +-- (39 3, 37 4, 36 7))', 1) ), +-- (1111, ST_MLineFromText('multilinestring( +-- (61 2, 64 3, 65 6), +-- (58 4, 59 5, 61 8), +-- (69 3, 67 4, 66 7, 68 9))', 1) ); + +--SELECT id, cast(ST_AsText(ST_LineStringN(geometry, 2)) AS varchar(110)) AS second_linestring +--FROM sample_mlines; + +--=============================================================== +-- ST_M(st_point) +--=============================================================== +--DROP TABLE sample_points; +--CREATE TABLE sample_points(id SMALLINT, geometry ST_POINT); + +--INSERT INTO sample_points(id, geometry) +--VALUES +-- (1, ST_Point(2, 3, 32, 5, 1)), +-- (2, ST_Point(4, 5, 20, 4, 1)), +-- (3, ST_Point(3, 8, 23, 7, 1)); + +--SELECT id, ST_M(geometry) AS measure +--FROM sample_points; + +--SELECT id, cast(ST_AsText(ST_M(geometry, 40)) AS varchar(60)) AS measure_40 +--FROM sample_points +--WHERE id = 3; + +--=============================================================== +-- ST_MaxM(st_geometry) +-- ST_MaxX(st_geometry) +-- ST_MaxY(st_geometry) +-- ST_MaxZ(st_geometry) +-- ST_MinM(st_geometry) +-- ST_MinX(st_geometry) +-- ST_MinY(st_geometry) +-- ST_MinZ(st_geometry) +--=============================================================== +--DROP TABLE sample_polygons; +--CREATE TABLE sample_polygons(id SMALLINT, geometry ST_POLYGON); + +--INSERT INTO sample_polygons(id, geometry) +--VALUES +-- (1, ST_Polygon('polygon zm((110 120 20 3, 110 140 22 3, 120 130 26 4, 110 120 20 3))') ), +-- (2, ST_Polygon('polygon zm((0 0 40 7, 0 4 35 9, 5 4 32 12, 5 0 31 5, 0 0 40 7))') ), +-- (3, ST_Polygon('polygon zm((12 13 10 16 , 8 4 10 12, 9 4 12 11, 12 13 10 16))') ); + +----------------------------------------------------------------- +-- ST_MaxM(st_geometry) +----------------------------------------------------------------- +--SELECT id, cast(ST_MaxM(geometry) AS SMALLINT) AS max_measure_per_polygon +--FROM sample_polygons; + +--< TO DO >-- +--How do you include the id without the SQL failing +--SELECT cast(MAX(ST_MaxM(geometry)) AS SMALLINT) AS max_measure +--FROM sample_polygons; + +----------------------------------------------------------------- +-- ST_MaxX(st_geometry) +----------------------------------------------------------------- +--SELECT id, cast(ST_MaxX(geometry) AS SMALLINT) AS max_x_coordinate_per_polygon +--FROM sample_polygons; + +--SELECT cast(MAX(ST_MaxX(geometry)) AS SMALLINT) AS max_x_coordinate +--FROM sample_polygons; + +--Super Min/Max Example +--SELECT cast(MIN(ST_MinX(geometry)) AS SMALLINT) AS MinX, +-- cast(MIN(ST_MinY(geometry)) AS SMALLINT) AS MinY, +-- cast(MIN(ST_MinZ(geometry)) AS SMALLINT) AS MinZ, +-- cast(MIN(ST_MinM(geometry)) AS SMALLINT) AS MinM, +-- cast(MAX(ST_MaxX(geometry)) AS SMALLINT) AS MaxX, +-- cast(MAX(ST_MaxY(geometry)) AS SMALLINT) AS MaxY, +-- cast(MAX(ST_MaxZ(geometry)) AS SMALLINT) AS MaxZ, +-- cast(MAX(ST_MaxM(geometry)) AS SMALLINT) AS MaxM +--FROM sample_polygons; + +----------------------------------------------------------------- +-- ST_MaxY(st_geometry) +----------------------------------------------------------------- +--SELECT id, cast(ST_MaxY(geometry) AS SMALLINT) AS max_y_coordinate_per_polygon +--FROM sample_polygons; + +--SELECT cast(MAX(ST_MaxY(geometry)) AS SMALLINT) AS max_y_coordinate +--FROM sample_polygons; + +----------------------------------------------------------------- +-- ST_MaxZ(st_geometry) +----------------------------------------------------------------- +--SELECT id, cast(ST(MaxZ(geometry) AS SMALLINT) AS max_z_coordinate_per_polygon +--FROM sample_polygons; + +--SELECT cast(MAX(ST_MaxZ(geometry)) AS SMALLINT) AS max_z_coordinate +--FROM sample_polygons; + +----------------------------------------------------------------- +-- ST_MinM(st_geometry) +----------------------------------------------------------------- +--SELECT id, cast(ST_MinM(geometry) AS SMALLINT) AS min_m_coordinate_per_polygon +--FROM sample_polygons; + +--SELECT cast(MIN(ST_MinM(geometry)) AS SMALLINT) AS min_m_coordinate +--FROM sample_polygons; + +----------------------------------------------------------------- +-- ST_MinX(st_geometry) +----------------------------------------------------------------- +--SELECT id, cast(ST_MinX(geometry) AS SMALLINT) AS min_x_coordinate_per_polygon +--FROM sample_polygons; + +--SELECT cast(MIN(ST_MinX(geometry)) AS SMALLINT) AS min_x_coordinate +--FROM sample_polygons; + +----------------------------------------------------------------- +-- ST_MinY(st_geometry) +----------------------------------------------------------------- +--SELECT id, cast(ST_MinY(geometry) AS SMALLINT) AS min_y_coordinate_per_polygon +--FROM sample_polygons; + +--SELECT cast(MIN(ST_MinY(geometry)) AS SMALLINT) AS min_y_coordinate +--FROM sample_polygons; + + +----------------------------------------------------------------- +-- ST_MinZ(st_geometry) +----------------------------------------------------------------- +--SELECT id, cast(ST_MinZ(geometry) AS SMALLINT) AS min_z_coordinate_per_polygon +--FROM sample_polygons; + +--SELECT cast(MIN(ST_MinZ(geometry)) AS SMALLINT) AS min_z_coordinate +--FROM sample_polygons; + + +--=============================================================== +-- St_MBR(geometry) +--=============================================================== +--DROP TABLE sample_polygons; +--CREATE TABLE sample_polygons (id SMALLINT, geometry ST_POLYGON); + +--INSERT INTO sample_polygons (id, geometry) +--VALUES +-- (1, ST_Polygon('polygon((5 5, 7 7, 5 9, 7 9, 9 11, 13 9, 15 9, 13 7, 15 5, 9 6, 5 5))') ), +-- (2, ST_Polygon('polygon((20 30, 25 35, 30 30, 20 30))', 0)); + +--SELECT id, cast(ST_AsText(ST_MBR(geometry)) AS varchar(150)) AS MBR +--FROM sample_polygons; + +--=============================================================== +-- St_MBRIntersect(geometry) +--=============================================================== +--DROP TABLE sample_polygons; +--CREATE TABLE sample_polygons (id SMALLINT, geometry ST_POLYGON); + +--INSERT INTO sample_polygons (id, geometry) +--VALUES +-- (1, ST_Polygon('polygon((0 0, 30 0, 40 30, 40 35, 5 35, 5 10, 20 10, 20 5, 0 0))') ), +-- (2, ST_Polygon('polygon((15 15, 15 20, 60 20, 60 15, 15 15))') ), +-- (3, ST_Polygon('polygon((115 15, 115 20, 160 20, 160 15, 115 15))') ); + +--SELECT sp1.id, sp2.id, +-- CASE ST_MBRIntersects(sp1.geometry, sp2.geometry) +-- WHEN 0 THEN 'MBRs do not intersect' +-- WHEN 1 THEN 'MBRs intersect' +-- END AS mbr_intersects +--FROM sample_polygons sp1, sample_polygons sp2 +--WHERE sp1.id <= sp2.id; + +--=============================================================== +-- St_MeasureBetween(geometry, startMeasure, endMeasure) +--=============================================================== +--DROP TABLE sample_lines; +--CREATE TABLE sample_lines (id SMALLINT, geometry ST_LINESTRING); + +--INSERT INTO sample_lines(id, geometry) +--VALUES +-- (1, ST_LineString('linestring m (2 2 3, 3 5 3, 3 3 6, 4 4 6, 5 5 6, 6 6 8)', 1)); + +--SELECT id, cast(ST_AsText(ST_MeasureBetween(geometry, 4, 6)) AS varchar(150)) AS measure_between_4_and_6 +--FROM sample_lines; + +--=============================================================== +-- St_MidPoint(st_linestring) +--=============================================================== +--DROP TABLE sample_lines; +--CREATE TABLE sample_lines (id SMALLINT, geometry ST_LINESTRING); + +--INSERT INTO sample_lines(id, geometry) +--VALUES +-- (1, ST_LineString('linestring (0 0, 0 10, 0 20, 0 30, 0 40)', 1)), +-- (2, ST_LineString('linestring (2 2, 3 5, 3 3, 4 4, 5 5, 6 6)', 1)), +-- (3, ST_LineString('linestring (0 10, 0 0, 10 0, 10 10)', 1)), +-- (4, ST_LineString('linestring (0 20, 5 20, 10 20, 15 20)', 1)); + +--SELECT id, cast(ST_AsText(ST_MidPoint(geometry)) AS varchar(60)) AS mid_point +--FROM sample_lines; + +--=============================================================== +-- St_MLineFromText(WKT) +--=============================================================== +--DROP TABLE sample_mlines; +--CREATE TABLE sample_mlines (id SMALLINT, geometry ST_MULTILINESTRING); + +--INSERT INTO sample_mlines(id, geometry) +--VALUES +-- (1110, ST_MLineFromText('multilinestring( +-- (33 2, 34 3, 35 6), +-- (28 4, 29 5, 31 8, 43 12), +-- (39 3, 37 4, 36 7))', 1) ); + +--SELECT id, cast(ST_AsText(geometry) AS varchar(280)) AS multilinestring +--FROM sample_mlines +--WHERE id = 1110; + +--=============================================================== +-- ST_MLineFromWKB(WKB) +--=============================================================== +--DROP TABLE sample_mlines; +--CREATE TABLE sample_mlines (id SMALLINT, geometry ST_MULTILINESTRING, wkb BLOB(32K)); + +--INSERT INTO sample_mlines(id, geometry) +--VALUES +-- (10, ST_MLineFromText('multilinestring( +-- (61 2, 64 3, 65 6), +-- (58 4, 59 5, 61 8), +-- (69 3, 67 4, 66 7, 68 9))', 1) ); + +--UPDATE sample_mlines AS temp_correlated +--SET wkb = ST_AsBinary(geometry) +--WHERE id = temp_correlated.id; + +--SELECT id, cast(ST_AsText(ST_MLineFromWKB(wkb)) AS varchar(280)) AS MultiLineString +--FROM sample_mlines +--WHERE id = 10; + +--=============================================================== +-- ST_MPointFromText(WKT) +--=============================================================== +--DROP TABLE sample_mpoints; +--CREATE TABLE sample_mpoints (id SMALLINT, geometry ST_MULTIPOINT); + +--INSERT INTO sample_mpoints(id, geometry) +--VALUES +-- (1110, ST_MPointFromText('multipoint(1 2, 4 3, 5 6)', 1) ); + +--SELECT id, cast(ST_AsText(geometry) AS varchar(280)) AS MultiPoint +--FROM sample_mpoints +--WHERE id = 1110; + + +--=============================================================== +-- ST_MPointFromWKB(WKB) +--=============================================================== +--DROP TABLE sample_mpoints; +--CREATE TABLE sample_mpoints (id SMALLINT, geometry ST_MULTIPOINT, wkb BLOB(32K)); + +--INSERT INTO sample_mpoints(id, geometry) +--VALUES +-- (10, ST_MPointFromText('multipoint(44 14, 35 16, 24 13)', 1)); + +--UPDATE sample_mpoints AS temp_correlated +--SET wkb = ST_AsBinary(geometry) +--WHERE id = temp_correlated.id; + +--SELECT id, cast(ST_AsText(ST_MPointFromWKB(wkb)) AS varchar(100)) AS MultiPoint +--FROM sample_mpoints +--WHERE id = 10; + +--=============================================================== +-- ST_MPolyFromText(WKT) +--=============================================================== +--DROP TABLE sample_mpolygons; +--CREATE TABLE sample_mpolygons (id SMALLINT, geometry ST_MULTIPOLYGON); + +--INSERT INTO sample_mpolygons(id, geometry) +--VALUES +-- (1110, ST_MPolyFromText('multipolygon(((3 3, 4 6, 5 3, 3 3), +-- (8 24, 9 25, 1 28, 8 24), +-- (13 33, 7 36, 1 40, 10 43, 13 33)))', 1)); + +--SELECT id, cast(ST_AsText(geometry) AS varchar(350)) AS MultiPolygon +--FROM sample_mpolygons +--WHERE id = 1110; + +--=============================================================== +-- ST_MPolyFromWKB(WKB) +--=============================================================== +--DROP TABLE sample_mpolygons; +--CREATE TABLE sample_mpolygons (id SMALLINT, geometry ST_MULTIPOLYGON, wkb BLOB(32K)); + +--INSERT INTO sample_mpolygons(id, geometry) +--VALUES +-- (10, ST_MPolyFromText('multipolygon(((1 72, 4 79, 5 76, 1 72), +-- (10 20, 10 40, 30 41, 10 20), +-- (9 43, 7 44, 6 47, 9 43)))', 1)); + +--UPDATE sample_mpolygons AS temp_correlated +--SET wkb = St_AsBinary(geometry) +--WHERE id = temp_correlated.id; + +--SELECT id, cast(ST_AsText(ST_MPolyFromWKB(wkb)) AS varchar(320)) AS MultiPolygon +--FROM sample_mpolygons +--WHERE id = 10; + +--=============================================================== +-- St_MultiLineString(LOB) +--=============================================================== +--DROP TABLE sample_mlines; +--CREATE TABLE sample_mlines (id SMALLINT, geometry ST_MULTILINESTRING); + +--INSERT INTO sample_mlines(id, geometry) +--VALUES +-- (1110, ST_MultiLineString('multilinestring( +-- (33 2, 34 3, 35 6), +-- (28 4, 29 5, 31 8, 43 12), +-- (39 3, 37 4, 36 7))', 1) ); + +--SELECT id, cast(ST_AsText(geometry) AS varchar(280)) AS MultiLineString +--FROM sample_mlines +--WHERE id = 1110; + +--=============================================================== +-- ST_MultiPoint(LOB) +--=============================================================== +--DROP TABLE sample_mpoints; +--CREATE TABLE sample_mpoints (id SMALLINT, geometry ST_MULTIPOINT); + +--INSERT INTO sample_mpoints(id, geometry) +--VALUES +-- (1110, ST_MultiPoint('multipoint(1 2, 4 3, 5 6)', 1) ); + +--SELECT id, cast(ST_AsText(geometry) AS varchar(90)) AS MultiPoint +--FROM sample_mpoints +--WHERE id = 1110; + +--=============================================================== +-- ST_MultiPolygon(LOB) +--=============================================================== +--DROP TABLE sample_mpolygons; +--CREATE TABLE sample_mpolygons (id SMALLINT, geometry ST_MULTIPOLYGON); + +--INSERT INTO sample_mpolygons(id, geometry) +--VALUES +-- (1110, ST_MultiPolygon('multipolygon(((3 3, 4 6, 5 3, 3 3), +-- (8 24, 9 25, 1 28, 8 24), +-- (13 33, 7 36, 1 40, 10 43, 13 33)))', 1)); + +--SELECT id, cast(ST_AsText(geometry) AS varchar(350)) AS MultiPolygon +--FROM sample_mpolygons +--WHERE id = 1110; + +--=============================================================== +-- ST_NumGeometries(collection) +--=============================================================== +--DROP TABLE sample_geometrycol; +--CREATE TABLE sample_geometrycol(id SMALLINT, geometry ST_GEOMCOLLECTION); + +--INSERT INTO sample_geometrycol(id, geometry) +--VALUES +-- (1, ST_MultiPolygon('multipolygon(((3 3, 4 6, 5 3, 3 3), +-- (8 24, 9 25, 1 28, 8 24), +-- (13 33, 7 36, 1 40, 10 43, 13 33)))', 1)), +-- (2, ST_MultiPoint('multipoint(1 2, 4 3, 5 6, 7 6, 8 8)', 1) ); + +--SELECT id, ST_NumGeometries(geometry) AS number_of_geometries +--FROM sample_geometrycol; + +--=============================================================== +-- ST_NumLineStrings(ST_MultiLineStrings) +--=============================================================== +--DROP TABLE sample_mlines; +--CREATE TABLE sample_mlines (id SMALLINT, geometry ST_MULTILINESTRING); + +--INSERT INTO sample_mlines(id, geometry) +--VALUES +-- (1110, ST_MultiLineString('multilinestring( +-- (33 2, 34 3, 35 6), +-- (28 4, 29 5, 31 8, 43 12), +-- (39 3, 37 4, 36 7))', 1) ), +-- (1111, ST_MultiLineString('multilinestring( +-- (3 2, 4 3, 5 6), +-- (8 4, 9 5, 3 8, 4 12))', 1)); + +--SELECT id, ST_NumLineStrings(geometry) AS number_of_linestrings +--FROM sample_mlines; + +--=============================================================== +-- ST_NumPoints(geometry) +--=============================================================== +--DROP TABLE sample_geometries; +--CREATE TABLE sample_geometries(spatial_type varchar(18), geometry ST_GEOMETRY); + +--INSERT INTO sample_geometries(spatial_type, geometry) +--VALUES +-- ('st_point', ST_Point(2, 3, 0) ), +-- ('st_linestring', ST_LineString('linestring(2 5, 21 3, 23 10)') ), +-- ('st_polygon', ST_Polygon('polygon((110 120, 110 140, 120 130, 110 120))') ); + +--SELECT spatial_type, ST_NumPoints(geometry) AS number_of_points +--FROM sample_geometries; + +--=============================================================== +-- ST_NumPolygons(multipolygon) +--=============================================================== +--DROP TABLE sample_mpolygons; +--CREATE TABLE sample_mpolygons (id SMALLINT, geometry ST_MULTIPOLYGON); + +--INSERT INTO sample_mpolygons(id, geometry) +--VALUES +-- (1, ST_MultiPolygon('multipolygon(((3 3, 4 6, 5 3, 3 3), +-- (8 24, 9 25, 1 28, 8 24), +-- (13 33, 7 36, 1 40, 10 43, 13 33)))', 1)), +-- (2, ST_MultiPolygon('multipolygon empty', 1)), +-- (3, ST_MultiPolygon('multipolygon(((3 3, 4 6, 5 3, 3 3), +-- (13 33, 7 36, 1 40, 10 43, 13 33)))', 1)); + +--SELECT id, ST_NumPolygons(geometry) AS number_of_polygons +--FROM sample_mpolygons; + +--=============================================================== +-- ST_Overlaps(geometry, geometry) +--=============================================================== +--DROP TABLE sample_geometries; +--CREATE TABLE sample_geometries(id SMALLINT, geometry ST_GEOMETRY); + +--INSERT INTO sample_geometries(id, geometry) +--VALUES +-- (1, ST_Point(10, 20, 1)), +-- (2, ST_Point('point(41 41)', 1)), +-- (10, ST_LineString('linestring (1 10, 3 12, 10 10)', 1) ), +-- (20, ST_LineString('linestring (50 10, 50 12, 45 10)', 1) ), +-- (30, ST_LineString('linestring (50 12, 50 10, 60 8)', 1) ), +-- (100, ST_Polygon('polygon((0 0, 0 40, 40 40, 40 0, 0 0))', 1) ), +-- (110, ST_Polygon('polygon((30 10, 30 30, 50 30, 50 10, 30 10))', 1) ), +-- (120, ST_Polygon('polygon((0 50, 0 60, 40 60, 40 60, 0 50))', 1) ); + + +----Tests weather Points Overlaps----Tests weather Points Overlaps +--SELECT sg1.id, sg2.id, +-- CASE ST_Overlaps(sg1.geometry, sg2.geometry) +-- WHEN 0 THEN 'Points_do_not_Overlap' +-- WHEN 1 THEN 'Points_Overlap' +-- END AS Overlap +--FROM sample_geometries sg1, sample_geometries sg2 +--WHERE sg1.id < 10 AND sg2.id < 10 AND sg1.id >= sg2.id; + +----Tests weather Lines Overlaps +--SELECT sg1.id, sg2.id, +-- CASE ST_Overlaps(sg1.geometry, sg2.geometry) +-- WHEN 0 THEN 'Lines_do_not_Overlap' +-- WHEN 1 THEN 'Lines_Overlap' +-- END AS Overlap +--FROM sample_geometries sg1, sample_geometries sg2 +--WHERE sg1.id >= 10 AND sg1.id < 100 AND sg2.id >= 10 AND sg2.id < 100 +-- AND sg1.id >= sg2.id; + +----Tests weather Polygons Overlaps +--SELECT sg1.id, sg2.id, +-- CASE ST_Overlaps(sg1.geometry, sg2.geometry) +-- WHEN 0 THEN 'Polygons_do_not_Overlap' +-- WHEN 1 THEN 'Polygons_Overlap' +-- END AS Overlap +--FROM sample_geometries sg1, sample_geometries sg2 +--WHERE sg1.id >= 100 AND sg2.id >=100 +-- AND sg1.id >= sg2.id; + +--=============================================================== +-- ST_Perimeter(surface) +--=============================================================== +--!db2se drop_srs sa_bank -srsName new_york1983 -sa 1; + +--!db2se create_srs sa_bank -srsId 4000 -srsName new_york1983 -xOffset 0 -yOffset 0 -xScale 1 -yScale 1 -coordsysName NAD_1983_StatePlane_New_York_East_FIPS_3101_Feet -sa 1; + +--DROP TABLE sample_polygons; +--CREATE TABLE sample_polygons(id SMALLINT, geometry ST_POLYGON); + +--INSERT INTO sample_polygons(id, geometry) +--VALUES +-- (1, ST_Polygon('polygon((0 0, 0 4, 5 4, 5 0, 0 0))', 4000)); + +--SELECT id, ST_Perimeter(geometry) AS perimeter +--FROM sample_polygons; + +--SELECT id, ST_Perimeter(geometry, 'METER') AS perimeter_meter +--FROM sample_polygons; + +--=============================================================== +-- ST_PerpPoint(curve, point) +--=============================================================== +--This is not updated with Bill's fixes +--DROP TABLE sample_lines; +--CREATE TABLE sample_lines(id SMALLINT, line ST_LINESTRING); + +--INSERT INTO sample_lines(id, line) +--VALUES +-- (1, ST_LineString('linestring z (0 10 1, 0 0 3, 10 0 5, 10 10 7)') ); + +-- Perpendicular point is coincident with the input point, on the base of the U: +--SELECT ST_PerpPoint(line, ST_Point(5, 0, 0)) AS Perp_Point +--FROM sample_lines; + + +--=============================================================== +-- ST_Point(LOB) +--=============================================================== +--DROP TABLE sample_points; +--CREATE TABLE sample_points(id SMALLINT, geometry ST_POINT); + +--INSERT INTO sample_points(id, geometry) +--VALUES +-- (1100, ST_Point(10, 20, 1)), +-- (1101, ST_Point('point(30 40)', 1)); + +--SELECT id, cast(ST_AsText(geometry) AS varchar(35)) AS Points +--FROM SAMPLE_POINTS; + +--=============================================================== +-- ST_PointFromText(WKT) +--=============================================================== +--DROP TABLE sample_points; +--CREATE TABLE sample_points(id SMALLINT, geometry ST_POINT); + +--INSERT INTO sample_points(id, geometry) +--VALUES +-- (1100, ST_PointFromText('point(30 40)', 1)); + +--SELECT id, cast(ST_AsText(geometry) AS varchar(35)) AS points +--FROM sample_points; + +--=============================================================== +-- ST_PointFromWKB(WKB) +--=============================================================== +--DROP TABLE sample_points; +--CREATE TABLE sample_points(id SMALLINT, geometry ST_POINT, wkb BLOB(32k)); + +--INSERT INTO sample_points(id, geometry) +--VALUES +-- (10, ST_PointFromText('point(44 14)', 1)), +-- (11, ST_PointFromText('point(24 13)', 1)); + +--UPDATE sample_points AS temp_correlated +--SET wkb = ST_AsBinary(geometry) +--WHERE id = temp_correlated.id; + +--SELECT id, cast(ST_AsText(geometry) AS varchar(35)) AS points +--FROM SAMPLE_POINTS; + +--=============================================================== +-- ST_PolyFromText(WKT) +--=============================================================== +--DROP TABLE sample_polygons; +--CREATE TABLE sample_polygons(id SMALLINT, geometry ST_POLYGON); + +--INSERT INTO sample_polygons(id, geometry) +--VALUES +-- (1110, ST_Polygon('polygon((50 20, 50 40, 70 30, 50 20))') ); + +--SELECT id, cast(ST_AsText(geometry) AS varchar(120)) AS polygons +--FROM sample_polygons; + +--=============================================================== +-- ST_PolyFromText(GeoJSON) +--=============================================================== +--DROP TABLE sample_polygons; +--CREATE TABLE sample_polygons(id SMALLINT, geometry ST_POLYGON); + +--INSERT INTO sample_polygons(id, geometry) +--VALUES +-- (1110, ST_Polygon('{ "type": "polygon", "coordinates" : [[[50, 20], [50, 40], [70, 30], [50, 20]]] }') ); + +--SELECT id, cast(ST_AsText(geometry) AS varchar(120)) AS polygons +--FROM sample_polygons; + +--=============================================================== +-- ST_PolyFromWKB(WKB) +--=============================================================== +--DROP TABLE sample_polygons; +--CREATE TABLE sample_polygons (id SMALLINT, geometry ST_POLYGON, wkb BLOB(32K)); + +--INSERT INTO sample_polygons(id, geometry) +--VALUES +-- (1115, ST_Polygon('polygon((50 20, 50 40, 70 30, 50 20))') ); + +--UPDATE sample_polygons AS temp_correlated +--SET wkb = ST_AsBinary(geometry) +--WHERE id = temp_correlated.id; + +--SELECT id, cast(ST_AsText(ST_PolyFromWKB(wkb)) AS varchar(120)) AS Polygon +--FROM sample_polygons +--WHERE id = 1115; + +--=============================================================== +-- ST_Polgyon(LOB) +--=============================================================== +--DROP TABLE sample_polygons; +--CREATE TABLE sample_polygons (id SMALLINT, geometry ST_POLYGON); + +--INSERT INTO sample_polygons(id, geometry) +--VALUES +-- (1100, ST_Polygon(db2gse.ST_LineFromText('linestring(10 20, 10 40, 20 30, 10 20)', 1), 1)), +-- (1101, ST_Polygon('polygon((110 120, 110 140, 120 130, 110 120))', 1) ), +-- (1102, ST_Polygon('polygon((110 120, 110 140, 130 140, 130 120, 110 120),(115 125, 115 135, 125 135, 125 135, 115 125))', 1) ); + +--SELECT id, cast(ST_AsText(geometry) AS varchar(280)) AS Polygon +--FROM sample_polygons; + +--=============================================================== +-- ST_PolgyonN(geometry) +--=============================================================== +--DROP TABLE sample_mpolygons; +--CREATE TABLE sample_mpolygons (id SMALLINT, geometry ST_MULTIPOLYGON); + +--INSERT INTO sample_mpolygons(id, geometry) +--VALUES +-- (1, ST_MPolyFromText('multipolygon(((3 3, 4 6, 5 3, 3 3), +-- (8 24, 9 25, 1 28, 8 24), +-- (13 33, 7 36, 1 40, 10 43, 13 33)))', 1)); + +--SELECT id, cast(ST_AsText(ST_PolygonN(geometry, 2)) AS varchar(120)) AS polygon_n +--FROM sample_mpolygons +--WHERE id = 1; + +--=============================================================== +-- ST_ToGeomColl(geometry) +--=============================================================== +--DROP TABLE sample_geometries; +--CREATE TABLE sample_geometries(id SMALLINT, geometry ST_GEOMETRY); + +--INSERT INTO sample_geometries(id, geometry) +--VALUES +-- (1, ST_Polygon('polygon((3 3, 4 6, 5 3, 3 3))', 1)), +-- (2, ST_Point('point(1 2)', 1) ); + +--SELECT id, cast(ST_AsText(ST_ToGeomColl(geometry)) AS varchar(120)) AS geometry_collections +--FROM sample_geometries; + +--=============================================================== +-- ST_ToPoint(geometry) +--=============================================================== +--DROP TABLE sample_geometries; +--CREATE TABLE sample_geometries(id SMALLINT, geometry ST_GEOMETRY); + +--INSERT INTO sample_geometries(id, geometry) +--VALUES +-- (1, ST_Geometry('point(30 40)', 1)), +-- (2, ST_Geometry('linestring empty', 1)), +-- (3, ST_Geometry('multipolygon empty', 1)); + +--SELECT cast(ST_AsText(geometry) AS varchar(35)) AS points +--FROM sample_geometries; + +--SELECT cast(ST_AsText(ST_ToPoint(geometry)) as varchar(35)) AS points +--FROM sample_geometries; + +--SELECT cast(ST_AsText(TREAT(geometry AS ST_Point)) as varchar(35)) AS points +--FROM sample_geometries; + +--=============================================================== +-- ST_ToLineString(geometry) +--=============================================================== +--DROP TABLE sample_geometries; +--CREATE TABLE sample_geometries(id SMALLINT, geometry ST_GEOMETRY); + +--INSERT INTO sample_geometries(id, geometry) +--VALUES +-- (1, ST_Geometry('linestring z (0 10 1, 0 0 3, 10 0 5)')), +-- (2, ST_Geometry('point empty', 1)), +-- (3, ST_Geometry('multipolygon empty', 1)); + + +--SELECT cast(ST_AsText(ST_ToLineString(geometry)) as varchar(130)) AS lines +--FROM sample_geometries; + +--=============================================================== +-- ST_ToPolygon(geometry) +--=============================================================== +--DROP TABLE sample_geometries; +--CREATE TABLE sample_geometries(id SMALLINT, geometry ST_GEOMETRY); + +--INSERT INTO sample_geometries(id, geometry) +--VALUES +-- (1, ST_Geometry('polygon((0 0, 0 4, 5 4, 5 0, 0 0))', 1)), +-- (2, ST_Geometry('point empty', 1)), +-- (3, ST_Geometry('multipolygon empty', 1)); + +--SELECT cast(ST_AsText(ST_ToPolygon(geometry)) as varchar(130)) AS polygons +--FROM sample_geometries; + +--=============================================================== +-- ST_ToMultiPoint(geometry) +--=============================================================== +--DROP TABLE sample_geometries; +--CREATE TABLE sample_geometries(id SMALLINT, geometry ST_GEOMETRY); + +--INSERT INTO sample_geometries(id, geometry) +--VALUES +-- (1, ST_Geometry('multipoint(0 0, 0 4)', 1)); +-- (2, ST_Geometry('point(30 40)', 1)), +-- (3, ST_Geometry('multipolygon empty', 1)); + +--SELECT cast(ST_AsText(ST_ToMultiPoint(geometry)) as varchar(100)) AS MultiPoint +--FROM sample_geometries; + +--=============================================================== +-- ST_Within(geometry) +--=============================================================== +--DROP TABLE sample_points; +--DROP TABLE sample_lines; +--DROP TABLE sample_polygons; + +--CREATE TABLE sample_points (id SMALLINT, geometry ST_POINT); +--CREATE TABLE sample_lines(id SMALLINT, line ST_LINESTRING); +--CREATE TABLE sample_polygons (id SMALLINT, geometry ST_POLYGON); + +--INSERT INTO sample_points(id, geometry) +--VALUES +-- (1, ST_Point(10, 20, 1)), +-- (2, ST_Point('point(41 41)', 1)); +---- (2, ST_Point('point(50 50)', 1)); --Points to test defect + +--INSERT INTO sample_lines(id, line) +--VALUES +-- (10, ST_LineString('linestring (1 10, 3 12, 10 10)', 1) ), +-- (20, ST_LineString('linestring (50 10, 50 12, 45 10)', 1) ); + +--INSERT INTO sample_polygons(id, geometry) +--VALUES +-- (100, ST_Polygon('polygon((0 0, 0 40, 40 40, 40 0, 0 0))', 1) ); + +--SELECT pts.id AS point_ids_within_polygon +--FROM sample_points pts, sample_polygons poly +--WHERE ST_Within(poly.geometry, pts.geometry) = 0; + +--SELECT lin.id AS line_ids_within_polygon +--FROM sample_lines lin, sample_polygons poly +--WHERE ST_Within(poly.geometry, lin.geometry) = 0; + +--=============================================================== +-- ST_WKBToSQL(wkb) +--=============================================================== +--DROP TABLE sample_geometries; +--CREATE TABLE sample_geometries(id SMALLINT, geometry ST_GEOMETRY, wkb BLOB(32k)); + +--INSERT INTO sample_geometries(id, geometry) +--VALUES +-- (10, ST_Point('point(44 14)', 0)), +-- (11, ST_Point('point(24 13)', 0)), +-- (12, ST_Polygon('polygon((50 20, 50 40, 70 30, 50 20))') ); + +--UPDATE sample_geometries AS temp_correlated +--SET wkb = ST_AsBinary(geometry) +--WHERE id = temp_correlated.id; + +--SELECT id, cast(ST_AsText(ST_WKBToSQL(wkb)) AS varchar(120)) AS Geometries +--FROM sample_geometries; + +--=============================================================== +-- ST_WKTToSQL(wkt) +--=============================================================== +--DROP TABLE sample_geometries; +--CREATE TABLE sample_geometries(id SMALLINT, geometry ST_GEOMETRY); + +--INSERT INTO sample_geometries(id, geometry) +--VALUES +-- (10, ST_WKTToSQL('point(44 14)')), +-- (11, ST_WKTToSQL('point(24 13)')), +-- (12, ST_WKTToSQL('polygon((50 20, 50 40, 70 30, 50 20))')); + +--SELECT id, cast(ST_AsText(geometry) AS varchar(120)) AS Geometries +--FROM sample_geometries; + +--=============================================================== +-- ST_X(st_point) +--=============================================================== +--DROP TABLE sample_points; +--CREATE TABLE sample_points(id SMALLINT, geometry ST_POINT); + +--INSERT INTO sample_points(id, geometry) +--VALUES +-- (1, ST_Point(2, 3, 32, 5, 1)), +-- (2, ST_Point(4, 5, 20, 4, 1)), +-- (3, ST_Point(3, 8, 23, 7, 1)); + +--SELECT id, ST_X(geometry) AS x_coordinate +--FROM sample_points; + +--SELECT id, cast(ST_AsText(ST_X(geometry, 40)) AS varchar(60)) AS x_40 +--FROM sample_points +--WHERE id = 3; + +--=============================================================== +-- ST_Y(st_point) +--=============================================================== +--DROP TABLE sample_points; +--CREATE TABLE sample_points(id SMALLINT, geometry ST_POINT); + +--INSERT INTO sample_points (id, geometry) +--VALUES +-- (1, ST_Point(2, 3, 32, 5, 1)), +-- (2, ST_Point(4, 5, 20, 4, 1)), +-- (3, ST_Point(3, 8, 23, 7, 1)); + +--SELECT id, ST_Y(geometry) AS y_coordinate +--FROM sample_points; + +--SELECT id, cast(ST_AsText(ST_Y(geometry, 40)) AS varchar(60)) AS y_40 +--FROM sample_points +--WHERE id = 3; + +--=============================================================== +-- ST_Z(st_point) +--=============================================================== +--DROP TABLE sample_points; +--CREATE TABLE sample_points(id SMALLINT, geometry ST_POINT); + +--INSERT INTO SAMPLE_POINTS (id, geometry) +--VALUES +-- (1, ST_Point(2, 3, 32, 5, 1)), +-- (2, ST_Point(4, 5, 20, 4, 1)), +-- (3, ST_Point(3, 8, 23, 7, 1)); + +--SELECT id, ST_Z(geometry) AS z_coordinate +--FROM sample_points; + +--SELECT id, cast(ST_AsText(ST_Z(geometry, 40)) AS varchar(60)) AS z_40 +--FROM sample_points +--WHERE id = 3; + +--=============================================================== +-- ST_Grandmbr and ST_Union aggregate geometries +--=============================================================== +--DROP TABLE sample_points; +--CREATE TABLE sample_points(id SMALLINT, geometry ST_POINT); + +--INSERT INTO sample_points(id, geometry) +--VALUES +-- (1, ST_Point(2, 3, 1)), +-- (2, ST_Point(4, 5, 1)), +-- (3, ST_Point(13, 15, 1)), +-- (4, ST_Point(12, 5, 1)), +-- (5, ST_Point(23, 2, 1)), +-- (6, ST_Point(11, 4, 1)); + +--SELECT cast(ST_AsText(ST_Grandmbr(geometry)) AS varchar(160)) AS aggregate_of_points +--FROM sample_points; + +--SELECT cast(ST_AsText(ST_ConvexHull(ST_Union(geometry))) AS varchar(110)) AS aggregate_of_points +--FROM sample_points; + + + diff --git a/spatial/bank/saBankDemoTableData.db2 b/spatial/bank/saBankDemoTableData.db2 new file mode 100644 index 0000000..064b723 --- /dev/null +++ b/spatial/bank/saBankDemoTableData.db2 @@ -0,0 +1,1097 @@ +---------------------------------------------------------------------------- +-- Licensed Materials - Property of IBM +-- Governed under the terms of the IBM Public License +-- +-- (C) COPYRIGHT International Business Machines Corp. 2999 - 2021 +-- All Rights Reserved. +-- +-- US Government Users Restricted Rights - Use, duplication or +-- disclosure restricted by GSA ADP Schedule Contract with IBM Corp. +---------------------------------------------------------------------------- +-- +-- Component Name: DB2 Spatial Analytics v11.5 +-- +-- Source File Name: saBankDemoTableData.db2 +-- +-- Version: 11.5.6+ +-- +-- Description: +-- +-- +-- +-- For more information about the Db2 Spatial Analytics Bank Demo scripts, +-- see the saBankDemoREADME.txt file. +-- +-- For more information about Db2 Spatial Analytics component, refer to the +-- documentation at +-- https://www.ibm.com/docs/en/db2/11.5?topic=data-db2-spatial-analytics. +-- +-- For the latest information on Db2 refer to the Db2 website at +-- https://www.ibm.com/analytics/db2. +---------------------------------------------------------------------------- + +--========================================================================== +-- BRANCH DATA +--========================================================================== +INSERT INTO sa_demo.branches( + BRANCH_ID, SA_ROW_ID, NAME, MANAGER, STREET, CITY, STATE, ZIP,LATITUDE,LONGITUDE) VALUES + (1, 1, 'Meridian', 'Francisco Villa', '1670 Meridian Ave', 'San Jose', 'CA','95125',37.31164,-121.91451), + (2, 2, 'San Carlos ','Stacey Nguyen', '580 San Carlos St', 'San Jose', 'CA','95112',37.33729,-121.87508); +-- end of BRANCH DATA + +--========================================================================== +-- CUSTOMER DATA +--========================================================================== +INSERT INTO sa_demo.customers( + CUSTOMER_ID, SA_ROW_ID, NAME, STREET, CITY, STATE, ZIP,CUSTOMER_TYPE,LATITUDE,LONGITUDE) VALUES +( 124, 1,'James T.Kirk ',' 855 Garden Dr ',' San Jose ','CA','95126','NORMAL',37.33253, -121.93148), +( 125, 2,'Leonard McCoy ',' 815 Garden Dr ',' San Jose ','CA','95126','NORMAL',37.33187, -121.93069), +( 126, 3,'Hikaru Sulu ','1849 University Ave',' San Jose ','CA','95126','NORMAL',37.33126, -121.93243), +( 127, 4,'Michelle Nichols ','1649 University Way',' San Jose ','CA','95126','NORMAL',37.33333, -121.93044), +( 135, 5,'Montgomery Scott ','2024 University Ave',' San Jose ','CA','95128','NORMAL',37.33006, -121.93432), +( 136, 6,'Pavel Chekov ',' 725 Bascom Ave',' San Jose ','CA','95128','NORMAL',37.33013, -121.93367), +( 138, 8,'Deforest Kelly ',' 725 Garden Dr ',' San Jose ','CA','95126','NORMAL',37.33060, -121.92919), +( 139, 9,'Walter Koenig ','1779 Naglee Ave',' San Jose ','CA','95126','NORMAL',37.32925, -121.93012), +( 156, 10,'James Lenard ','2236 Central Park Dr ',' San Jose ','CA','95008','NORMAL',37.27586, -121.93877), +( 157, 11,'Leonard Nimoy ',' 805 Sweetbriar Dr ',' San Jose ','CA','95008','NORMAL',37.27553, -121.93867), +( 158, 12,'George Takei ',' 575 Cambrian Dr ',' San Jose ','CA','95008','NORMAL',37.27524, -121.93921), +( 159, 13,'Jean Luc Picard ',' 905 Sweetbriar Dr ',' San Jose ','CA','95008','NORMAL',37.27445, -121.93867), +( 160, 14,'Willian Riker ',' 515 Dallas Dr ',' San Jose ','CA','95008','NORMAL',37.27371, -121.94057), +( 176, 15,'Patrick Stewart ','1899 Cabana Dr ',' San Jose ','CA','95125','NORMAL',37.28738, -121.92073), +( 177, 16,'Jonathan Frakes ','2031 Hurst Ave',' San Jose ','CA','95125','NORMAL',37.28691, -121.91827), +( 178, 17,'Bervely Crusher ','2078 Hurst Ave',' San Jose ','CA','95125','NORMAL',37.28613, -121.91827), +( 179, 18,'Diana Troi ','1699 Cabana Dr ',' San Jose ','CA','95125','NORMAL',37.28770, -121.91677), +( 180, 19,'Whesley Crusher ','1974 Kocher Dr ',' San Jose ','CA','95125','NORMAL',37.28754, -121.91480), +( 262, 21,'James Cisko ','2435 Aragon Way',' San Jose ','CA','95125','NORMAL',37.27970, -121.90986), +( 263, 22,'Julian Bashir ','1690 Curtner Ave',' San Jose ','CA','95125','NORMAL',37.28147, -121.90946), +( 264, 23,'Jadzia Dax ','2349 La Mirada Dr ',' San Jose ','CA','95125','NORMAL',37.28128, -121.90878), +( 265, 24,'Katryn Janeway ','1749 Sweetbriar Dr ',' San Jose ','CA','95125','NORMAL',37.28202, -121.91039), +( 266, 25,'Bellana Torres ','2326 Briarwood Dr ',' San Jose ','CA','95125','NORMAL',37.28239, -121.90843), +( 267, 26,'Tom Parris ','1682 Curtner Ave',' San Jose ','CA','95125','NORMAL',37.28184, -121.90859), +( 368, 27,'Naomi Wilderman ','1933 Georgetta Dr ',' San Jose ','CA','95125','NORMAL',37.28537, -121.90861), +( 369, 28,'Zeffren Cockrane ','1874 Cherry Ave',' San Jose ','CA','95125','NORMAL',37.29144, -121.90176), +( 370, 29,'Jonh Sheridan ','1800 Nomark Ct ',' San Jose ','CA','95125','NORMAL',37.29228, -121.90326), +( 371, 30,'Michael Garibaldi','1974 Booksin Ave',' San Jose ','CA','95125','NORMAL',37.28708, -121.90645), +( 372, 31,'Ben Franklin ','1999 James Pl ',' San Jose ','CA','95125','NORMAL',37.28618, -121.90716), +( 373, 32,'Talia de Winters ','1832 Georgetta Dr ',' San Jose ','CA','95125','NORMAL',37.28630, -121.90652), +( 1007, 33,'Kosh Neranek ',' 399 Mayellen Ave',' San Jose ','CA','95126','NORMAL',37.32155, -121.92056), +( 1008, 34,'Zack Allan ',' 304 Buena Vista Ave',' San Jose ','CA','95126','NORMAL',37.32315, -121.91896), +( 1009, 35,'Lita Alexander ','1587 Scott St ',' San Jose ','CA','95126','NORMAL',37.31969, -121.92012), +( 1010, 36,'Susan Ivanova ',' 549 Mayellen Ave',' San Jose ','CA','95126','NORMAL',37.31893, -121.92056), +( 1011, 37,'Michael Bester ','1567 Scott St ',' San Jose ','CA','95126','NORMAL',37.31971, -121.91941), +( 1012, 38,'Fox Mulder ','1554 Scott St ',' San Jose ','CA','95126','NORMAL',37.31973, -121.91872), +( 1041, 39,'David Duchovny ',' 524 Julian St ',' San Jose ','CA','95110','NORMAL',37.33571, -121.90304), +( 1042, 40,'Danna Scully ',' 250 Autumn St ',' San Jose ','CA','95110','NORMAL',37.33560, -121.90212), +( 1043, 41,'David Skinner ',' 575 Santa Clara St ',' San Jose ','CA','95113','NORMAL',37.33196, -121.90182), +( 1044, 42,'Willian Boonne ',' 150 Autumn St ',' San Jose ','CA','95110','NORMAL',37.32836, -121.90033), +( 2127, 43,'Lilly Marquete ',' 849 Vine St ',' San Jose ','CA','95110','NORMAL',37.32102, -121.88525), +( 2128, 44,'James Sandoval ',' 224 West Virginia St ',' San Jose ','CA','95110','NORMAL',37.32189, -121.88520), +( 2129, 45,'Lian Kinkaid ',' 829 Almaden Ave',' San Jose ','CA','95110','NORMAL',37.32173, -121.88438), +( 2130, 46,'Samantha Carter ',' 149 West Virginia St ',' San Jose ','CA','95110','NORMAL',37.32258, -121.88397), +( 2131, 47,'Angela Cartwright',' 149 Sutter St ',' San Jose ','CA','95110','NORMAL',37.32194, -121.88341), +( 2132, 48,'June Lockhart ',' 274 Oak St ',' San Jose ','CA','95110','NORMAL',37.32008, -121.88525), +( 2154, 56,'Marcia Wallace ',' 500 Phelan Ave',' San Jose ','CA','95112','NORMAL',37.31710, -121.86046), +( 2155, 57,'Meggie Smith ','1718 Senter Rd ',' San Jose ','CA','95112','NORMAL',37.31816, -121.85821), +( 2156, 58,'Hank Azaria ',' 623 Nordale Ave',' San Jose ','CA','95112','NORMAL',37.31810, -121.85750), +( 2157, 59,'Paul Buchman ','1799 Welch Ave',' San Jose ','CA','95112','NORMAL',37.31771, -121.85643), +( 2158, 60,'Derek Whitestar ','1665 10th St ',' San Jose ','CA','95112','NORMAL',37.31624, -121.86285), +( 2159, 61,'Dorothy Lane ',' 375 Phelan Ave',' San Jose ','CA','95112','NORMAL',37.31526, -121.86319), +( 2160, 62,'Hemmet Brown ','1799 10th St ',' San Jose ','CA','95112','NORMAL',37.31422, -121.86088), +( 2161, 63,'Andrea Neal ','1803 Senter Rd ',' San Jose ','CA','95112','NORMAL',37.31710, -121.85720), +( 2162, 64,'James Oconor ',' 500 Needles Dr ',' San Jose ','CA','95112','NORMAL',37.31444, -121.85976), +( 2223, 49,'Billy Mummy ','1999 Senter Rd ',' San Jose ','CA','95112','NORMAL',37.31268, -121.85282), +( 2224, 50,'James Darren ',' 649 Palm St ',' San Jose ','CA','95110','NORMAL',37.32254, -121.88907), +( 2225, 51,'David Colbert ','1949 10th St ',' San Jose ','CA','95112','NORMAL',37.31275, -121.85934), +( 2226, 52,'Agnes Moghead ','1791 Monterey Hwy',' San Jose ','CA','95111','NORMAL',37.30961, -121.86740), +( 2227, 53,'Liz Montgomery ','1100 Algiers Ave',' San Jose ','CA','95122','NORMAL',37.32715, -121.84979), +( 2228, 54,'Dan Castanella ','1286 Clemence Ave',' San Jose ','CA','95122','NORMAL',37.32892, -121.85323), +( 2229, 55,'Nancy Cartwright ','1050 Walnut Woods Dr ',' San Jose ','CA','95122','NORMAL',37.32914, -121.85249), +( 3034, 65,'Idek Go ',' 350 7th St ',' San Jose ','CA','95112','NORMAL',37.33347, -121.88007), +( 3035, 66,'Kuai Chang Kaine ',' 225 Washington St ',' San Jose ','CA','95112','NORMAL',37.34497, -121.89078), +( 3036, 67,'Max Power ',' 350 6th St ',' San Jose ','CA','95112','NORMAL',37.34418, -121.88946), +( 3037, 68,'Homer Simpson ',' 375 Empire St ',' San Jose ','CA','95112','NORMAL',37.34856, -121.88916), +( 3038, 69,'Margie Simpson ',' 450 9th St ',' San Jose ','CA','95112','NORMAL',37.33337, -121.87709), +( 3039, 70,'Lisa Simpson ',' 425 Empire St ',' San Jose ','CA','95112','NORMAL',37.34904, -121.88811), +( 3084, 71,'Bart Simpson ',' 50 28th St ',' San Jose ','CA','95116','NORMAL',37.34791, -121.86358), +( 3085, 72,'Rafael Coss ','1337 Santa Clara St ',' San Jose ','CA','95116','NORMAL',37.34868, -121.86437), +( 3086, 73,'Bryan Patterson ',' 25 28th St ',' San Jose ','CA','95116','NORMAL',37.34835, -121.86390), +( 3087, 74,'Jean Ho ','1312 Santa Clara St ',' San Jose ','CA','95116','NORMAL',37.34856, -121.86464), +( 3088, 75,'Knut Stolze ','1329 Shortridge Ave',' San Jose ','CA','95116','NORMAL',37.34785, -121.86376), +( 4030, 76,'Claire Suttle ',' 949 Asbury St ',' San Jose ','CA','95126','NORMAL',37.33933, -121.91755), +( 4031, 77,'Andre Braga ',' 725 Elm St ',' San Jose ','CA','95126','NORMAL',37.33928, -121.91641), +( 4032, 78,'Tony Leung ','1074 Taylor St ',' San Jose ','CA','95126','NORMAL',37.33730, -121.91804), +( 4033, 79,'Cheung-Yuk ','1024 Taylor St ',' San Jose ','CA','95126','NORMAL',37.33779, -121.91734), +( 4034, 80,'Y. Morimoto ',' 650 Myrtle St ',' San Jose ','CA','95126','NORMAL',37.33755, -121.91671), +( 4035, 81,'Gery Mueckenbauer',' 849 Asbury St ',' San Jose ','CA','95126','NORMAL',37.34023, -121.91630), +( 4036, 82,'David Adler ',' 725 Laurel St ',' San Jose ','CA','95126','NORMAL',37.34017, -121.91515), +( 4037, 83,'Bob Shoberg ',' 849 Taylor St ',' San Jose ','CA','95126','NORMAL',37.33924, -121.91523), +( 4038, 84,'Laura Stewart ',' 949 Taylor St ',' San Jose ','CA','95126','NORMAL',37.33837, -121.91650), +( 4039, 85,'Soraia Alves ',' 650 Elm St ',' San Jose ','CA','95126','NORMAL',37.33842, -121.91548), +( 4097, 86,'Graziela Kunde ','1169 Vanessa Dr ',' San Jose ','CA','95126','NORMAL',37.30292, -121.91820), +( 4099, 88,'Nelson Mattos ','1824 Willow St ',' San Jose ','CA','95125','NORMAL',37.30075, -121.91869), +( 4100, 89,'Marilene Noronha ','1788 Isabel Dr ',' San Jose ','CA','95125','NORMAL',37.30080, -121.91825), +( 4101, 90,'Carla Nunes ','1416 Saint Francis Dr ',' San Jose ','CA','95125','NORMAL',37.30036, -121.91787), +( 4102, 91,'G.Sauaressig ','1699 Santa Barbara Dr ',' San Jose ','CA','95125','NORMAL',37.29984, -121.91567), +( 4430, 93,'Steven Elliott ','1258 Willowhaven Dr ',' San Jose ','CA','95126','NORMAL',37.30593, -121.91860), +( 4431, 94,'James Taylor ',' 942 St Elizabeth Dr ',' San Jose ','CA','95126','NORMAL',37.30721, -121.91648), +( 4432, 95,'Al Jarreau ','2323 Gunar Dr ',' San Jose ','CA','95124','NORMAL',37.27923, -121.92646), +( 4433, 96,'Diana Krall ',' 766 Malone Rd ',' San Jose ','CA','95125','NORMAL',37.29723, -121.88158), +( 4434, 97,'Gari Robinson ','2049 Delbarr Ct ',' San Jose ','CA','95125','NORMAL',37.29725, -121.88131), +( 4436, 99,'Angela Dima ',' 359 Shadow Run Dr ',' San Jose ','CA','95110','NORMAL',37.31034, -121.88066), +( 4437, 100,'Shannon Fargusson','1225 Willowhaven Dr ',' San Jose ','CA','95126','NORMAL',37.30593, -121.91802) +; +-- end of CUSTOMER DATA + +--========================================================================== +-- ACCOUNT DATA +--========================================================================== +INSERT INTO sa_demo.accounts( + ACCOUNT_ID, CUSTOMER_ID, BRANCH_ID, TYPE, BALANCE, ROUTING_NUMBER) VALUES +( 100, 124,1,'Checking', 2363.255132,1100), +( 101, 125,2,'Checking', 2885.789723,1101), +( 102, 126,1,'Checking', 863.7858514,1102), +( 103, 127,1,'Checking', 376.3056556,1103), +( 104, 135,1,'Checking', 1335.755385,1104), +( 105, 136,1,'Checking', 1522.425684,1105), +( 107, 138,1,'Checking', 1285.902569,1107), +( 108, 139,1,'Checking', 3260.161556,1108), +( 109, 156,1,'Checking', 2919.795841,1109), +( 110, 157,1,'Checking', 1073.549577,1110), +( 111, 158,1,'Checking', 1225.286351,1111), +( 112, 159,1,'Checking', 389.7738339,1112), +( 113, 160,1,'Checking', 182.9277962,1113), +( 114, 176,2,'Checking', 812.2161706,1114), +( 115, 177,1,'Checking', 2329.205387,1115), +( 116, 178,2,'Checking', 332.32188,1116), +( 117, 179,2,'Checking', 2718.337876,1117), +( 118, 180,1,'Checking', 1188.955105,1118), +( 120, 262,1,'Checking', 2427.166818,1120), +( 121, 263,1,'Checking', 1933.819423,1121), +( 122, 264,1,'Checking', 549.3841173,1122), +( 123, 265,1,'Checking', 2429.47217,1123), +( 124, 266,1,'Checking', 1940.300551,1124), +( 125, 267,1,'Checking', 1683.467949,1125), +( 126, 368,1,'Checking', 1206.174575,1126), +( 127, 369,1,'Checking', 768.6893814,1127), +( 128, 370,2,'Checking', 1129.363835,1128), +( 129, 371,1,'Checking', 1418.82726,1129), +( 130, 372,1,'Checking', 1674.021154,1130), +( 131, 373,1,'Checking', 2477.973427,1131), +( 132,1007,1,'Checking', 370.7056947,1132), +( 133,1008,1,'Checking', 116.1817531,1133), +( 134,1009,1,'Checking', 520.6105051,1134), +( 135,1010,1,'Checking', 195.6016937,1135), +( 136,1011,1,'Checking', 106.0564091,1136), +( 138,1041,1,'Checking', 539.2325158,1138), +( 139,1042,1,'Checking', 101.1402553,1139), +( 140,1043,1,'Checking', 950.7055043,1140), +( 141,1044,1,'Checking', 575.4253339,1141), +( 142,2127,1,'Checking', 345.6576006,1142), +( 143,2128,2,'Checking', 235.6670355,1143), +( 144,2129,2,'Checking', 345.3365138,1144), +( 145,2130,2,'Checking', 137.687037,1145), +( 146,2131,1,'Checking', 100.7461097,1146), +( 147,2132,1,'Checking', 686.8912253,1147), +( 148,2223,2,'Checking', 57.94033953,1148), +( 149,2224,2,'Checking', 209.6814143,1149), +( 150,2225,2,'Checking', 272.993464,1150), +( 151,2226,1,'Checking', 273.1754423,1151), +( 152,2227,2,'Checking', 155.3547925,1152), +( 153,2228,1,'Checking', 269.5428597,1153), +( 154,2229,1,'Checking', 151.1208164,1154), +( 155,2154,2,'Checking', 8.275955916,1155), +( 156,2155,2,'Checking', 227.8439034,1156), +( 157,2156,2,'Checking', 351.6053223,1157), +( 158,2157,2,'Checking', 175.8251799,1158), +( 159,2158,2,'Checking', 636.3168721,1159), +( 160,2159,2,'Checking', 808.5135018,1160), +( 161,2160,2,'Checking', 322.3511567,1161), +( 162,2161,1,'Checking', 113.6516125,1162), +( 163,2162,2,'Checking', 634.4714832,1163), +( 164,3034,2,'Checking', 803.0728587,1164), +( 165,3035,2,'Checking', 1374.49218,1165), +( 166,3036,2,'Checking', 737.7980341,1166), +( 167,3037,1,'Checking', 880.1150966,1167), +( 168,3038,2,'Checking', 1714.550973,1168), +( 169,3039,1,'Checking', 1296.540013,1169), +( 170,3084,2,'Checking', 935.6609093,1170), +( 171,3085,2,'Checking', 534.2058106,1171), +( 172,3086,2,'Checking', 416.365382,1172), +( 173,3087,2,'Checking', 1222.481322,1173), +( 174,3088,2,'Checking', 1234.423716,1174), +( 175,4030,1,'Checking', 342.3687716,1175), +( 176,4031,1,'Checking', 219.8221082,1176), +( 177,4032,1,'Checking', 821.8153705,1177), +( 178,4033,1,'Checking', 333.0223163,1178), +( 179,4034,1,'Checking', 78.67911241,1179), +( 180,4035,1,'Checking', 692.0828828,1180), +( 181,4036,1,'Checking', 1465.075807,1181), +( 182,4037,1,'Checking', 1823.983833,1182), +( 183,4038,1,'Checking', 733.0881632,1183), +( 184,4039,1,'Checking', 1100.820315,1184), +( 185,4097,1,'Checking', 38.94935605,1185), +( 186,4099,1,'Checking', 150.0550955,1186), +( 187,4100,1,'Checking', 159.8017401,1187), +( 188,4101,1,'Checking', 363.2827794,1188), +( 189,4102,1,'Checking', 1242.323194,1189), +( 191,4430,1,'Checking', 240.9412472,1191), +( 192,4431,1,'Checking', 393.6994475,1192), +( 193,4432,1,'Checking', 873.6447408,1193), +( 194,4433,1,'Checking', 849.881861,1194), +( 195,4434,1,'Checking', 920.8499389,1195), +( 197,4436,1,'Checking', 769.2452027,1197), +( 198,4437,1,'Checking', 203.4685531,1198), +( 199, 124,1,'Saving', 25947.23173,1199), +( 200, 125,2,'Saving', 204755.0108,1200), +( 201, 126,1,'Saving', 114390.855,1201), +( 202, 127,1,'Saving', 202659.7704,1202), +( 203, 135,1,'Saving', 105370.5459,1203), +( 204, 136,1,'Saving', 16331.64918,1204), +( 206, 138,1,'Saving', 77485.47104,1206), +( 207, 139,1,'Saving', 101003.4193,1207), +( 208, 156,1,'Saving', 30627.54354,1208), +( 209, 157,1,'Saving', 84310.68934,1209), +( 210, 158,1,'Saving', 95724.16915,1210), +( 211, 159,1,'Saving', 58738.6481,1211), +( 212, 160,1,'Saving', 33947.76889,1212), +( 213, 176,2,'Saving', 50009.22738,1213), +( 214, 177,1,'Saving', 53839.09653,1214), +( 215, 178,2,'Saving', 37252.65724,1215), +( 216, 179,2,'Saving', 38832.03591,1216), +( 217, 180,1,'Saving', 157923.6088,1217), +( 219, 262,1,'Saving', 161690.7533,1219), +( 220, 263,1,'Saving', 60963.05602,1220), +( 221, 264,1,'Saving', 129716.7982,1221), +( 222, 265,1,'Saving', 146258.3654,1222), +( 223, 266,1,'Saving', 189802.0553,1223), +( 224, 267,1,'Saving', 224976.7577,1224), +( 225, 368,1,'Saving', 39103.89544,1225), +( 226, 369,1,'Saving', 46182.78934,1226), +( 227, 370,2,'Saving', 45155.12824,1227), +( 228, 371,1,'Saving', 118843.0557,1228), +( 229, 372,1,'Saving', 146979.6841,1229), +( 230, 373,1,'Saving', 79742.70174,1230), +( 231,1007,1,'Saving', 18766.24436,1231), +( 232,1008,1,'Saving', 56978.37152,1232), +( 233,1009,1,'Saving', 39892.98345,1233), +( 234,1010,1,'Saving', 14340.12927,1234), +( 235,1011,1,'Saving', 24524.27683,1235), +( 236,1012,2,'Saving', 30944.41188,1236), +( 237,1041,1,'Saving', 39186.16525,1237), +( 238,1042,1,'Saving', 17185.41623,1238), +( 239,1043,1,'Saving', 59682.25556,1239), +( 240,1044,1,'Saving', 7648.203145,1240), +( 241,2127,1,'Saving', 13560.58125,1241), +( 242,2128,2,'Saving', 14369.43733,1242), +( 243,2129,2,'Saving', 36340.46654,1243), +( 244,2130,2,'Saving', 14979.87798,1244), +( 245,2131,1,'Saving', 14515.74201,1245), +( 246,2132,1,'Saving', 305.3633823,1246), +( 247,2223,2,'Saving', 12417.23338,1247), +( 248,2224,2,'Saving', 39457.64595,1248), +( 249,2225,2,'Saving', 23017.44714,1249), +( 250,2226,1,'Saving', 7742.484165,1250), +( 251,2227,2,'Saving', 17624.66363,1251), +( 252,2228,1,'Saving', 1535.394306,1252), +( 253,2229,1,'Saving', 1226.676885,1253), +( 254,2154,2,'Saving', 22547.57602,1254), +( 255,2155,2,'Saving', 12486.17339,1255), +( 256,2156,2,'Saving', 38364.90976,1256), +( 257,2157,2,'Saving', 1734.126161,1257), +( 258,2158,2,'Saving', 60251.94392,1258), +( 259,2159,2,'Saving', 46657.42166,1259), +( 260,2160,2,'Saving', 9505.175495,1260), +( 261,2161,1,'Saving', 32381.25655,1261), +( 262,2162,2,'Saving', 34863.35359,1262), +( 263,3034,2,'Saving', 48563.18138,1263), +( 264,3035,2,'Saving', 48493.01592,1264), +( 265,3036,2,'Saving', 173101.6616,1265), +( 266,3037,1,'Saving', 88026.78844,1266), +( 267,3038,2,'Saving', 143707.0279,1267), +( 268,3039,1,'Saving', 99494.98056,1268), +( 269,3084,2,'Saving', 88987.75075,1269), +( 270,3085,2,'Saving', 25567.8175,1270), +( 271,3086,2,'Saving', 112184.2155,1271), +( 272,3087,2,'Saving', 168562.1903,1272), +( 273,3088,2,'Saving', 185847.5828,1273), +( 274,4030,1,'Saving', 44559.8743,1274), +( 275,4031,1,'Saving', 26054.6617,1275), +( 276,4032,1,'Saving', 58280.98421,1276), +( 277,4033,1,'Saving', 33446.0035,1277), +( 278,4034,1,'Saving', 88012.34913,1278), +( 279,4035,1,'Saving', 84526.49687,1279), +( 280,4036,1,'Saving', 78822.73393,1280), +( 281,4037,1,'Saving', 10788.06735,1281), +( 282,4038,1,'Saving', 101492.5752,1282), +( 283,4039,1,'Saving', 21233.41511,1283), +( 284,4097,1,'Saving', 77413.15157,1284), +( 285,4099,1,'Saving', 84883.84174,1285), +( 286,4100,1,'Saving', 69186.40003,1286), +( 287,4101,1,'Saving', 28291.18589,1287), +( 288,4102,1,'Saving', 21900.57646,1288), +( 290,4430,1,'Saving', 22028.39868,1290), +( 291,4431,1,'Saving', 69694.60985,1291), +( 292,4432,1,'Saving', 70770.24328,1292), +( 293,4433,1,'Saving', 52412.67197,1293), +( 294,4434,1,'Saving', 61382.88758,1294), +( 296,4436,1,'Saving', 46565.86445,1296), +( 297,4437,1,'Saving', 78073.61351,1297); +-- end of ACCOUNT DATA + +--========================================================================== +-- TRANSACTION DATA +--========================================================================== +INSERT INTO sa_demo.transactions( + TRANSACTION_ID, TRANSACTION_DATE, ACCOUNT_ID, AMOUNT) VALUES +( 200,'6/9/1999', 100,410.0649), +( 203,'3/16/1999', 101,134.6683), +( 206,'5/8/2000', 102,128.8427), +( 209,'2/14/1999', 103,55.29605), +( 212,'5/24/2000', 104, 246.328), +( 215,'1/20/2000', 105,217.8844), +( 221,'6/15/2000', 107,249.6642), +( 224,'6/2/1999', 108,120.8983), +( 227,'2/27/1999', 109,116.1058), +( 230,'2/6/1999', 110,187.5347), +( 233,'6/23/2000', 111,48.13646), +( 236,'5/27/1999', 112,26.88456), +( 239,'4/4/1999', 113,7.963927), +( 242,'12/14/1999', 114,6.796708), +( 245,'6/17/2000', 115,59.15062), +( 248,'1/20/2000', 116,16.10502), +( 251,'10/3/1999', 117,513.2409), +( 254,'10/4/1999', 118,136.2889), +( 260,'6/28/2000', 120,421.2396), +( 263,'5/10/1999', 121,186.4202), +( 266,'5/23/2000', 122,102.4402), +( 269,'12/19/1999', 123, 248.581), +( 272,'7/22/1999', 124, 226.448), +( 275,'11/2/2000', 125,48.19283), +( 278,'8/20/1999', 126, 228.173), +( 281,'10/3/1999', 127,68.18768), +( 284,'1/3/1999', 128,31.63948), +( 287,'6/22/1999', 129,256.2542), +( 290,'11/28/1999', 130,19.16289), +( 293,'11/16/2000', 131,162.1792), +( 296,'7/26/1999', 132,3.779025), +( 299,'2/17/1999', 133,18.46187), +( 302,'4/24/2000', 134,25.31652), +( 305,'1/1/2000', 135,4.483854), +( 308,'7/2/2000', 136,18.33536), +( 314,'10/17/1999', 138,21.03512), +( 317,'1/21/1999', 139,15.50602), +( 320,'7/20/1999', 140, 114.246), +( 323,'11/8/2000', 141,16.60923), +( 326,'8/24/1999', 142,40.86036), +( 329,'5/22/1999', 143,44.24424), +( 332,'4/1/1999', 144,14.28121), +( 335,'11/6/2000', 145,25.39269), +( 338,'11/28/2000', 146,6.341318), +( 341,'1/10/2000', 147,7.487512), +( 344,'9/12/1999', 148,5.611813), +( 347,'2/1/1999', 149,11.63708), +( 350,'4/13/1999', 150,26.33636), +( 353,'1/19/1999', 151, 26.9734), +( 356,'9/18/1999', 152, 26.3779), +( 359,'10/26/1999', 153,44.01659), +( 362,'2/20/1999', 154,3.055476), +( 365,'6/4/2000', 155,0.088982), +( 368,'11/27/2000', 156,8.333825), +( 371,'5/6/2000', 157,22.51631), +( 374,'3/21/1999', 158,29.04578), +( 377,'1/23/2000', 159,26.38774), +( 380,'10/18/1999', 160,92.33102), +( 383,'12/24/1999', 161,59.83667), +( 386,'2/8/1999', 162,8.266304), +( 389,'3/17/2000', 163,101.5791), +( 392,'11/5/2000', 164,150.8449), +( 395,'9/25/1999', 165,228.3387), +( 398,'7/24/2000', 166,121.3898), +( 401,'4/16/1999', 167,78.65684), +( 404,'7/19/2000', 168,266.9651), +( 407,'2/7/2000', 169,34.14283), +( 410,'2/4/1999', 170,62.29798), +( 413,'4/11/2000', 171,75.89482), +( 416,'8/5/2000', 172,48.03834), +( 419,'2/11/1999', 173,176.7392), +( 422,'3/15/2000', 174,129.5668), +( 425,'12/6/1999', 175,23.25297), +( 428,'8/20/2000', 176,14.07896), +( 431,'7/12/2000', 177,39.66607), +( 434,'5/9/1999', 178, 22.162), +( 437,'12/9/2000', 179,0.869688), +( 440,'9/12/1999', 180,138.2647), +( 446,'7/24/1999', 182,225.1657), +( 449,'5/7/2000', 183,12.54472), +( 452,'2/18/1999', 184,110.9305), +( 455,'5/12/2000', 185,4.345138), +( 458,'8/27/1999', 186,8.993184), +( 461,'6/16/2000', 187, 6.36054), +( 464,'5/25/2000', 188,52.51078), +( 467,'7/22/2000', 189,25.45362), +( 473,'11/2/2000', 191,40.43505), +( 476,'8/20/1999', 192,5.576618), +( 479,'11/13/1999', 193,133.9944), +( 482,'9/20/2000', 194,109.4392), +( 485,'7/4/2000', 195,84.65599), +( 491,'2/6/1999', 197,16.62518), +( 494,'8/9/2000', 198, 19.734), +( 497,'7/1/1999', 199,4172.654), +( 500,'5/14/1999', 200,38353.48), +( 503,'4/12/1999', 201,6068.544), +( 506,'4/16/1999', 202,11277.34), +( 509,'12/12/1999', 203,15628.58), +( 512,'5/23/2000', 204,1544.129), +( 518,'1/24/2000', 206, 134.573), +( 521,'12/25/1999', 207,9989.299), +( 524,'3/10/2000', 208,4443.906), +( 527,'4/2/1999', 209,1784.336), +( 530,'2/20/1999', 210, 8814.86), +( 533,'4/3/2000', 211,1133.963), +( 536,'12/4/2000', 212,1321.064), +( 539,'12/2/1999', 213,1134.468), +( 542,'9/11/2000', 214,1791.388), +( 545,'5/22/2000', 215,611.6733), +( 548,'3/1/2000', 216,3846.393), +( 551,'1/14/1999', 217,5136.206), +( 557,'4/14/1999', 219,1806.315), +( 560,'11/27/2000', 220,9556.921), +( 563,'9/7/2000', 221,5052.018), +( 566,'8/24/2000', 222,19897.25), +( 569,'8/10/1999', 223,20643.46), +( 572,'5/19/1999', 224,1010.197), +( 575,'7/26/1999', 225,5505.485), +( 578,'2/4/2000', 226,7053.833), +( 581,'9/14/1999', 227,3386.158), +( 584,'7/24/1999', 228,13494.65), +( 587,'12/21/1999', 229,2740.613), +( 590,'4/25/1999', 230, 13284.4), +( 593,'3/24/1999', 231,2445.456), +( 596,'9/23/1999', 232,1760.232), +( 599,'12/5/2000', 233,1687.219), +( 602,'7/11/2000', 234,115.0738), +( 605,'2/8/2000', 235,1271.798), +( 608,'11/20/1999', 236,4541.155), +( 611,'4/15/1999', 237, 3677.7), +( 614,'1/17/1999', 238,2795.182), +( 617,'5/17/2000', 239,774.5752), +( 620,'4/20/2000', 240,782.5478), +( 623,'2/18/1999', 241,1436.765), +( 626,'1/1/2000', 242,2771.544), +( 629,'11/19/1999', 243,3420.935), +( 632,'1/7/2000', 244,2231.038), +( 635,'9/9/1999', 245,2025.772), +( 638,'10/25/2000', 246,9.387454), +( 641,'12/18/2000', 247,1969.252), +( 644,'3/15/1999', 248,6195.007), +( 647,'10/1/2000', 249,4103.657), +( 650,'11/9/1999', 250,1359.439), +( 653,'4/17/1999', 251,530.9645), +( 656,'5/28/2000', 252,171.7705), +( 659,'3/25/2000', 253,190.8625), +( 662,'1/22/2000', 254,2765.804), +( 665,'10/7/2000', 255, 1720.33), +( 668,'2/11/1999', 256,6441.007), +( 671,'6/23/1999', 257,121.6101), +( 674,'7/24/1999', 258,9957.765), +( 677,'10/5/1999', 259,6853.639), +( 680,'4/28/1999', 260,726.6378), +( 683,'11/9/2000', 261, 769.309), +( 686,'2/7/1999', 262,5860.827), +( 689,'5/5/2000', 263,1754.494), +( 692,'3/17/2000', 264,2713.556), +( 695,'12/19/1999', 265,417.2778), +( 698,'7/20/1999', 266, 10273.4), +( 701,'8/11/1999', 267,4018.836), +( 704,'8/24/2000', 268,9078.658), +( 707,'3/21/2000', 269,16283.33), +( 710,'12/8/1999', 270, 3269.45), +( 713,'6/14/1999', 271,10040.68), +( 716,'11/24/2000', 272,6451.387), +( 719,'11/17/1999', 273,22634.37), +( 722,'12/22/2000', 274,6310.148), +( 725,'5/17/1999', 275,5195.875), +( 728,'12/22/1999', 276, 9716.49), +( 731,'11/21/2000', 277,6015.548), +( 734,'9/8/2000', 278,2858.153), +( 737,'12/21/1999', 279,14701.36), +( 740,'4/17/1999', 280,13436.15), +( 743,'12/4/2000', 281,1437.694), +( 746,'9/2/2000', 282,5929.765), +( 749,'9/28/2000', 283,851.2012), +( 752,'10/18/1999', 284,11199.08), +( 755,'7/6/2000', 285,867.0179), +( 758,'12/3/2000', 286,10766.49), +( 761,'9/4/2000', 287,4060.866), +( 764,'11/10/1999', 288,2868.957), +( 770,'6/13/1999', 290,3921.282), +( 773,'6/6/1999', 291,5691.669), +( 776,'10/22/2000', 292,5842.467), +( 779,'8/8/2000', 293,995.6348), +( 782,'10/19/1999', 294,164.2341), +( 788,'10/6/1999', 296,3120.884), +( 791,'5/24/2000', 297,4215.467), +( 794,'10/16/1999', 100,265.6453), +( 797,'8/19/1999', 101,539.0321), +( 800,'11/13/1999', 102,78.76525), +( 803,'11/9/2000', 103,68.03113), +( 806,'11/21/1999', 104,200.9549), +( 809,'3/24/1999', 105,215.4605), +( 815,'5/2/1999', 107,66.71727), +( 818,'6/9/2000', 108,623.4824), +( 821,'5/6/1999', 109,109.9385), +( 824,'6/24/2000', 110,32.86801), +( 827,'8/26/2000', 111,151.9085), +( 830,'1/26/2000', 112,11.68539), +( 833,'4/19/1999', 113,13.75836), +( 836,'10/6/2000', 114,80.53244), +( 839,'6/26/1999', 115, 20.9271), +( 842,'4/1/2000', 116,26.76104), +( 845,'1/16/2000', 117,278.6843), +( 848,'12/19/1999', 118,109.5831), +( 854,'9/8/2000', 120,161.5764), +( 857,'4/20/1999', 121,49.81852), +( 860,'11/7/1999', 122, 26.4448), +( 863,'10/27/2000', 123, 436.118), +( 866,'4/11/2000', 124,46.06044), +( 869,'4/23/2000', 125,305.0076), +( 872,'10/9/1999', 126,232.3231), +( 875,'8/2/1999', 127, 61.2963), +( 878,'3/14/2000', 128,205.2637), +( 881,'9/19/2000', 129,34.73888), +( 884,'1/14/2000', 130,170.3945), +( 887,'1/19/1999', 131,241.7908), +( 890,'1/9/2000', 132,50.60082), +( 893,'11/14/1999', 133,22.68992), +( 896,'2/6/2000', 134, 26.9585), +( 899,'8/7/1999', 135,38.72871), +( 902,'6/26/1999', 136,18.99279), +( 908,'5/1/1999', 138,95.14236), +( 911,'10/4/2000', 139,6.336616), +( 914,'11/9/2000', 140,138.0959), +( 917,'2/26/2000', 141,2.088899), +( 920,'6/12/2000', 142,32.59317), +( 923,'2/5/1999', 143, 22.6203), +( 926,'4/11/1999', 144, 35.478), +( 929,'6/21/2000', 145,27.32847), +( 932,'7/19/1999', 146,14.01379), +( 935,'1/11/1999', 147,98.60913), +( 938,'10/1/2000', 148,7.594179), +( 941,'4/17/1999', 149,14.74927), +( 944,'9/14/1999', 150,17.64516), +( 947,'10/21/2000', 151,8.414119), +( 950,'2/3/2000', 152,21.81273), +( 953,'5/24/2000', 153,45.43275), +( 956,'3/28/2000', 154,2.890876), +( 959,'5/27/1999', 155,0.941372), +( 962,'1/8/1999', 156,36.43327), +( 965,'4/19/2000', 157,22.75757), +( 968,'4/23/1999', 158, 18.3028), +( 971,'6/8/1999', 159,111.2169), +( 974,'8/25/2000', 160,144.8827), +( 977,'12/3/2000', 161,41.74191), +( 980,'12/3/2000', 162,20.86361), +( 983,'8/10/2000', 163,84.66857), +( 986,'2/9/2000', 164, 23.4569), +( 989,'10/21/1999', 165,141.7547), +( 992,'7/23/1999', 166,77.80529), +( 995,'12/24/2000', 167,111.2804), +( 998,'10/26/1999', 168,333.6068), +(1001,'2/6/2000', 169,197.2564), +(1004,'6/15/1999', 170,14.14601), +(1007,'9/16/1999', 171,65.91726), +(1010,'1/10/1999', 172,35.38287), +(1013,'3/19/1999', 173,41.68522), +(1016,'2/5/1999', 174,157.0025), +(1019,'7/28/2000', 175,49.59643), +(1022,'1/13/2000', 176,30.31786), +(1025,'1/17/2000', 177,126.8564), +(1028,'6/22/2000', 178,7.913088), +(1031,'4/16/2000', 179,0.261574), +(1034,'10/23/1999', 180,64.25004), +(1040,'10/7/2000', 182,29.98905), +(1043,'8/1/2000', 183,83.81477), +(1046,'4/9/1999', 184,96.80246), +(1049,'9/23/1999', 185,2.654964), +(1052,'2/8/2000', 186,12.90884), +(1055,'3/22/2000', 187,18.68655), +(1058,'2/19/1999', 188,25.10699), +(1061,'4/12/1999', 189,230.6099), +(1067,'2/17/1999', 191,25.50788), +(1070,'10/15/2000', 192,66.20551), +(1073,'8/16/1999', 193,145.7211), +(1076,'9/6/1999', 194,129.9411), +(1079,'6/20/2000', 195,5.229966), +(1085,'7/22/1999', 197,110.2286), +(1088,'12/8/2000', 198,27.85117), +(1091,'1/22/1999', 199,4147.848), +(1094,'2/2/1999', 200,40630.21), +(1097,'3/26/2000', 201,6341.582), +(1100,'5/27/2000', 202,19718.14), +(1103,'1/7/2000', 203,20412.81), +(1106,'11/27/2000', 204,98.19314), +(1112,'1/11/1999', 206,9746.122), +(1115,'2/28/2000', 207,12884.93), +(1118,'6/21/1999', 208,3053.719), +(1121,'8/1/2000', 209,3781.076), +(1124,'11/22/2000', 210,8038.879), +(1127,'9/16/2000', 211, 354.355), +(1130,'12/19/2000', 212,3048.593), +(1133,'6/4/2000', 213,9616.066), +(1136,'8/1/2000', 214, 4383.46), +(1139,'9/18/2000', 215,1728.502), +(1142,'9/18/1999', 216,5088.025), +(1145,'8/23/1999', 217,8403.177), +(1151,'11/14/1999', 219, 7516.24), +(1154,'2/14/2000', 220,10618.38), +(1157,'3/7/1999', 221,4955.935), +(1160,'4/18/1999', 222,8996.822), +(1163,'1/4/1999', 223,31032.86), +(1166,'2/5/2000', 224,42096.04), +(1169,'5/12/1999', 225,3026.361), +(1172,'10/20/2000', 226,5415.512), +(1175,'2/6/2000', 227,3518.782), +(1178,'7/11/1999', 228,18853.91), +(1181,'8/26/2000', 229,14540.79), +(1184,'2/12/2000', 230,3190.184), +(1187,'12/25/1999', 231,2644.192), +(1190,'4/22/1999', 232,2037.797), +(1193,'9/11/2000', 233,3369.338), +(1196,'7/2/1999', 234,1695.653), +(1199,'10/3/2000', 235,3178.529), +(1202,'2/5/1999', 236,3617.337), +(1205,'11/12/1999', 237,3787.433), +(1208,'7/20/1999', 238,1108.258), +(1211,'2/13/2000', 239,10837.12), +(1214,'8/19/1999', 240,1089.209), +(1217,'10/16/1999', 241,1176.584), +(1220,'7/21/1999', 242,2316.119), +(1223,'11/17/1999', 243,991.6162), +(1226,'11/3/2000', 244, 393.124), +(1229,'5/8/2000', 245,2604.353), +(1232,'8/16/1999', 246,25.90977), +(1235,'12/2/1999', 247,1787.568), +(1238,'9/1/2000', 248, 2377.79), +(1241,'4/2/1999', 249,1698.527), +(1244,'8/23/2000', 250,1267.302), +(1247,'6/20/2000', 251,2808.839), +(1250,'1/3/1999', 252,20.07844), +(1253,'10/5/2000', 253,88.35182), +(1256,'9/8/1999', 254,69.99725), +(1259,'11/25/2000', 255,1633.452), +(1262,'12/5/2000', 256,1299.553), +(1265,'9/20/2000', 257,197.3139), +(1268,'9/22/2000', 258,6281.389), +(1271,'4/23/2000', 259,4748.887), +(1274,'11/15/1999', 260,414.1412), +(1277,'10/4/2000', 261,4661.834), +(1280,'10/4/1999', 262,4974.991), +(1283,'6/6/2000', 263,4678.143), +(1286,'1/22/2000', 264,5313.296), +(1289,'3/19/1999', 265,19422.03), +(1292,'9/26/1999', 266,14053.36), +(1295,'10/7/2000', 267,21816.82), +(1298,'3/11/2000', 268, 1338.64), +(1301,'12/25/1999', 269,15786.09), +(1304,'8/4/2000', 270,1279.132), +(1307,'3/12/2000', 271,19843.18), +(1310,'3/17/1999', 272,30949.97), +(1313,'11/27/1999', 273,17072.19), +(1316,'8/13/1999', 274,509.6888), +(1319,'8/13/2000', 275, 4630.61), +(1322,'12/5/2000', 276,5630.218), +(1325,'9/25/2000', 277,6595.324), +(1328,'6/7/1999', 278,6732.644), +(1331,'12/8/1999', 279,9735.542), +(1334,'12/26/1999', 280,15728.74), +(1337,'4/4/1999', 281,1957.673), +(1340,'8/7/1999', 282,2560.619), +(1343,'3/17/2000', 283,474.9938), +(1346,'6/19/1999', 284,10766.51), +(1349,'7/12/2000', 285,11223.75), +(1352,'10/3/2000', 286,1553.378), +(1355,'12/25/1999', 287,4076.504), +(1358,'11/26/2000', 288,3494.722), +(1364,'4/24/2000', 290,1376.821), +(1367,'8/14/2000', 291,5235.508), +(1370,'9/23/1999', 292,190.3102), +(1373,'6/26/2000', 293,2735.294), +(1376,'6/2/2000', 294,10877.28), +(1382,'4/7/1999', 296, 9086.92), +(1385,'2/26/2000', 297,9702.064), +(1388,'3/12/1999', 100,188.7422), +(1391,'12/26/2000', 101,576.3459), +(1394,'2/24/1999', 102,67.87226), +(1397,'11/27/1999', 103,49.16274), +(1400,'3/2/2000', 104,152.5284), +(1403,'8/22/1999', 105,138.3044), +(1409,'8/5/1999', 107,24.79981), +(1412,'6/25/2000', 108,160.5938), +(1415,'6/18/1999', 109,56.72258), +(1418,'8/20/1999', 110,36.32044), +(1421,'2/17/2000', 111,131.5891), +(1424,'2/19/2000', 112,64.13718), +(1427,'8/26/2000', 113,15.60056), +(1430,'12/21/1999', 114,2.275107), +(1433,'5/23/2000', 115,353.9784), +(1436,'4/2/2000', 116,59.10805), +(1439,'4/3/1999', 117,117.4123), +(1442,'10/20/2000', 118,44.62285), +(1448,'11/8/1999', 120,482.0618), +(1451,'12/1/2000', 121,0.158674), +(1454,'2/6/2000', 122,26.42557), +(1457,'8/15/2000', 123,86.99796), +(1460,'3/14/1999', 124,245.3788), +(1463,'2/15/1999', 125,81.07891), +(1466,'9/8/2000', 126,47.85189), +(1469,'2/16/2000', 127,50.21799), +(1472,'11/23/2000', 128, 47.351), +(1475,'6/22/2000', 129,12.46757), +(1478,'4/24/1999', 130,237.2425), +(1481,'3/25/2000', 131,186.9159), +(1484,'6/2/1999', 132,18.42853), +(1487,'8/27/1999', 133,7.432432), +(1490,'7/15/2000', 134,60.26388), +(1493,'8/10/2000', 135,16.37941), +(1496,'10/2/2000', 136,4.143121), +(1502,'10/8/1999', 138,7.242031), +(1505,'8/24/2000', 139,14.24114), +(1508,'8/9/2000', 140,91.99023), +(1511,'7/1/1999', 141, 70.151), +(1514,'3/13/2000', 142,46.92224), +(1517,'6/27/2000', 143,4.914297), +(1520,'9/14/2000', 144,12.68786), +(1523,'3/18/1999', 145,9.831023), +(1526,'12/14/2000', 146,7.424878), +(1529,'6/24/1999', 147,26.91243), +(1532,'4/14/2000', 148,1.705627), +(1535,'2/20/1999', 149, 31.3328), +(1538,'7/28/1999', 150, 54.4283), +(1541,'12/3/1999', 151,30.67218), +(1544,'10/11/1999', 152, 22.6467), +(1547,'3/18/2000', 153,24.05183), +(1550,'3/15/1999', 154, 28.5632), +(1553,'8/7/1999', 155,0.826164), +(1556,'11/23/1999', 156,9.920162), +(1559,'8/21/1999', 157,14.64077), +(1562,'3/17/1999', 158,32.81727), +(1565,'3/25/1999', 159,66.04171), +(1568,'6/24/1999', 160, 112.243), +(1571,'7/2/2000', 161,18.21168), +(1574,'4/27/2000', 162,10.61284), +(1577,'10/19/1999', 163,83.85694), +(1580,'12/10/2000', 164, 52.8986), +(1583,'12/28/2000', 165,211.4837), +(1586,'11/4/1999', 166,97.49797), +(1589,'10/20/1999', 167,53.01525), +(1592,'10/14/1999', 168,46.53771), +(1595,'5/22/1999', 169,15.11523), +(1598,'5/25/2000', 170,127.9403), +(1601,'5/25/1999', 171,77.36744), +(1604,'6/9/1999', 172,78.45289), +(1607,'9/8/1999', 173,178.9362), +(1610,'6/3/2000', 174,190.9741), +(1613,'7/22/2000', 175,6.944259), +(1616,'12/27/2000', 176, 9.10269), +(1619,'4/26/2000', 177,101.4788), +(1622,'6/11/2000', 178, 50.6176), +(1625,'11/19/2000', 179,14.27261), +(1628,'4/9/1999', 180,137.7139), +(1634,'11/1/1999', 182,101.6721), +(1637,'9/11/1999', 183, 60.1139), +(1640,'4/17/2000', 184,190.7395), +(1643,'5/11/1999', 185, 5.05994), +(1646,'8/21/1999', 186,14.38241), +(1649,'4/26/1999', 187,25.71961), +(1652,'4/3/1999', 188,37.35634), +(1655,'5/7/1999', 189,167.6363), +(1661,'5/13/1999', 191,12.41107), +(1664,'11/18/1999', 192,50.95264), +(1667,'8/2/2000', 193,67.62999), +(1670,'7/16/1999', 194,83.97284), +(1673,'1/9/2000', 195,8.462688), +(1679,'10/3/1999', 197, 77.3681), +(1682,'3/10/2000', 198,1.117515), +(1685,'9/20/1999', 199,4732.466), +(1688,'12/20/2000', 200,15504.25), +(1691,'9/18/1999', 201,11203.11), +(1694,'9/5/2000', 202,16689.98), +(1697,'10/4/1999', 203,4997.475), +(1700,'6/2/1999', 204,473.3774), +(1706,'4/10/2000', 206,4661.805), +(1709,'8/4/1999', 207,11006.09), +(1712,'5/28/2000', 208, 380.71), +(1715,'1/21/1999', 209,10150.82), +(1718,'4/7/2000', 210,6567.307), +(1721,'3/12/2000', 211,1610.885), +(1724,'7/27/1999', 212,6091.375), +(1727,'10/28/2000', 213,3054.828), +(1730,'4/6/1999', 214, 8658.91), +(1733,'1/11/1999', 215,5509.121), +(1736,'10/9/1999', 216, 926.55), +(1739,'7/21/2000', 217,27760.22), +(1745,'6/2/1999', 219,10328.86), +(1748,'7/1/2000', 220,679.4078), +(1751,'9/4/1999', 221,12090.48), +(1754,'2/12/1999', 222,3772.923), +(1757,'10/5/2000', 223,35608.31), +(1760,'10/9/2000', 224,30748.52), +(1763,'9/3/2000', 225,4682.998), +(1766,'5/7/1999', 226,8499.817), +(1769,'5/20/1999', 227,7709.753), +(1772,'12/2/1999', 228,8610.715), +(1775,'11/11/2000', 229, 2641.61), +(1778,'4/3/2000', 230,12071.88), +(1781,'6/2/2000', 231,3715.188), +(1784,'1/24/1999', 232,7048.929), +(1787,'7/28/1999', 233,853.6858), +(1790,'3/17/1999', 234,82.34863), +(1793,'10/25/2000', 235,972.5005), +(1796,'1/27/1999', 236,2789.688), +(1799,'6/20/2000', 237,829.3602), +(1802,'6/13/2000', 238,1718.027), +(1805,'12/11/2000', 239,2874.005), +(1808,'8/22/2000', 240,1326.661), +(1811,'8/2/1999', 241,2673.106), +(1814,'7/23/2000', 242,2727.875), +(1817,'10/18/2000', 243,1742.129), +(1820,'11/22/2000', 244,779.3618), +(1823,'8/20/2000', 245,26.86364), +(1826,'8/15/1999', 246,5.360506), +(1829,'5/4/1999', 247,560.6894), +(1832,'12/25/2000', 248,3984.985), +(1835,'12/2/1999', 249,2396.236), +(1838,'3/9/1999', 250,459.5467), +(1841,'9/12/2000', 251,2766.734), +(1844,'8/23/1999', 252,231.6356), +(1847,'8/18/1999', 253,94.30295), +(1850,'11/26/1999', 254,1104.924), +(1853,'12/16/1999', 255,1393.034), +(1856,'9/9/1999', 256,5095.222), +(1859,'3/10/1999', 257,283.8402), +(1862,'4/6/2000', 258, 8110.89), +(1865,'12/14/2000', 259,5057.524), +(1868,'4/20/1999', 260,87.03693), +(1871,'3/19/1999', 261, 5541.51), +(1874,'9/16/1999', 262,4953.092), +(1877,'12/12/2000', 263,6178.717), +(1880,'3/8/2000', 264,8376.747), +(1883,'1/23/1999', 265,23313.55), +(1886,'8/10/1999', 266,12911.57), +(1889,'4/4/2000', 267,23678.95), +(1892,'8/20/2000', 268,7156.746), +(1895,'5/5/1999', 269,6572.862), +(1898,'1/2/2000', 270,1186.186), +(1901,'9/25/1999', 271,8418.143), +(1904,'11/23/2000', 272,33049.09), +(1907,'2/7/2000', 273,35906.11), +(1910,'9/28/1999', 274,3484.518), +(1913,'12/19/2000', 275,787.9008), +(1916,'12/2/2000', 276,1880.011), +(1919,'8/26/1999', 277,1512.381), +(1922,'4/26/1999', 278,11789.42), +(1925,'10/17/2000', 279,15526.06), +(1928,'6/24/2000', 280,15046.52), +(1931,'5/23/1999', 281,1928.325), +(1934,'5/25/2000', 282,10937.21), +(1937,'1/23/1999', 283,4017.299), +(1940,'1/18/2000', 284,11313.78), +(1943,'11/27/1999', 285,13807.37), +(1946,'12/2/1999', 286,10054.29), +(1949,'12/18/2000', 287,1341.674), +(1952,'8/20/1999', 288,4182.189), +(1958,'3/13/1999', 290, 489.583), +(1961,'10/22/1999', 291,8001.026), +(1964,'11/4/2000', 292,7429.313), +(1967,'10/6/2000', 293, 1592.42), +(1970,'10/7/2000', 294,1674.686), +(1976,'12/28/1999', 296, 2713.18), +(1979,'5/14/1999', 297,5228.697), +(1982,'2/6/1999', 100,397.2972), +(1985,'5/8/1999', 101,270.0248), +(1988,'1/6/2000', 102,171.1764), +(1991,'8/28/1999', 103,25.89929), +(1994,'2/22/1999', 104,232.3206), +(1997,'5/6/1999', 105,235.2605), +(2003,'4/2/2000', 107,30.99789), +(2006,'11/10/1999', 108,608.7637), +(2009,'1/4/2000', 109,288.1529), +(2012,'2/8/2000', 110,76.10206), +(2015,'11/7/2000', 111,43.93914), +(2018,'12/28/1999', 112,10.25989), +(2021,'1/17/2000', 113,28.78546), +(2024,'1/18/1999', 114,58.15921), +(2027,'3/22/1999', 115, 187.817), +(2030,'12/11/2000', 116,54.81473), +(2033,'1/16/2000', 117,446.1077), +(2036,'1/5/1999', 118,203.5912), +(2042,'11/24/1999', 120,23.42961), +(2045,'5/22/1999', 121,87.14982), +(2048,'11/24/1999', 122, 20.3656), +(2051,'3/9/2000', 123,256.5047), +(2054,'2/17/1999', 124,286.4381), +(2057,'9/6/1999', 125,123.9119), +(2060,'12/9/2000', 126,142.6252), +(2063,'7/17/2000', 127,104.2036), +(2066,'9/8/1999', 128,201.5262), +(2069,'6/25/1999', 129,175.6191), +(2072,'4/6/1999', 130,104.4412), +(2075,'11/9/2000', 131,417.5754), +(2078,'9/22/1999', 132,9.971304), +(2081,'9/5/1999', 133,1.064763), +(2084,'11/15/1999', 134,25.05566), +(2087,'3/17/2000', 135,19.94687), +(2090,'3/14/2000', 136,16.79072), +(2096,'7/1/2000', 138,14.76112), +(2099,'2/26/1999', 139,8.636134), +(2102,'8/4/1999', 140,33.20779), +(2105,'11/12/1999', 141,49.57415), +(2108,'10/13/2000', 142,49.40475), +(2111,'11/9/1999', 143,36.55046), +(2114,'3/21/2000', 144,5.867452), +(2117,'9/5/2000', 145,14.63534), +(2120,'4/23/1999', 146,15.91529), +(2123,'3/26/1999', 147,73.85168), +(2126,'6/1/1999', 148,8.992213), +(2129,'3/26/2000', 149,8.362277), +(2132,'6/13/2000', 150,30.64562), +(2135,'6/16/2000', 151, 34.2395), +(2138,'6/9/1999', 152,30.33333), +(2141,'1/20/2000', 153,3.226211), +(2144,'1/14/1999', 154,28.97461), +(2147,'12/19/1999', 155, 0.30189), +(2150,'6/23/2000', 156, 21.0384), +(2153,'12/25/2000', 157,29.22727), +(2156,'6/22/1999', 158,2.647235), +(2159,'2/13/1999', 159,68.63482), +(2162,'4/19/2000', 160,130.3504), +(2165,'10/6/2000', 161,2.180321), +(2168,'7/16/1999', 162,7.910875), +(2171,'5/17/1999', 163,29.40676), +(2174,'7/3/2000', 164,24.30426), +(2177,'10/6/2000', 165,90.38355), +(2180,'3/2/2000', 166,36.46251), +(2183,'3/13/1999', 167,2.747963), +(2186,'2/6/2000', 168,182.0007), +(2189,'11/1/2000', 169, 191.417), +(2192,'1/19/1999', 170,171.5873), +(2195,'8/16/2000', 171,41.89359), +(2198,'8/6/1999', 172,11.04035), +(2201,'10/8/1999', 173,68.56703), +(2204,'4/10/2000', 174,106.7472), +(2207,'6/23/1999', 175,39.85807), +(2210,'6/18/2000', 176,41.44438), +(2213,'4/20/2000', 177,44.66734), +(2216,'8/13/1999', 178,11.21136), +(2219,'11/13/1999', 179,5.600994), +(2222,'5/11/2000', 180,123.0376), +(2228,'6/1/2000', 182,251.2471), +(2231,'11/27/1999', 183,35.94439), +(2234,'4/17/1999', 184,198.5348), +(2237,'7/3/2000', 185,2.967351), +(2240,'12/2/2000', 186,8.045825), +(2243,'7/21/2000', 187,5.728503), +(2246,'9/23/1999', 188,36.76644), +(2249,'10/26/2000', 189,232.8362), +(2255,'1/12/1999', 191,33.72641), +(2258,'10/3/2000', 192,64.46211), +(2261,'7/25/2000', 193,67.27182), +(2264,'6/24/1999', 194,61.60903), +(2267,'4/13/2000', 195,165.0446), +(2273,'4/11/1999', 197,113.3709), +(2276,'3/3/2000', 198,11.32904), +(2279,'11/14/1999', 199,1851.289), +(2282,'6/6/2000', 200,31405.72), +(2285,'7/13/2000', 201,716.3705), +(2288,'9/3/2000', 202,29606.56), +(2291,'7/25/2000', 203,20195.74), +(2294,'9/4/1999', 204,2842.049), +(2300,'1/7/2000', 206,5454.829), +(2303,'11/25/1999', 207,2206.141), +(2306,'1/28/2000', 208,4744.707), +(2309,'7/7/1999', 209, 6390.97), +(2312,'4/11/1999', 210,9539.196), +(2315,'12/24/2000', 211,7864.815), +(2318,'5/15/1999', 212, 872.542), +(2321,'1/7/2000', 213,3318.323), +(2324,'11/4/1999', 214,5763.722), +(2327,'6/9/1999', 215,944.3873), +(2330,'4/13/1999', 216,511.0076), +(2333,'6/28/1999', 217,12801.39), +(2339,'7/17/1999', 219,27869.35), +(2342,'3/11/2000', 220,623.9558), +(2345,'5/16/1999', 221,20758.23), +(2348,'4/8/1999', 222,10280.78), +(2351,'7/8/2000', 223,33963.38), +(2354,'4/7/1999', 224,4988.438), +(2357,'5/8/2000', 225,177.7306), +(2360,'4/4/1999', 226,3673.922), +(2363,'2/25/1999', 227,5418.243), +(2366,'12/6/2000', 228,9651.242), +(2369,'2/19/2000', 229,801.9194), +(2372,'8/12/2000', 230,2035.503), +(2375,'1/21/2000', 231,2476.122), +(2378,'1/9/1999', 232,4527.432), +(2381,'1/27/1999', 233,275.1983), +(2384,'8/24/1999', 234, 2747.21), +(2387,'8/22/2000', 235,2454.241), +(2390,'2/2/1999', 236,2111.672), +(2393,'8/9/1999', 237,1387.837), +(2396,'12/8/2000', 238, 1163), +(2399,'7/12/1999', 239,3890.431), +(2402,'4/21/2000', 240,239.6195), +(2405,'4/6/2000', 241,1842.653), +(2408,'8/20/1999', 242,2152.329), +(2411,'3/12/2000', 243,3005.124), +(2414,'8/2/1999', 244,2638.944), +(2417,'2/26/2000', 245,2431.208), +(2420,'5/23/2000', 246,42.41151), +(2423,'2/21/2000', 247,841.1042), +(2426,'7/17/2000', 248,3386.254), +(2429,'1/3/2000', 249,1843.864), +(2432,'10/11/2000', 250,1357.021), +(2435,'11/13/2000', 251,2883.029), +(2438,'4/13/2000', 252,236.1756), +(2441,'1/10/1999', 253,142.5996), +(2444,'7/15/1999', 254,2718.375), +(2447,'4/26/1999', 255,989.5613), +(2450,'4/27/2000', 256,6972.301), +(2453,'2/24/1999', 257,130.9576), +(2456,'11/10/1999', 258,6262.766), +(2459,'11/18/2000', 259,3086.867), +(2462,'10/28/2000', 260,20.02136), +(2465,'12/10/1999', 261,4172.872), +(2468,'12/10/2000', 262,1533.623), +(2471,'12/1/2000', 263,3092.681), +(2474,'10/9/2000', 264,3854.422), +(2477,'1/19/2000', 265,9572.416), +(2480,'12/15/1999', 266,12107.02), +(2483,'6/12/1999', 267,249.8177), +(2486,'3/8/1999', 268,11433.34), +(2489,'3/15/2000', 269,905.8667), +(2492,'5/15/2000', 270,431.7046), +(2495,'11/10/2000', 271,7490.943), +(2498,'7/4/2000', 272, 4332.43), +(2501,'3/20/1999', 273,11927.34), +(2504,'7/21/2000', 274,6024.322), +(2507,'9/20/1999', 275, 84.9894), +(2510,'5/15/2000', 276,4547.415), +(2513,'5/23/2000', 277,4440.402), +(2516,'9/28/1999', 278,9733.886), +(2519,'9/13/2000', 279,1155.452), +(2522,'10/20/2000', 280,7285.954), +(2525,'6/19/1999', 281,466.4518), +(2528,'11/1/1999', 282,8143.997), +(2531,'11/28/2000', 283,2163.073), +(2534,'10/22/1999', 284,9218.228), +(2537,'7/10/2000', 285,9369.708), +(2540,'6/28/2000', 286,7669.178), +(2543,'2/25/2000', 287,2292.681), +(2552,'10/21/1999', 290,3701.036), +(2555,'3/19/2000', 291,6146.988), +(2558,'2/16/1999', 292,3093.035), +(2561,'12/8/2000', 293, 3779.69), +(2564,'4/22/2000', 294,4568.839), +(2570,'4/23/2000', 296,8000.067), +(2573,'5/4/2000', 297, 7879.64); +-- end of TRANSACTION DATA diff --git a/spatial/bank/saBankDemoViewDDL.db2 b/spatial/bank/saBankDemoViewDDL.db2 new file mode 100644 index 0000000..226f9e3 --- /dev/null +++ b/spatial/bank/saBankDemoViewDDL.db2 @@ -0,0 +1,213 @@ +---------------------------------------------------------------------------- +-- Licensed Materials - Property of IBM +-- Governed under the terms of the IBM Public License +-- +-- (C) COPYRIGHT International Business Machines Corp. 2000 - 2021 +-- All Rights Reserved. +-- +-- US Government Users Restricted Rights - Use, duplication or +-- disclosure restricted by GSA ADP Schedule Contract with IBM Corp. +---------------------------------------------------------------------------- +-- +-- Component Name: Db2 Spatial Analytics +-- +-- Source File Name: saBankDemoViewDDL.db2 +-- +-- Version: 11.5.6+ +-- +-- Description: +-- +-- +-- +-- For more information about the Db2 Spatial Analytics Bank Demo scripts, +-- see the saBankDemoREADME.txt file. +-- +-- For more information about Db2 Spatial Analytics component, refer to the +-- documentation at +-- https://www.ibm.com/docs/en/db2/11.5?topic=data-db2-spatial-analytics. +-- +-- For the latest information on Db2 refer to the Db2 website at +-- https://www.ibm.com/analytics/db2. +---------------------------------------------------------------------------- + +--========================================================================== +-- Show all customers of Branch 1 - Meridian +--========================================================================== + +CREATE VIEW sa_demo.meridian_customers (name, phone, location, branch_name) AS + SELECT c.name, c.phone, c.location, b.name + FROM (sa_demo.customers AS c + JOIN sa_demo.accounts AS a + ON (a.customer_id = c.customer_id)) + JOIN sa_demo.branches AS b + ON (b.branch_id = a.branch_id) + WHERE b.name='Meridian'; + +--========================================================================== +-- Show all customers of Branch 2 - San Carlos +--========================================================================== + +CREATE VIEW sa_demo.sancarlos_customers (name, phone, location, branch_name) AS + SELECT c.name, c.phone, c.location, b.name + FROM (sa_demo.customers AS c + JOIN sa_demo.accounts AS a + ON (a.customer_id = c.customer_id)) + JOIN sa_demo.branches AS b + ON (b.branch_id = a.branch_id) + WHERE b.name='San Carlos'; + +--========================================================================== +-- Show the nearest branch of each customer +--========================================================================== + +CREATE VIEW sa_demo.closest_branch AS + WITH distance_to_customers(c_id, b_id, distance) AS + (SELECT c.customer_id, b.branch_id, ST_Distance(c.location, b.location) + FROM sa_demo.customers c, sa_demo.branches b + WHERE c.customer_id > 0) + SELECT c.name, c.location, c.phone, d_c.b_id, d_c.distance + FROM distance_to_customers d_c, sa_demo.customers c + WHERE d_c.c_id=c.customer_id AND + d_c.distance <= ALL(SELECT distance + FROM distance_to_customers d_c2 + WHERE d_c2.c_id=d_c.c_id); + +--========================================================================== +-- Show all savings balance +--========================================================================== + +CREATE VIEW sa_demo.customers_savings AS + SELECT c.customer_id, c.name, c.phone, c.location, a.balance + FROM sa_demo.accounts a, sa_demo.customers c + WHERE a.type = 'Saving' AND + a.customer_id = c.customer_id; + +--========================================================================== +-- Show all checking accounts balance +--========================================================================== + +CREATE VIEW sa_demo.customers_checkings AS + SELECT c.customer_id, c.name, c.phone, c.location, a.balance + FROM sa_demo.accounts a, sa_demo.customers c + WHERE a.type = 'Checking' AND + a.customer_id = c.customer_id; + +--========================================================================== +-- Show checking+saving accounts balance +--========================================================================== + +CREATE VIEW sa_demo.customers_totals AS + WITH account_sum (customer_id, sum_balance) AS + (SELECT act.customer_id, SUM(act.balance) + FROM sa_demo.accounts act + GROUP BY act.customer_id + ) + SELECT c.customer_id, c.name, c.phone, c.location, account_sum.sum_balance + FROM sa_demo.customers c, account_sum + WHERE account_sum.customer_id = c.customer_id; + + +--========================================================================== +-- Show the savings balance of all customers 0.05 degrees (about 3.5 miles) +-- from my branches +--========================================================================== + +CREATE VIEW sa_demo.closest_savings AS + SELECT c.customer_id, c.name, c.phone, c.location, a.balance + FROM sa_demo.accounts a, sa_demo.branches b, sa_demo.customers c + WHERE st_distance(b.location, c.location) > .05 AND + a.type = 'Saving' AND + a.customer_id = c.customer_id AND + a.balance > 45000; + +--========================================================================== +-- Show the checking balance of all customers 3.5 miles (about 0.05 degrees) +-- from my branches +--========================================================================== + +CREATE VIEW sa_demo.closest_checking AS + SELECT c.customer_id, c.name, c.phone, c.location, a.balance + FROM sa_demo.accounts a, sa_demo.branches b, sa_demo.customers c + WHERE st_distance(b.location, c.location, 'MILE') > 3.5 AND + a.TYPE = 'Checking' AND + a.customer_id = c.customer_id AND + a.balance > 2000; + +--========================================================================== +-- Branch Zone Overlap Query +-- All the customer with more than 50000 in their saving accounts in overlapping zones +--========================================================================== + +CREATE VIEW sa_demo.overlap_zone AS + SELECT c.customer_id, c.name, c.phone, c.location, a.balance + FROM sa_demo.customers c, sa_demo.branches b1, sa_demo.branches b2, + sa_demo.accounts a + WHERE ST_Within(c.location, + ST_Intersection( + ST_Buffer(b1.location ,0.04), + ST_Buffer(b2.location ,0.04) + ) + )=1 + AND b1.branch_id <> b2.branch_id + AND a.balance > 50000 AND a.type = 'Saving' + AND a.customer_id = c.customer_id + AND (a.branch_id=b1.branch_id OR a.branch_id=b2.branch_id); + +--========================================================================== +-- Branch Buffers +-- Show the areas 0.04 miles away from my branches +--========================================================================== +-- This table is needed because of a limitation in ArcExplorer. +-- ArcExplorer can't visualize views when the geometry changes type. + +CREATE TABLE sa_demo.branch_buffers( + sa_row_id INTEGER, + geometry ST_Polygon ) organize by row; + +INSERT INTO sa_demo.branch_buffers(sa_row_id, geometry) + (SELECT sa_row_id, ST_Buffer(location, 0.04) AS ST_Polygon + FROM sa_demo.branches); + +--========================================================================== +-- Create aggregate view of Savings balance per census block +--========================================================================== + +CREATE VIEW sa_demo.avg_savings_block AS + SELECT cb.geometry, cb.sa_row_id, avg_blocks.avg_balance + FROM sa_demo.sj_census_blocks AS cb, + (SELECT blocks.sa_row_id, avg(customer_savings.balance) AS avg_balance + FROM sa_demo.sj_census_blocks AS blocks, + (SELECT c.location, a.balance + FROM sa_demo.customers AS c, sa_demo.accounts AS a + WHERE (a.type='Saving') AND + (a.customer_id=c.customer_id) + ) as customer_savings + WHERE (ST_Within(customer_savings.location, blocks.geometry)=1 ) + GROUP BY blocks.sa_row_id + ) as avg_blocks + WHERE cb.sa_row_id=avg_blocks.sa_row_id; + +--========================================================================== +-- Show the areas of Census blocks(SELBLOCKS) that have average +-- income greater than 80% of my maximum savings balance +--========================================================================== +-- all_customer = all customers with a savings account + +CREATE VIEW sa_demo.prospects AS + WITH max_blocks(amount) AS + (SELECT MAX(group_blocks.average) + FROM + (SELECT blocks.sa_row_id, AVG(all_customers.balance) AS average + FROM sa_demo.sj_census_blocks blocks, + (SELECT c.location, a.balance + FROM sa_demo.customers AS c, sa_demo.accounts AS a + WHERE (a.type='Saving') AND + (a.customer_id=c.customer_id) + ) AS all_customers + WHERE (ST_Within(all_customers.location, blocks.geometry)=1) + GROUP BY blocks.sa_row_id + ) AS group_blocks + ) + SELECT blocks.geometry, blocks.sa_row_id, average__1 + FROM sa_demo.sj_census_blocks AS blocks, max_blocks AS mx + WHERE average__1 > (0.8 * mx.amount); diff --git a/spatial/data/cityLimits.dbf b/spatial/data/cityLimits.dbf new file mode 100644 index 0000000..766b04d Binary files /dev/null and b/spatial/data/cityLimits.dbf differ diff --git a/spatial/data/cityLimits.prj b/spatial/data/cityLimits.prj new file mode 100644 index 0000000..747df58 --- /dev/null +++ b/spatial/data/cityLimits.prj @@ -0,0 +1 @@ +GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file diff --git a/spatial/data/cityLimits.shp b/spatial/data/cityLimits.shp new file mode 100644 index 0000000..ed0eb2c Binary files /dev/null and b/spatial/data/cityLimits.shp differ diff --git a/spatial/data/cityLimits.shx b/spatial/data/cityLimits.shx new file mode 100644 index 0000000..f1d0c64 Binary files /dev/null and b/spatial/data/cityLimits.shx differ diff --git a/spatial/data/floodzones.dbf b/spatial/data/floodzones.dbf new file mode 100644 index 0000000..9d044b6 Binary files /dev/null and b/spatial/data/floodzones.dbf differ diff --git a/spatial/data/floodzones.prj b/spatial/data/floodzones.prj new file mode 100644 index 0000000..bf40f16 --- /dev/null +++ b/spatial/data/floodzones.prj @@ -0,0 +1 @@ +PROJCS["NAD_1983_StatePlane_Kentucky_South_FIPS_1602_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",1640416.666666667],PARAMETER["False_Northing",1640416.666666667],PARAMETER["Central_Meridian",-85.75],PARAMETER["Standard_Parallel_1",36.73333333333333],PARAMETER["Standard_Parallel_2",37.93333333333333],PARAMETER["Latitude_Of_Origin",36.33333333333334],UNIT["Foot_US",0.3048006096012192]] \ No newline at end of file diff --git a/spatial/data/floodzones.shp b/spatial/data/floodzones.shp new file mode 100644 index 0000000..b031c27 Binary files /dev/null and b/spatial/data/floodzones.shp differ diff --git a/spatial/data/floodzones.shx b/spatial/data/floodzones.shx new file mode 100644 index 0000000..a33e52f Binary files /dev/null and b/spatial/data/floodzones.shx differ diff --git a/spatial/data/offices.dbf b/spatial/data/offices.dbf new file mode 100644 index 0000000..a32287d Binary files /dev/null and b/spatial/data/offices.dbf differ diff --git a/spatial/data/offices.prj b/spatial/data/offices.prj new file mode 100644 index 0000000..bf40f16 --- /dev/null +++ b/spatial/data/offices.prj @@ -0,0 +1 @@ +PROJCS["NAD_1983_StatePlane_Kentucky_South_FIPS_1602_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",1640416.666666667],PARAMETER["False_Northing",1640416.666666667],PARAMETER["Central_Meridian",-85.75],PARAMETER["Standard_Parallel_1",36.73333333333333],PARAMETER["Standard_Parallel_2",37.93333333333333],PARAMETER["Latitude_Of_Origin",36.33333333333334],UNIT["Foot_US",0.3048006096012192]] \ No newline at end of file diff --git a/spatial/data/offices.shp b/spatial/data/offices.shp new file mode 100644 index 0000000..2a2ad06 Binary files /dev/null and b/spatial/data/offices.shp differ diff --git a/spatial/data/offices.shx b/spatial/data/offices.shx new file mode 100644 index 0000000..75ec7b8 Binary files /dev/null and b/spatial/data/offices.shx differ diff --git a/spatial/data/regions.dbf b/spatial/data/regions.dbf new file mode 100644 index 0000000..90fd678 Binary files /dev/null and b/spatial/data/regions.dbf differ diff --git a/spatial/data/regions.prj b/spatial/data/regions.prj new file mode 100644 index 0000000..bf40f16 --- /dev/null +++ b/spatial/data/regions.prj @@ -0,0 +1 @@ +PROJCS["NAD_1983_StatePlane_Kentucky_South_FIPS_1602_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",1640416.666666667],PARAMETER["False_Northing",1640416.666666667],PARAMETER["Central_Meridian",-85.75],PARAMETER["Standard_Parallel_1",36.73333333333333],PARAMETER["Standard_Parallel_2",37.93333333333333],PARAMETER["Latitude_Of_Origin",36.33333333333334],UNIT["Foot_US",0.3048006096012192]] \ No newline at end of file diff --git a/spatial/data/regions.shp b/spatial/data/regions.shp new file mode 100644 index 0000000..fc37d06 Binary files /dev/null and b/spatial/data/regions.shp differ diff --git a/spatial/data/regions.shx b/spatial/data/regions.shx new file mode 100644 index 0000000..82c5679 Binary files /dev/null and b/spatial/data/regions.shx differ diff --git a/spatial/data/salezones.dbf b/spatial/data/salezones.dbf new file mode 100644 index 0000000..b9dfe7a Binary files /dev/null and b/spatial/data/salezones.dbf differ diff --git a/spatial/data/salezones.prj b/spatial/data/salezones.prj new file mode 100644 index 0000000..747df58 --- /dev/null +++ b/spatial/data/salezones.prj @@ -0,0 +1 @@ +GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file diff --git a/spatial/data/salezones.shp b/spatial/data/salezones.shp new file mode 100644 index 0000000..bdbb46e Binary files /dev/null and b/spatial/data/salezones.shp differ diff --git a/spatial/data/salezones.shx b/spatial/data/salezones.shx new file mode 100644 index 0000000..72db518 Binary files /dev/null and b/spatial/data/salezones.shx differ diff --git a/spatial/data/sjCensusBlocks.dbf b/spatial/data/sjCensusBlocks.dbf new file mode 100644 index 0000000..94ee192 Binary files /dev/null and b/spatial/data/sjCensusBlocks.dbf differ diff --git a/spatial/data/sjCensusBlocks.prj b/spatial/data/sjCensusBlocks.prj new file mode 100644 index 0000000..747df58 --- /dev/null +++ b/spatial/data/sjCensusBlocks.prj @@ -0,0 +1 @@ +GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file diff --git a/spatial/data/sjCensusBlocks.shp b/spatial/data/sjCensusBlocks.shp new file mode 100644 index 0000000..b1816bf Binary files /dev/null and b/spatial/data/sjCensusBlocks.shp differ diff --git a/spatial/data/sjCensusBlocks.shx b/spatial/data/sjCensusBlocks.shx new file mode 100644 index 0000000..aabdddc Binary files /dev/null and b/spatial/data/sjCensusBlocks.shx differ diff --git a/spatial/data/sjMainStreets.dbf b/spatial/data/sjMainStreets.dbf new file mode 100644 index 0000000..db1b886 Binary files /dev/null and b/spatial/data/sjMainStreets.dbf differ diff --git a/spatial/data/sjMainStreets.prj b/spatial/data/sjMainStreets.prj new file mode 100644 index 0000000..247496e --- /dev/null +++ b/spatial/data/sjMainStreets.prj @@ -0,0 +1 @@ +GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]] diff --git a/spatial/data/sjMainStreets.shp b/spatial/data/sjMainStreets.shp new file mode 100644 index 0000000..37a2609 Binary files /dev/null and b/spatial/data/sjMainStreets.shp differ diff --git a/spatial/data/sjMainStreets.shx b/spatial/data/sjMainStreets.shx new file mode 100644 index 0000000..9d15dbb Binary files /dev/null and b/spatial/data/sjMainStreets.shx differ diff --git a/spatial/data/sjZipCodes.dbf b/spatial/data/sjZipCodes.dbf new file mode 100644 index 0000000..c3d43c9 Binary files /dev/null and b/spatial/data/sjZipCodes.dbf differ diff --git a/spatial/data/sjZipCodes.prj b/spatial/data/sjZipCodes.prj new file mode 100644 index 0000000..747df58 --- /dev/null +++ b/spatial/data/sjZipCodes.prj @@ -0,0 +1 @@ +GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file diff --git a/spatial/data/sjZipCodes.shp b/spatial/data/sjZipCodes.shp new file mode 100644 index 0000000..874db94 Binary files /dev/null and b/spatial/data/sjZipCodes.shp differ diff --git a/spatial/data/sjZipCodes.shx b/spatial/data/sjZipCodes.shx new file mode 100644 index 0000000..0cc09a9 Binary files /dev/null and b/spatial/data/sjZipCodes.shx differ diff --git a/spatial/data/st_linestring.dbf b/spatial/data/st_linestring.dbf new file mode 100644 index 0000000..f4f9149 Binary files /dev/null and b/spatial/data/st_linestring.dbf differ diff --git a/spatial/data/st_linestring.prj b/spatial/data/st_linestring.prj new file mode 100644 index 0000000..747df58 --- /dev/null +++ b/spatial/data/st_linestring.prj @@ -0,0 +1 @@ +GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file diff --git a/spatial/data/st_linestring.shp b/spatial/data/st_linestring.shp new file mode 100644 index 0000000..4f3d93b Binary files /dev/null and b/spatial/data/st_linestring.shp differ diff --git a/spatial/data/st_linestring.shx b/spatial/data/st_linestring.shx new file mode 100644 index 0000000..ddf836c Binary files /dev/null and b/spatial/data/st_linestring.shx differ diff --git a/spatial/data/st_multilinestring.dbf b/spatial/data/st_multilinestring.dbf new file mode 100644 index 0000000..a198f79 Binary files /dev/null and b/spatial/data/st_multilinestring.dbf differ diff --git a/spatial/data/st_multilinestring.prj b/spatial/data/st_multilinestring.prj new file mode 100644 index 0000000..747df58 --- /dev/null +++ b/spatial/data/st_multilinestring.prj @@ -0,0 +1 @@ +GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file diff --git a/spatial/data/st_multilinestring.shp b/spatial/data/st_multilinestring.shp new file mode 100644 index 0000000..db22094 Binary files /dev/null and b/spatial/data/st_multilinestring.shp differ diff --git a/spatial/data/st_multilinestring.shx b/spatial/data/st_multilinestring.shx new file mode 100644 index 0000000..db22094 Binary files /dev/null and b/spatial/data/st_multilinestring.shx differ diff --git a/spatial/data/st_multipoint.dbf b/spatial/data/st_multipoint.dbf new file mode 100644 index 0000000..709cf28 Binary files /dev/null and b/spatial/data/st_multipoint.dbf differ diff --git a/spatial/data/st_multipoint.prj b/spatial/data/st_multipoint.prj new file mode 100644 index 0000000..747df58 --- /dev/null +++ b/spatial/data/st_multipoint.prj @@ -0,0 +1 @@ +GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file diff --git a/spatial/data/st_multipoint.shp b/spatial/data/st_multipoint.shp new file mode 100644 index 0000000..9a404f3 Binary files /dev/null and b/spatial/data/st_multipoint.shp differ diff --git a/spatial/data/st_multipoint.shx b/spatial/data/st_multipoint.shx new file mode 100644 index 0000000..2045bf7 Binary files /dev/null and b/spatial/data/st_multipoint.shx differ diff --git a/spatial/data/st_multipolygon.dbf b/spatial/data/st_multipolygon.dbf new file mode 100644 index 0000000..d8a08d8 Binary files /dev/null and b/spatial/data/st_multipolygon.dbf differ diff --git a/spatial/data/st_multipolygon.prj b/spatial/data/st_multipolygon.prj new file mode 100644 index 0000000..747df58 --- /dev/null +++ b/spatial/data/st_multipolygon.prj @@ -0,0 +1 @@ +GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file diff --git a/spatial/data/st_multipolygon.shp b/spatial/data/st_multipolygon.shp new file mode 100644 index 0000000..09df968 Binary files /dev/null and b/spatial/data/st_multipolygon.shp differ diff --git a/spatial/data/st_multipolygon.shx b/spatial/data/st_multipolygon.shx new file mode 100644 index 0000000..b178a3a Binary files /dev/null and b/spatial/data/st_multipolygon.shx differ diff --git a/spatial/data/st_point.dbf b/spatial/data/st_point.dbf new file mode 100644 index 0000000..657c90e Binary files /dev/null and b/spatial/data/st_point.dbf differ diff --git a/spatial/data/st_point.prj b/spatial/data/st_point.prj new file mode 100644 index 0000000..747df58 --- /dev/null +++ b/spatial/data/st_point.prj @@ -0,0 +1 @@ +GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file diff --git a/spatial/data/st_point.shp b/spatial/data/st_point.shp new file mode 100644 index 0000000..e2d0d84 Binary files /dev/null and b/spatial/data/st_point.shp differ diff --git a/spatial/data/st_point.shx b/spatial/data/st_point.shx new file mode 100644 index 0000000..3cb2333 Binary files /dev/null and b/spatial/data/st_point.shx differ diff --git a/spatial/data/st_polygon.dbf b/spatial/data/st_polygon.dbf new file mode 100644 index 0000000..b67a227 Binary files /dev/null and b/spatial/data/st_polygon.dbf differ diff --git a/spatial/data/st_polygon.prj b/spatial/data/st_polygon.prj new file mode 100644 index 0000000..747df58 --- /dev/null +++ b/spatial/data/st_polygon.prj @@ -0,0 +1 @@ +GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file diff --git a/spatial/data/st_polygon.shp b/spatial/data/st_polygon.shp new file mode 100644 index 0000000..64bb0bd Binary files /dev/null and b/spatial/data/st_polygon.shp differ diff --git a/spatial/data/st_polygon.shx b/spatial/data/st_polygon.shx new file mode 100644 index 0000000..98bdceb Binary files /dev/null and b/spatial/data/st_polygon.shx differ