This document assumes that you want to add the HTM spatial data management
capabilities to SQLServer2005.

The binary DLLs are included, you can skip the part on compilation if you
want to install HTM for Yukon, but not recompile from the C-sharp sources.
The sources require Visual Studio 2005 (Version 8) and .NET 2.0 or more recent.

Before you install anything, please read this entire document, you 
have to edit some files to fix names as approriate for your site. For example,
the database name used here is SPHHTM (SPHerical Hierarchical Triangular Mesh).

The scripts used directly, or indirectly from .\local\ assume to work
on a database named SPHHTM. You will probably use a different name, please
edit the files mentioned below as appropriate. I don't know how to make an
installer wizard yet, until then, please work with me.

You may want to read local/Problems.txt to anticipate problems you may
encounter... These are the ones I had when I tried installing on an untouched
machine.

All files are installed in special system places 
This is the root of all install targets, and must exist:

C:\Program Files\Microsoft SQL Server\90\Samples\Engine\Programmability\CLR\

Further subdirectories that must be there:
    .\JhuSpherical
        .\CS\bin\Debug
        .\CS\bin\Release
    .\Spatial\data # Only if you want to build the sample spatial database
		   # with the USGS data and do the exercises in the paper.

==============================================================
COMPILE 
==============================================================
Simply start Visual Studio by clicking on Htm.sln in .\CS
Build the Debug and the Release versions, by using Menu Build
Batch Build ->  Build. Make sure that Debug and Release are both checked.

This produces/overwrites three files:
.\CS\bin\Release\SphericalHTM.dll
.\CS\bin\Debug\SphericalHTM.dll
.\CS\bin\Debug\SphericalHTM.pdb

==============================================================
INSTALL the SphericalHTM.DLL, and support files
==============================================================

The HTM library depends on the SphericalLib library, which is built elsewhere.
The binary DLLs are included in this distribution.

The script .\local\loadorreload.bat installs (copies) the DLLS
into their intended location. The target directories
mentioned in loadorreload.bat must exist, if they don't, create them by hand.

For the examples in the white paper to work, two more files are 
also installed: StationC.dat and PlaceC.dat
==============================================================
Create the Spatial database and install the t-sql functions
==============================================================
Start the Yukon server, if not already running.
Make your working directory .\local


     createDB.bat      create the SPHHTM database on the local
                       SQL Server
     
     dropDB.bat        delete the SPHHTM database on the local
                       SQL Server
     
     loadorreload.bat  copy the support files where they belong
                       install the user defined t-sql functions.
                       It's safe to re-execute this file e.g.
		       when you recompile the sources.
		
     builDB.bat        Creates the spatial tables from the data in SPHHTM.


SQL\TestSPHHTM.sql tests the HTM functions only, does not require the 
spatial tables.

SQL\TestScript.sql contains commands that test the integrity
of the installation, the spatial tables created in buildDB must be there.
