Microsoft SQL Server/Print version

From Wikibooks, open books for an open world
Jump to navigation Jump to search


Microsoft SQL Server

The current, editable version of this book is available in Wikibooks, the open-content textbooks collection, at
https://en.wikibooks.org/wiki/Microsoft_SQL_Server

Permission is granted to copy, distribute, and/or modify this document under the terms of the Creative Commons Attribution-ShareAlike 3.0 License.

Contents


System Requirements

This software is available on Microsoft Windows, its 32-bit editions are different to the 64-bit editions[1].

32-bit editions of SQL Server 2005[edit]

Minimum processor: PIII 600 (1 GHZ or faster recommended).

Minimum OS:

Enterprise[edit]

  • Windows Server 2003 (Standard, Enterprise or Datacenter) with SP1 or later.
  • Windows Small Business Server 2003 (Standard or Premium) with SP1 or later.
  • Windows 2000 (Server, Advanced Server, Datacenter Server) with SP4 or later.

In short: all OS after Windows XP.

Standard[edit]

All of Enterprise, but also non server Windows OS.

Windows Professional with SP4 and Windows XP with SP2 or later.

Workgroups[edit]

All of standard and Windows XP Media and Tabled Edition.

Express[edit]

All of the above + Windows Home Edition with SP2 or later and Windows Server 2004 Web Edition with SP1 or later.

Developer[edit]

1+2+3 + 4.5 Windows Home Edition with SP2.

Memory Requirements[edit]

  • Enterprise, Development Standard and Workgroup: 512 min, 1 GB more recommended.
  • Express: 192 min, 512 or more recommended.

Harddisk requirement[edit]

350 MB full and 390 for sample.

Internet[edit]

  • Explorer SP1 required for all installations (Required for Microsoft Management Console (MMC) and HTML Help.
  • IIS Required for XML applications and for Reporting Services.
  • TCP/IP must be enabled.


64-bit editions of SQL Server 2005[edit]

Processor[edit]

  • IA64 Minimum: 1 GHZ or faster Itanium.
  • X64 minimum: 1 GHz or faster AMD Opteron, AMD Athlon 64, Intel Xenon with Intel EM64T support or PIV with EM64T support.

References[edit]

  1. https://msdn.microsoft.com/en-us/library/ms143506.aspx



Installing

There is too choose between a default or named instance. You can install only one default instance, but more named instances.

Understanding SQL Server 2005 Editions[edit]

There are five different editions of the SQL Server 2005. Three of them have 64-bit native versions, the rest is 32-bit only.

Enterprise Edition[edit]

Largest, 32-bit and 64-bit, supports the largest online transaction processing (OLTP)

Standard Edition[edit]

32-bit and 64-bit, small and medium enterprises

Workgroup Edition[edit]

Small Enterprises, no limits on size of users, for small servers

Developer Edition[edit]

Same as Enterprise without production license

Express Edition[edit]

MSDE for SQL Server 2005; free (also for clients access); replacement for Access


Some hints to remember Features[edit]

Express; Workgroup; Standard; Enterprise

Number of CPUS: 1;2;4;unlimited. Think of a formula such as CPUs of a Edition == Previous Edition *2 expect for Enterprise.
Memory 1GB;3GB, Limit based on OS, Limit based on OS
64-bit support: Express and Workgroup can only have 64-bit support via WOW
Max DB Size: Express has 4 GB limit

Partitioning is only supported by Enterprise Edition
Database Mirroring is supported by Standard and Enterprise
Fail Over Clustering is supported by Standard(two Nodes) and Enterprise
PDF Rule: Remember Partitioning, Database Mirroring, Failover P == 1 only one edition supports

Log Shipping: All but Express
Management Studio All but Express
Database Tuning Advisor: Standard and Enterprise
Full Text Search: All but Express
SQL Server Agent Job Scheduling: All but Express
Best Practives Advisor: All
Notification Services Standard and Enterprise
Service Broker: All (Express Subsriber only)
Merge Replication: All (Restriction on Express and Workgroup)
Transactional Replication: Restriction on Express and Workgroup
Oracle Replication: Enterprise
Web Services (Http Endpoints): Standard and Enterprise
Report Server: All
Report Builder All but Express
BI Development Studio Express and Workgroup have Report Designer only
Enterprise Managemnet Tool: All but Express
Native Support for Web Services: Reporting Services for Express and Workgroups only
Analysis Services for Standard and Enterprise only

Rules of thumb:

  • Express Edition is limited nearly everywhere: It has only Report Server and Best Practices Analyzer and in some only a feature as subscriber only
  • Enterprise Edition has everything
  • Standard does not support: Oracle Replication and Partitioning and has some Restrictions on Fail Over clustering:
  • Workgroup: hardest to Remember: It does not include the features to maintain large databases


How to Install MS SQL Server on Windows[edit]

The source should be downloaded on https://www.microsoft.com/en-us/evalcenter/evaluate-sql-server-2016.

Installation

The Minimum System Requirements

Windows 32-bit System (Minimum Vista with SP2 or Server with SP2 installed), Intel or other supporting processor with at least 2.66 GHz Speed (My personal suggestion ), RAM should be 2 GB or more (if you want to run several applications such as Visual Studio with this server) ”The more you have, the more it will be better”.

[Note:32-bit Systems do not exceed more than 3 GB RAM, if you use 4 GB then it will utilize only 3 GB RAM]

Here we go

Is .Net Framework 3.5 or with SP1 or 4.0 installed? If not then here is the official link (I don’t like unofficial, mind you… ). Read the instructions,when downloading and installing and make sure it has been installed. Now , its time to install your SQL Server Database.


  1. Right click on the SQLEXPRWT_x64_ENU.exe or SQLEXPRWT_x86_ENU.exe SQLEXPRWT_x64_ENU.exe and click ” Run As Administrator”
  2. The installation wizard will appear and it will ask for several options.Set your desired language.Choose that option which indicates
    “New Standalone SQL Installation or Add Features ” and click Next to proceed. A small auto-check will run and when it gets approval for all the pre-requisites, you will be asked to use the evaluation version or if you have bought a key then enter this and use the full version which has whole lots of benefits.Click Next
  3. Accept Terms and conditions and check Updates checkbox (recommended) and click Next.
  4. If updates are present then you won’t get any error. Otherwise, an error will be shown and you have to click next in order to install the updates (That’s why I was telling that enable auto update man…. ). If you have the connectivity issues, check the firewall and allow for both inbound and outbound traffic in the allow rule for this type of application. After the errors have been removed, you have to select the features to install.
  5. Everything after this will go smoothly. You will be asked to add either the default instance or the named instance .There is nothing to get worried about those instances sort of creatures.
    “Take the easiest example. We have the main SQL Server Database which resides in my server computer and it is called manager-pc.The other employees of my company have specific needs from this server .
    I assign the instances of my Server as follows:
    Employee1 has been assigned the instance from my Database Server as manager-pc/instance1 for writing queries etc. Employee2 has been given more rights in the form of manager-pc/instance2 instance and so on.
    • If someone has to show the reports from the instance of the server assigned to Employee2; he has to address the instance2 of manager-pc. So basically, he needs to refer to manager-pc/instance2.
    • If someone has to connect to the default instance, he needs to go to manager-pc directly. The instances are really great from preventing data corruption or intrusion,hacking, SQL injection related issues Just relax.It’s simple :)”
  6. The disk space requirements screen is quite obvious to show you the required space as well as available
  7. Now, here comes the screen asking you to configure the network settings.I will suggest you to assign account to each service on individual basis as it is recommended by the Microsoft. However, I use my own server’s administrator account for all the services. It is up to you to set the services to start manually or automatically.It needs some study material from here when making this decision.Click the Next button to proceed
  8. The Database Engine Configuration screen gives you the option to choose the type of authentication. Here ,we have the default user login id sa which is kept intact and we choose Mixed Mode and assign a good password . Click Next.
  9. The next screen will take you to either change the path of the Data Directory or keep it unchanged and click??? Click what? obviously NNNNN…Next
  10. In order to store the unstructured data in your database such as images or files etc, you should enable filestream by checking it and then click Next button
  11. Let the Multidimensional Data Mining option checked and click Next
  12. Error Reporting should be checked for descriptive explanation about the condition of the errors, if they occur in your server. this helps us to send the errors to Microsoft directly and yes; they help.
  13. Installation configuration rules auto-checking screen appears and you have to……………………..You have to do nothing dear but click Next after the check completes.
  14. Click Next on Install screen
  15. Installation ……….. sit back and relax. After successful completion ; click Next. Here, you may have to do one more thing ! Shout out lower and say “Oh my” if the installation gets failed!!!!!
  16. Installed… congrats
  17. After installation, check to see whether the required services are working ; SQL Server Configuration Manager is there to help.

On Linux and Mac OS[edit]

Since March 2016, the software is available on Linux[1].

Then, a Docker version has allowed it on Mac OS[2].

Graphical interface[edit]

SQL Server Management Studio (SSMS) is the official administration interface for Microsoft SQL Server. Its 2008 version can be downloaded on https://www.microsoft.com/download/confirmation.aspx?id=7593.

References[edit]



Connecting to MS SQL Server from *nix

This tutorial assumes you are using a Debian based distribution of Linux; if not, you might have to modify the instructions appropriately for you distro.

Downloading[edit]

To install both freetds and the drivers for iODBC and unixodbc use apt-get, i.e.,

apt-get install tdsodbc

If you plan to use iODBC, you'll want to run

apt-get install libiodbc2 libiodbc2-dev

If you're using Perl, after you install FreeTDS you'll want to install the DBD for Sybase:

export SYBASE=/etc
cpan DBD::Sybase

Glossary[edit]

TDS 
Designed by Sybase, the Tabular Data Stream Protocol (TDS) describes how to communicate with MS-SQL and Sybase databases.


Troubleshooting[edit]

Many of the errors here are to assist those with Google searches and the users.

Failing to set SYBASE[edit]

The following error is a result of not setting the sybase configuration variable

[ERROR] [Thu Mar 13 11:07:42 2008] Could not run '/usr/local/bin/perl Makefile.PL': Please set SYBASE in CONFIG, or
set the $SYBASE environment variable at /root/.cpanplus/5.10.0/build/DBD-Sybase-1.08/Makefile.PL line 103, <IN>
line 44.

External Links[edit]

  1. iODBC
  2. FreeTDS

References[edit]

  1. Haynes, Tim (2004-03-23). "ODBC-Perl HOWTO". OpenLink Software. http://www.iodbc.org/index.php?page=languages/perl/odbc-perlHOWTO. Retrieved 2008-03-04. 
  2. Bruns, Brian (2006). "FreeTDS User Guide: A Guide to Installing, Configuring, and Running FreeTDS". http://www.freetds.org/userguide/. Retrieved 2008-03-04. 



Using Instances

On one machine, there can be more editions, as defined in the SQL Server Installation Center.

Default Instance: Only one. Please note some of the MS products using the SQL Server request the default instance (For instance the Team Foundation Server).

Determining Multiple or Single Instances[edit]

Multiple Instances mean more administration overhead. Additional Instances require additonal resources: Memory and processor capacity-

Advantages of multiple instances

  • testing multiple versions
  • testing service packs, dev databases and applications
  • different customers require their own system and user databases with full administrative control or their instance
  • desktop engine is embedded in the applications, because every application can install each own instance



Installing Instances

Decide on Security and collation

SQL Server Agent and SQL Server run as Windows Services.

They run in a context of a user account. Determining which account is an important decision.

Questions:

  • Should use use a separate account for the SQL Server service and the SQL Server Agent service, or should you use the same account for both?
  • Should you use a built-in system account or a domain user account?

Remember: The SQL Server jobs require to interact with the SQL Server Agent service. When the SQL Server Agent service must interact with different servers, DBAs create different accounts for these two services to avoid giving the SQL Server service more permission than it needs.

Build-in System account or Domain user account

You can choose between: Network service account, local system account, or a dedicated domain user account.

The Network service account is a special built-in system account that is similar to authenticated user accounts. This account has the same level of access to system resources and objects as members of the Users group. Services that run under this account will use the credentials of the computer account to access network resources. Not recommended to use.

The local system account is a Windows OS account that has full adminstrativve rights on the local computer but has no network rights. You can use this account for development or testing of servers that you do not integrate with other server applications or to interact with any network resources. Not recommended.

Recommended: Create and use one or two dedicated domain user accounts for the SQL Server and SQL Server Agent services.


Authentication mode[edit]

Windows and Mixed mode. Default is Windows: Only users that have previously authenticated to the Windows OS can connect to the SQL Server 2005 instance.

Mixed is recommended for Legacy.

Determining Collation Setting[edit]

You define the default collation for a SQL Server at installation. The SQL Server uses the collation setting to determine how non-Unicode character data is stored and how to sort and compare Unicode and non-Unicode data.

Default will be selected of Windows.



Configuring Files

data files contain data and objects (tables, indexes and so on) and log files contain transaction log.

filegroups are grouped datafiles for easier admin.

Data Files[edit]

There are primary and secondary Data Files.

The primary has the extension mdf and contains data and all information regarding data (such as information on the secondary data files). For optimal performance do not store data there.

The secondary has the extension ndf. No administrative data is stored here. There is a maximum of 32,766 secondary data files.

Log Files[edit]

Extension ldf. Each db needs at least one log file. You can create more than one

Filegroups[edit]

Logical structure of data files.

Also there are primary and secondary filegroups. The primary contains the primary data file and every secondary data file not stored in a specific filegroup. There can be up to 32,766 secondary file groups.

Filegroups can be configured as read only.

The filegroups are created with the SSMS or with the CREATE DATABASE command.

Five parameters have to be considered: Name, Filename, Size, Maxsize and Filegrowth

Configuring Raid Systems[edit]

There are Raid Levels 0,1,5 and 10. It has to be considered to be used in high performance environments. Configuring Database Files with RAID Systems RAID systems are arrays of disk drives that provide fault tolerance, more storage capacity, and better performance for the disk subsystem, depending on the configuration. Although RAID hardware systems are not part of the SQL Server configuration, they directly affect SQL Server’s performance. There are a variety of RAID levels, each of which uses a different algorithm for fault tolerance. The most common RAID levels used with SQL Server are 0, 1, 5, and 10.

  • RAID 0 is also known as disk striping because it creates a disk file system called a stripe set. RAID 0 gives the best performance for read and write operations because it spreads these operations across all the disks in the set. However, RAID 0 does not provide fault tolerance; if one disk fails, you lose access to all the data on the stripe set.
  • RAID 1, also known as disk mirroring, provides a redundant copy of the selected disk. RAID 1 improves read performance but can degrade the performance of write operations.
  • RAID 5, the most popular RAID level, stripes the data across the disks of the RAID set as does RAID 0, but it also adds parity information to provide fault tolerance. Parity information is distributed among all the disks. RAID 5 provides better performance than RAID 1. However, when a disk fails, read performance decreases. 58 Chapter 2 Configuring SQL Server 2005
  • RAID 10, or RAID 1+0, includes both striping without parity and mirroring. RAID 10 offers better availability and performance than RAID 5, especially for write-intensive applications. The RAID configuration that is best for your database files depends on several factors, including performance and recoverability needs. RAID 10 is the recommended RAID system for transaction log, data, and index files. If you have budget restrictions, keep transaction log files in a RAID 10 system, and store data and index files in a RAID 5 system.

Best practices[edit]

  1. Do not put data files on the same drive as OS files
  2. Separate transaction log files from data files
  3. database tempdb should be on a separate drive (Raid 10 or RAID 5)



Configuring Mail

First of all: SQL Server Mail does not depend on Extended Mapi.

Prerequesites for Database Mail:

  • Database Mail has to be enabled via the Surface Area Configuration Tool, Database Mail Configuration Wizard or the sp_configure[1].
  • Service Broker needs to be enabled in the Database Mail host database msdb
  • The Database Mail externals executables need access to the SMTP Server

Architecture[edit]

Four Components: Configuration Component, Messaging Component, Database Mail executable, Logging and auditing component.

The configuration components consists of a database Mail account and a Database Mail profile. The Database Mail account contains the information that SQL Server uses to send e-mail messages to the SMTP server, such as the SMTP server name, the authentication type, and the e-mail address.

References[edit]

  1. http://technet.microsoft.com/en-us/library/ms191207%28v=sql.105%29.aspx



System databases

In this chapter you will learn the purpose of the system databases installed with every instance of Microsoft SQL Server.

Introduction[edit]

When you install Microsoft SQL Server, five system databases are automatically created on every SQL Server instance. These system databases allow the database engine and administrative applications to properly manage the system:

  • Resource (SQL Server 2005 and higher only)
  • master
  • model
  • msdb
  • tempdb

Resource[1][edit]

The Resource database is a read-only database that contains all SQL Server system objects. This system database is not displayed in the SQL Server Management Studio object explorer, so users may not be aware of it. Interaction with the Resource database is indirect, through master database system views and functions that reference these objects. Because the Resource database is read-only, it is only modified by the system when a SQL Server hotfix, service pack, or upgrade is installed on an instance. The Resource database is installed only with SQL Server 2005 and higher.

master[2][edit]

The master database records the server-wide configuration information for a SQL Server instance, including all logins and database engine configuration defaults. The master database stores metadata including references to all other databases on the instance. This database records the initialization information for SQL Server, and an instance of SQL Server cannot start up if the master database is missing, corrupt, or otherwise unavailable. Prior to SQL Server 2005 all system objects were stored in the master database. Beginning with SQL Server 2005, the master database provides access to system objects through views, functions, and stored procedures that reference the read-only Resource database.

tempdb[3][edit]

The tempdb database is considered a global resource that all connections and all users can access. The tempdb database holds user-created temporary database objects, such as temporary tables and temporary stored procedures. This database is also used heavily by the database engine to serialize intermediate results and to hold other temporary data and objects that are generated during processing. Tempdb is always recreated from when the SQL Server service is first started. Because tempdb is so heavily used by the system, many system-wide performance optimizations are necessarily focused on making tempdb as efficient as possible.

model[4][edit]

The model database is a template for all newly-created databases on an instance. When a database is created it is initialized as a copy of the model database and then modified to the correct size and settings specified at creation time. Any objects in the model database are automatically copied to the new database. For this reason, some database administrators (DBAs) create functions or other database objects in the model database that they want to exist in all newly created databases.

Prior to SQL Server 2005 the database initialization process required allocating and wiping out ("zero-filling") all pages when a database was created. Beginning with SQL Server 2005 using the "instant initialization feature" improves performance by skipping the zero-fill when new data pages are allocated.

The tempdb database is recreated from a copy of the model database every time SQL Server is started, so the model database must always exist on a SQL Server system.

msdb[5][edit]

The msdb database is a system database used to store configuration and processing data and metadata for SQL Server features and applications including SQL Server Agent (job schedules and alerts), SQL Server Integration Services (ETL packages), Database Mail, and Service Broker.

Usage[edit]

Below is one request to get all the server databases by sizes:

EXECUTE master.sys.sp_MSforeachdb 'USE [?]; EXEC sp_spaceused'

Summary[edit]

SQL Server installs five system databases with every server instance: Resource (SQL Server 2005 and higher only), master, tempdb, model, and msdb. Each provides a specific set of system-wide functionality to the SQL Server instance, including access to server-wide configuration metadata, utility configuration and processing data, and the ability to create and utilize temporary objects.

References[edit]

  1. Resource database (Books Online)
  2. master database (Books Online)
  3. tempdb database (Books Online)
  4. model database (Books Online)
  5. msdb database (Books Online)



Database manipulation

Creation[edit]

To create a database, its files have to be defined:

  • Master Database File (.mdf)
  • Log Database File (.ldf)
CREATE DATABASE [MyDB] ON  PRIMARY 
( NAME = N'MyDB', FILENAME = N'D:\DATASQL\MSSQL10.MSSQLSERVER\MSSQL\DATA\MyDB.mdf' , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'MyDB_log', FILENAME = N'D:\DATASQL\MSSQL10.MSSQLSERVER\MSSQL\DATA\MyDB_log.ldf' , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO

Reading[edit]

Then to select it, it's either possible to set it at the beginning of the script:

USE MyDB;
SELECT * FROM MyTable;

or to call all the objects with their full path. Eg:

SELECT * FROM [MyDB].[dbo].[MyTable];

Backup[edit]

Restoration[edit]

If the database to restore doesn't exist on the destination server, it's necessary to create it empty first. In SSMS, with a right click on Databases, New database.

The process is a right click on the database to restore, and Restore the database, select the .bak.

Otherwise in SQL it gives:

RESTORE DATABASE MyDB
FROM DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\Backup\2016-02-16-MyDB.bak'
WITH REPLACE



Variables

Declaration and affectation[edit]

Every variable name begins with an at.

  • Integer operations:
declare @i int
set @i = 5

declare @j int
set @j = 6

print @i+@j -- displays 11
  • Character operations:
declare @k char
set @k = '5'

declare @l char
set @l = '6'

print @k+@l -- displays 56

Types[edit]

The possible variable types are similar to the table fields ones[1]:

Characters[edit]

Those beginning by "n" are in Unicode format.

char, nchar, nvarchar, ntext, text, varchar.

To save a few memory space, it's possible to set a characters number limit during the declaration:

varchar(255)

The variable of characters maximum size is 2 GB[2] :

varchar(MAX)

Numbers[edit]

decimal, int (tinyint, smallint, bigint), float, money, numeric, real, smallmoney.

Dates[edit]

date, datetime, datetime2, datetimeoffset, smalldatetime, time.

Personalized types[edit]

In addition to the native types, it's possible to create one's own data types with CREATE TYPE.

Type determination[edit]

The function SQL_VARIANT_PROPERTY returns a given field type[3]. Example:

SELECT SQL_VARIANT_PROPERTY(Field1, 'BaseType')
FROM table1

References[edit]



Table manipulation

Introduction[edit]

The DDL and DML respect the SQL-86 norm. However, in addition to the requests SELECT, UPDATE, INSERT we find MERGE since the 2008 version[1].

Create a table[edit]

In SSMS, a right click on the folder "Tables" of a database allows to add one.

A right click on a particular table lets choose between:

  1. Modify the table structure (add a column, modify a type).
  2. Select its 1,000 first records (TOP), or the 1,000 last (ORDER BY id DESC).
  3. Edit its 200 first.

Otherwise in SQL one must enter[2]:

CREATE TABLE [dbo].[table1] (
	[Nom] [varchar](250) NULL,
	[Prénom] [varchar](250) NULL,
	[identifiant] [int] IDENTITY(1,1) NOT NULL)

Filling the first columns[3]:

INSERT INTO table1 VALUES ('Doe', 'Jane', 1), ('Doe', 'John', 2)

To aim some other columns, the fields must be precised. For example, by filling the first name, the last name will be null:

INSERT INTO table1 (First_name, id) VALUES ('Jane', 3)

From another table:

INSERT INTO table1 (First_name, id)
SELECT First_name, ID FROM table2

Update:

UPDATE table1
SET First_name = 'Janet'
WHERE ID = 3
UPDATE table1
SET First_name = t2.First_name, Last_name = t2.Last_name
FROM table1 t1
INNER JOIN table2 t2 on t1.ID = t2.ID_t1

Create an index[edit]

The software PK abbreviation means "primary key".

To create a foreign key, drop down the table, in the menu Keys, right click, new foreign key..., the list of all the table foreign keys appears in a small window (named by default "FK_..." for "foreign key").

In General, Tables and columns specification, click on "..." to select the table and its field to link.

Add a unique id[edit]

Normally each table should own at least one unique id (primary key). However, it's impossible to modify an existing column to attribute the property AUTOINCREMENT needed to such a key.

So to add one:

ALTER TABLE table1 ADD id int NOT NULL IDENTITY (1,1) PRIMARY KEY

Copy a table[edit]

The selection below clones a table with the same fields sizes:

SELECT * INTO table2 FROM table1

Knowing that the table spt_values from the system database master contains a sequential field number, it becomes possible to generate tables with this counter:

SELECT DISTINCT number 
FROM master.dbo.spt_values
WHERE number BETWEEN 2 AND 10

Where:

SELECT DISTINCT 'Line ' + convert(varchar, number, 112) as N into #BlankTable
FROM master.dbo.spt_values
WHERE number BETWEEN 2 AND 10

SELECT * from #BlankTable
N
Line 10
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9

Import a table[edit]

From an array (Excel or Calc) converted for example in CSV encoded in PC DOS, to import it as a new table[4] :

CREATE TABLE Array_to_Table (
  [Champ1] [varchar](500) NULL,
  [Champ2] [varchar](500) NULL,
  [Champ3] [varchar](500) NULL
)
GO
BULK INSERT Array_to_Table
FROM 'C:\Users\superadmin\Desktop\Array1.csv'
WITH (
  FIELDTERMINATOR = ';',
  ROWTERMINATOR = '\n'
)
GO
-- Displays the result
SELECT * from Array_to_Table
GO

Delete a table[edit]

To delete a whole table (data and structure):

DROP TABLE table1

To truncate a table, that is to say to conserve only the headers and columns types, by removing all records:

TRUNCATE TABLE table1
--or
DELETE table1

To delete certain lines from a table:

DELETE table1 WHERE Condition

NB: by adding OUTPUT deleted.* before the WHERE, we get the deleted content instead of the deleted lines number.}}

Research a table[edit]

To research a table which we know the exact name, on all the server databases:

sp_MSforeachdb 'USE ?
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N''[MyTable]'') AND OBJECTPROPERTY(id, N''IsUserTable'') = 1)
BEGIN
  PRINT ''Table found in the database: ?''
END'

Research in all the tables[edit]

SSMS 10 doesn't propose any research function, like one could find it in phpMyAdmin for MySQL for example.

Table research[edit]

This script passes through each database to return the tables which names contain the specified string of characters (at the end):

ALTER Proc FindTable
@TableName nVarchar(50)
As
/*
Purpose : Search for a Table in all databases
Author : Sandesh Segu
Date : 17th July 2009
Version : 1.0
More Scripts  : http://sanssql.blogspot.com
*/
ALTER Table #temp (DatabaseName varchar(50),SchemaName varchar(50),TableName varchar(50))

Declare @SQL Varchar(500)
Set @SQL='Use [?] ;
if exists(Select name from sys.tables where name like '''+@TableName+''') 
insert into #temp 
Select ''?'' AS DatabaseName ,SS.Name AS SchemaName ,ST.Name AS TableName from sys.tables as ST , sys.schemas SS 
where ST.Schema_ID=SS.Schema_ID and ST.name like '''+@TableName+''''

EXEC sp_msforeachdb @SQL

Select * from #temp

Drop table #temp
GO

/* 
Usage: If the exact table name is known then specify the table name else include the wild cards
EXEC FindTable 'Employee'*/
EXEC FindTable '%String of characters to research%'

Research a value[edit]

A field value research in all the tables take a few time[5]:

CREATE TABLE #result(
  id      INT IDENTITY,
  tblName VARCHAR(255),
  colName VARCHAR(255),
  qtRows  INT
)
go

DECLARE @toLookFor VARCHAR(255)
SET @toLookFor = '%String of characters%'

DECLARE cCursor CURSOR LOCAL FAST_FORWARD FOR
SELECT
  '[' + usr.name + '].[' + tbl.name + ']' AS tblName,
  '[' + col.name + ']' AS colName,
  LOWER(typ.name) AS typName
FROM
  sysobjects tbl
    INNER JOIN(
      syscolumns col
        INNER JOIN systypes typ
        ON typ.xtype = col.xtype
    )
    ON col.id = tbl.id
    --
    LEFT OUTER JOIN sysusers usr
    ON usr.uid = tbl.uid

WHERE tbl.xtype = 'U'
  AND LOWER(typ.name) IN(
        'char', 'nchar',
        'varchar', 'nvarchar',
        'text', 'ntext'
      )
ORDER BY tbl.name, col.colorder
--
DECLARE @tblName VARCHAR(255)
DECLARE @colName VARCHAR(255)
DECLARE @typName VARCHAR(255)

DECLARE @sql  NVARCHAR(4000)
DECLARE @crlf CHAR(2)

SET @crlf = CHAR(13) + CHAR(10)

OPEN cCursor
FETCH cCursor
INTO @tblName, @colName, @typName

WHILE @@fetch_status = 0
BEGIN
  IF @typName IN('text', 'ntext')
  BEGIN
    SET @sql = ''
    SET @sql = @sql + 'INSERT INTO #result(tblName, colName, qtRows)' + @crlf
    SET @sql = @sql + 'SELECT @tblName, @colName, COUNT(*)' + @crlf
    SET @sql = @sql + 'FROM ' + @tblName + @crlf
    SET @sql = @sql + 'WHERE PATINDEX(''%'' + @toLookFor + ''%'', ' + @colName + ') > 0' + @crlf
  END
  ELSE
  BEGIN
    SET @sql = ''
    SET @sql = @sql + 'INSERT INTO #result(tblName, colName, qtRows)' + @crlf
    SET @sql = @sql + 'SELECT @tblName, @colName, COUNT(*)' + @crlf
    SET @sql = @sql + 'FROM ' + @tblName + @crlf
    SET @sql = @sql + 'WHERE ' + @colName + ' LIKE ''%'' + @toLookFor + ''%''' + @crlf
  END

  EXECUTE sp_executesql
            @sql,
            N'@tblName varchar(255), @colName varchar(255), @toLookFor varchar(255)',
            @tblName, @colName, @toLookFor

  FETCH cCursor
  INTO @tblName, @colName, @typName
END

SELECT *
FROM #result
WHERE qtRows > 0
ORDER BY id
GO

DROP TABLE #result
go

References[edit]

  1. https://msdn.microsoft.com/en-us/library/bb510625.aspx
  2. https://msdn.microsoft.com/en-us/library/ms174979.aspx
  3. https://msdn.microsoft.com/en-us/library/ms174335.aspx
  4. https://msdn.microsoft.com/en-us/library/ms188365.aspx
  5. http://stackoverflow.com/questions/591853/search-for-a-string-in-an-all-the-tables-rows-and-columns-of-a-db



Stored procedures

Introduction[edit]

A stored procedure (sp) is a group of SQL requests, saved into a database. In SSMS, they can be found just near the tables.

Actually in terms of software architecture, it's better to stored the T-SQL language into the database, because if a tier changes there would be no need to modify another.

Usually the stored procedures manipulate their database tables, however they can also interact with the other databases tables, even located on another server, called a linked server. To create a linked server:

  • In SSMS, click on the menu "Server objects", "Linked servers", and fill the account to use to connect.
  • In SQL, use sp_addlinkedserver[1].

Example of join between two servers:

select *
from table1 t1
inner join [server2].[base2].[dbo].[table2] t2 on t2.id = t1.t2_id

Syntax[edit]

The Microsoft T-SQL language provides a few improvements from the SQL standard:

  • By default, quotation marks play a different role than apostrophes which serves to create strings of characters. To use them in the same way (for example to nest them), one should launch SET QUOTED_IDENTIFIER ON.
  • In SSMS, a SQL request can be executed in three ways:
  1. Directly in a blank window, visible when clicking on "New request". Then it's possible to save it in a .sql file, to be able to reopen it in the same window.
  2. By storing it in a string variable, before executing it with sp_executesql[2]. This has the advantage to allow to incorporate variables (eg: a database name), but the inconvenient to suppress the syntactic coloration, the autocompletion (IntelliSense[3]) and the SSMS debugging. Eg:
     DECLARE @Request1 NVARCHAR(MAX)
     DECLARE @MyTable1 NVARCHAR(MAX)
     SET @MyTable1 = 
     SET @Requst1 =  'SELECT * FROM ' + @MyTable1
     EXECUTE sp_executesql @Request1
    
  3. By executing a procedure stored in a database, which contains the request. Eg:
     EXEC [MaBase1].[dbo].[MyProcedure1]
    

This call can be followed by arguments, like the imperative programming procedures.

Indeed, there a two sorts of variables in the stored procedures:

  1. The private ones, introduced with Declare.
  2. The arguments:
@StartDate varchar(8)       -- Mandatory argument
@EndDate varchar(8) = null  -- Optional argument
if @EndDate is null set @EndDate = convert(varchar,@StartDate + 1,112)
Declare @Name varchar(50)   -- Private variable

To create a new stored procedure:

CREATE PROCEDURE [dbo].[MyProcedure1]

To save an existing stored procedure:

ALTER PROCEDURE [dbo].[MyProcedure1]

Ideally this instruction should be present at the sp beginning, followed by AS + its name, so the code execution save it (and doesn't launch it). To get its result, SSMS offers the option on right click: "Execute the stored procedure...". This generates another SQL request, which opens in a new tab above the result, calling the stored procedure with its parameters.

Attention: SSMS doesn't tolerate a backup a stored procedure with compilation errors. So if the backup is urgent, just comment the code in error or create a temporary .sql.
Attention: the error messages communicate a line number which doesn't correspond to the SSMS lines. It's actually offset from the last GO.

Then, these sp can be called by programs in any programming language which provides a SQL Server driver, such as PHP or VB, and will present the results from a recordset variable.

PRINT[edit]

This command displays something in the Messages tab, by opposition to SELECT which fills the Results tab.

Examples:
print 'Hello World ! ' -- Displays "Hello World !"

declare @n int
set @n = 5

print 'the value is: ' + cast(@n as varchar)

Conditions[edit]

IF[edit]

if @x=1 begin
  print 'x = 1'
end else if @x=2 begin
  print 'x = 2'
end else begin
  print 'x <> 1 et 2'
end
Remark: the begin and the end are optional.

CASE[edit]

set @Season = case 
 when @DayDate = '20110918' then 'summer'
 when @DayDate = '20110922' then 'autumn'
 else 'another season'
end

To add a WHERE condition only if a value is present, the trick is to set in the other case something always true (eg: Field1 = Field1):

declare @Column int = null
select Field1
from Table1
where Field1 = case when isnull(@Column,'')<>'' then @Column else Field1 end

The above example would be simpler with where Field1 = isnull(@Column, Field1).

Loops[edit]

WHILE[4][edit]

The loop "while" uses a condition to stop, for example a counter:

DECLARE @i int
WHILE @i <= 10
BEGIN
   UPDATE Table1
   SET Field2 = "petit" WHERE Field1 = @i
   SET @i = @i + 1
END

CURSOR[edit]

A cursor allows to treat a recordset line by line, each stored in a variable mentioned after INTO, and reinitialized after the NEXT[5]. However, this method is relatively slow and should be avoided when it's possible[6].

For example, if one record treatment depends on the previous one, or to print some characters:

USE Base1
declare @Name varchar(20)
DECLARE cursor1 CURSOR FOR SELECT FirstName FROM Table1
OPEN cursor1

/* First record from the selection */
FETCH NEXT FROM cursor1 into @Name
print 'Hello ' + @Name

/* Treatment of the other records in a loop */
while @@FETCH_STATUS = 0
  begin
    FETCH NEXT FROM cursor1 into @Name
    print 'Hello ' + @Name
  end

CLOSE cursor1;
DEALLOCATE cursor1;

Execution of one stored procedure from another one[edit]

SSMS also provides a step by step execution mode (like in Visual Basic), by pressing F11 at each step it's possible to follow the variables values at the bottom left.

The break points are available too, to jump from one line to another.

Remark: in metaprogramming, no sp modification will be taken into account by the process during its execution.

To execute a sp from another:

ALTER PROCEDURE [dbo].[MyProcedure1]
DECLARE	@result int
EXEC	@result = [dbo].[MyProcedure2] @Parameter1;
if @result = 0 begin
 ...
end

Exceptions[edit]

Appeared with SQL Server 2005, the exceptions handling looks like this:

-- Transaction start
BEGIN TRAN
  BEGIN TRY
   -- Execution
   INSERT INTO Table1(Name1) VALUES ('ABC')
   INSERT INTO Table1(Name1) VALUES ('123')
   -- Transaction submission
   COMMIT TRAN
  END TRY
BEGIN CATCH
 -- Transaction cancellation if error
 ROLLBACK TRAN
END CATCH

Researches[edit]

To get the sp including a particular string:

SELECT name
FROM sysobjects syso
INNER JOIN syscomments sysc
ON syso.id = sysc.id
WHERE
(syso.xtype = 'P' or
syso.xtype = 'V')
AND
(syso.category = 0)
and text like '%String to search%'
group by name

References[edit]

  1. https://msdn.microsoft.com/en-us/library/ms190479.aspx
  2. https://msdn.microsoft.com/en-us/library/ms188001.aspx?f=255&MSPPError=-2147217396
  3. https://msdn.microsoft.com/en-us/library/hcw1s69b.aspx?f=255&MSPPError=-2147217396
  4. http://msdn.microsoft.com/en-us/library/ms178642.aspx
  5. http://msdn.microsoft.com/en-us/library/ms180169.aspx
  6. http://sqlpro.developpez.com/cours/sqlserver/MSSQLServer-avoidCursor/



Functions

min, max[edit]

The functions Min() and Max() respectively return the minimum and the maximum of one field list.

select min(Date) from Calendar where RDV = 'Important'

cast[edit]

Modify a variable type:

 cast(Champ as decimal(12, 6)) -- otherwise '9' > '10'

convert[edit]

Modify a variable type in first parameter, and its length in second.

 convert(varchar, Field1, 112)
 convert(datetime, Field2, 112)       -- otherwise impossible to go through the calendar (eg: D + 1)

Attention: all the variable types are not compatible between them[1].

Problem examples:

 select Date1
 from Table1
 where Date1 between '01/10/2013' and '31/10/2013'

Dates are not systematically recognized without convert. The solution is to store them in the datetime format:

 select Date1
 from Table1
 where Date1 between convert(varchar,'20131001',112) and convert(varchar,'20131031',112)

On the other hand, if an above paragraph date is stored in varchar with slashes, it becomes mandatory to reformat it to be able to compare.

Numerous date formats are available[2].

left, right, and substring[edit]

Allow to cut strings according to some of their characters positions[3].

 select substring('13/10/2013 00:09:19', 7, 4) -- returns the hour character after the seventh, so "2013"

For example with the slashes date case above:

 select Date1
 from Table1
 where right(Date1, 4) + substring(Date1, 4, 2) + left(Date1, 2) between convert(varchar,'20131001',112) and convert(varchar,'20131031',112)

replace and stuff[edit]

Search and replace: allow to replace some string characters according to their values[4].

For example, to update a given folder path[5] :

update Table1
SET Field1 = replace(Field1,'\Old_path\','\New_path\')
where Field1 like '%\Old_path\%'

isnull[edit]

Returns true the variable is null.

select Field1 = case when isnull(@Column,'')='' then '*'  else @Column end
from Table1

Dates[edit]

Date format[edit]

The function GETDATE is used to get the current date. To get another date in the good format, it's necessary to use CONVERT:

select convert(smalldatetime, '2016-01-02', 121)

Date cut[edit]

The function DATEPART extracts a date part without specifying manually its position[6].

However, three functions allow to accelerate these extractions writing:

-- Day
select day(getdate())
-- Month
select month(getdate())
-- Year
select year(getdate())
-- Previous year
select str(year(getdate()) - 1)

Days addition and subtraction[edit]

Herewith two dates manipulation functions[7]:

  • DATEDIFF calculates the interval between two dates[8].
  • DATEADD returns the date resulting from another plus an interval[9].
-- Last day of the previous month
SELECT DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE()),0))
-- Last day of the current month
SELECT DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE())+1,0))
-- Last day of the previous month
SELECT DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE())+2,0))

Example:

SELECT DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,'20150101'),0)) as date

gives:

date
2014-12-31 23:59:59.000

References[edit]

  1. man CONVERT
  2. http://stackoverflow.com/questions/74385/how-to-convert-datetime-to-varchar
  3. man SUBSTRING
  4. man STUFF
  5. man REPLACE
  6. man DATEPART
  7. http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/
  8. man DATEDIFF
  9. man DATEADD



Best Practices

  • Always qualify objects by owner.=
  • Use query "with (nolock)" when you don't require high transactional consistency.
  • Do not use GOTO.
  • Avoid CURSOR use because it's significantly slower. If necessary, always declare the correct type of cursor (FAST_FORWARD).
  • Avoid SELECT INTO for populating temp tables. Create the table then use INSERT SELECT.
  • Always use ANSI join syntax.
  • Always check for object existence.
  • Use SCOPE_IDENTITY() instead of @@IDENTITY.
  • Always check @@TRANCOUNT and commit/rollback as necessary.
  • Order DML to avoid deadlocks.
  • Always check @@ERROR and @@ROWCOUNT by assigning to a variable.
  • Always check sp return values.
  • Do not create cross-database dependencies.
  • Avoid table value UDF – performance problems.
  • Avoid dynamic SQL – if necessary use sp_executesql over EXEC.
  • Avoid using NULL values.
  • When there are only two values, ISNULL is more efficient than COALESCE.
  • Always specify columns; try to avoid "SELECT *". Exceptions include these two cases: "WHERE EXISTS (SELECT * ...)" and aggregate functions.



Geospatial Data

Introduction[edit]

Microsoft's 2008 release of SQL Server finally delivers Geospatial support to the SQL Server product suite.

This allows the storage of spatial data in SQL tables (in the form of points, lines and polygons) and a set of functions to allow the manipulation of this data. Also included are new spatial indexes to support the execution of these functions.

Example Database[edit]

This book will use an example database for the majority of its examples. The code for creating this can be found in Appendix A and should be run, as per the instructions there, in order to be able use the example code throughout this book. What follows here is a brief description of that database and the data contained within. If you wish, then you can skip this section and get straight into the interesting stuff, working out what the database is doing as you go.

Geospatial Data Types[edit]

SQL Server 2008 supports two different spatial data types: GEOMETRY and GEOGRAPHY.

  • GEOMETRY - This data type stores data in projected planar surfaces.
  • GEOGRAPHY - This data type stores data in an ellipsoidal model.

The Geometry Classes define a hierarchy as follows:

GeospatialSQLServer2008 SpatialDataTypes Diagram.jpg

From the diagram we can see that there are seven types of instantiable spatial data types (in orange). Namely:


Point[edit]

A point is an object representing a single location. It always has an X and Y co-ordinate and may additionally have an elevation Z and a measure M.

MultiPoint[edit]

A MultiPoint object is a collection of points. It differs from a LineString and a Polygon as there is no implied connections between the points in the collection. Because of this the boundary of a MultiPoint object is empty.

LineString[edit]

A LineString is again a collection of points. However this differs from the Multipoint object, as the points are in sequence and the LineString object also represents the line segments connecting the points.

MultiLineString[edit]

A MultiLineString is simply a collection of LineStrings.

Polygon[edit]

A Polygon is a collection of points representing a two dimensional surface. A Polygon may consist of a exterior ring and a number of interior rings. For a Polygon object to be a valid instance the interior rings cannot cross one another.

MultiPolygon[edit]

A MultiPolygon is a collection of Polygons.

GeometryCollection[edit]

A GeometryCollection is a collection of geometry (or geography) objects.

Visually[edit]

Importing GeoSpatial Data into SQL Server[edit]

Data can be imported directly into SQL server from the following formats: WKT, WKB and GML. For more detail of these formats please see the appendices.

So I can't import my data from shape files?[edit]

Currently you cannot do this directly, whether this will change in future versions remains to be seen. If you have your data in shape files, or other formats then you will need to find a way to convert it. There are a number of Microsoft Spatial partners who offer tools which will allow you to do this, but obviously this will involve another license fee. Free versions I am sure will begin to appear as SQL Server 2008 releases. Currently Morten Nielsen has such a free tool posted on his blog here [[1]] and Tillmann Eitelberg has published a SSIS shape file source under Ms-PL on CodePlex [[2]]. AutoConViz (by Sugam Sharma, U Sunday Tim and Shashi Gadia) also offers the GUI based spatial format conversion (shape file format to GML) as one of its core functions[[3]].

Import Functions[edit]

Importing spatial data into SQL Server 2008 is done via means of the STxxxfromyyy set of functions, where xxx can be one of the following:

  • Geom - For importing any spatial data type.
  • Point - For importing point data.
  • Line - For importing line data.
  • Poly - For importing polygon data.


  • GeomColl - For importing a Geometry Collection.
  • MPoint - For importing multi point data.
  • MLine - For importing multi line data.
  • MPoly - For importing multi poly data.


and yyy can be

  • Text - For importing data in WKT format.
  • WKB - For importing data in WKB format.
  • Gml - For importing data in GML format. (Note the case of Gml is important and this function lacks the leading ST e.g. GeomfromGml(.....))

Example[edit]

CREATE TABLE Districts 
( DistrictId int IDENTITY (1,1),
DistrictName nvarchar(20),
DistrictGeo geometry);
GO

CREATE TABLE Streets 
( StreetId int IDENTITY (1,1),
StreetName nvarchar(20),
StreetGeo geometry);
GO

INSERT INTO Districts (DistrictName, DistrictGeo)
VALUES ('Downtown',
geometry::STGeomFromText
('POLYGON ((0 0, 150 0, 150 150, 0 150, 0 0))', 0));

INSERT INTO Districts (DistrictName, DistrictGeo)
VALUES ('Green Park',
geometry::STGeomFromText
('POLYGON ((300 0, 150 0, 150 150, 300 150, 300 0))', 0));

INSERT INTO Districts (DistrictName, DistrictGeo)
VALUES ('Harborside',
geometry::STGeomFromText
('POLYGON ((150 0, 300 0, 300 300, 150 300, 150 0))', 0));

INSERT INTO Streets (StreetName, StreetGeo)
VALUES ('First Avenue',
geometry::STGeomFromText
('LINESTRING (100 100, 20 180, 180 180)', 0))
GO

INSERT INTO Streets (StreetName, StreetGeo)
VALUES ('Mercator Street', 
geometry::STGeomFromText
('LINESTRING (300 300, 300 150, 50 51)', 0))
GO

Geospatial SQL functions[edit]

  • STRelate
  • STDisjoint
  • STIntersects
  • STTouches
  • STCrosses
  • STWithin
  • STContains
  • STOverlaps
  • STBuffer
  • STConvexHull
  • STIntersection
  • STUnion
  • STGeomFromText
  • STPointFromText
  • STLineFromText
  • STPolyFromText
  • STGeomFromWKB
  • STPointFromWKB
  • STLineFromWKB
  • STPolyFromWKB

Appendices[edit]

A. Example Database Code

B. WKT (Well Known Text) format definition

C. GML (Geographic Markup Language) format definition

References[edit]

  • Directions Magazine's interview with Ed Katibah [4]
  • Isaac Kunen's Blog [5]
  • Microsoft Spatial Forum [6]
  • Microsoft SQL Server 2008 Spatial Data Overview [7]
  • Microsoft SQL Server 2008 Spatial Data Datasheet [8]
  • Microsoft SQL Server 2008 Spatial Data White Paper [9]
  • Microsoft Books Online [10]
  • Wikipedia [11]
  • AutoConViz for GUI based spatial format conversion online[12]



Geospatial Data/Example Database Code

USE [master]
GO

/****** Object:  Database [Katmai]    Script Date: 05/26/2009 07:23:33 ******/
CREATE DATABASE [Katmai] ON  PRIMARY 
( NAME = N'Katmai', FILENAME = N'c:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\Katmai.mdf' , SIZE = 32768KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'Katmai_log', FILENAME = N'c:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\Katmai_log.ldf' , SIZE = 47616KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO

ALTER DATABASE [Katmai] SET COMPATIBILITY_LEVEL = 100
GO

IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [Katmai].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO

ALTER DATABASE [Katmai] SET ANSI_NULL_DEFAULT OFF 
GO

ALTER DATABASE [Katmai] SET ANSI_NULLS OFF 
GO

ALTER DATABASE [Katmai] SET ANSI_PADDING OFF 
GO

ALTER DATABASE [Katmai] SET ANSI_WARNINGS OFF 
GO

ALTER DATABASE [Katmai] SET ARITHABORT OFF 
GO

ALTER DATABASE [Katmai] SET AUTO_CLOSE OFF 
GO

ALTER DATABASE [Katmai] SET AUTO_CREATE_STATISTICS ON 
GO

ALTER DATABASE [Katmai] SET AUTO_SHRINK OFF 
GO

ALTER DATABASE [Katmai] SET AUTO_UPDATE_STATISTICS ON 
GO

ALTER DATABASE [Katmai] SET CURSOR_CLOSE_ON_COMMIT OFF 
GO

ALTER DATABASE [Katmai] SET CURSOR_DEFAULT  GLOBAL 
GO

ALTER DATABASE [Katmai] SET CONCAT_NULL_YIELDS_NULL OFF 
GO

ALTER DATABASE [Katmai] SET NUMERIC_ROUNDABORT OFF 
GO

ALTER DATABASE [Katmai] SET QUOTED_IDENTIFIER OFF 
GO

ALTER DATABASE [Katmai] SET RECURSIVE_TRIGGERS OFF 
GO

ALTER DATABASE [Katmai] SET  DISABLE_BROKER 
GO

ALTER DATABASE [Katmai] SET AUTO_UPDATE_STATISTICS_ASYNC OFF 
GO

ALTER DATABASE [Katmai] SET DATE_CORRELATION_OPTIMIZATION OFF 
GO

ALTER DATABASE [Katmai] SET TRUSTWORTHY OFF 
GO

ALTER DATABASE [Katmai] SET ALLOW_SNAPSHOT_ISOLATION OFF 
GO

ALTER DATABASE [Katmai] SET PARAMETERIZATION SIMPLE 
GO

ALTER DATABASE [Katmai] SET READ_COMMITTED_SNAPSHOT OFF 
GO

ALTER DATABASE [Katmai] SET HONOR_BROKER_PRIORITY OFF 
GO

ALTER DATABASE [Katmai] SET  READ_WRITE 
GO

ALTER DATABASE [Katmai] SET RECOVERY SIMPLE 
GO

ALTER DATABASE [Katmai] SET  MULTI_USER 
GO

ALTER DATABASE [Katmai] SET PAGE_VERIFY CHECKSUM  
GO

ALTER DATABASE [Katmai] SET DB_CHAINING OFF 
GO

USE [Katmai]
GO

/****** Object:  Table [dbo].[ParkBoundaries]    Script Date: 05/26/2009 07:24:49 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[ParkBoundaries](
	[ID] [int] NOT NULL PRIMARY KEY,
	[Name] [nvarchar](255) NULL,
        [BoundaryType] [nvarchar](255) NULL,
	[geom] [geometry] NULL
)

GO

INSERT INTO [Katmai].[dbo].[ParkBoundaries]
           (ID,
           [BoundaryType]
           ,[Name]
           ,[geom])
     VALUES
 (970, 'Katmai National Preserve', 'National Preserve NPS', Geometry::STPolyFromText('POLYGON ((-155.59092712402344 59.181369781494141, -155.61904907226563 59.173145294189453, -155.61898803710938 59.158145904541016, -155.62699890136719 59.158260345458984, -155.6466064453125 59.158538818359375, -155.64649963378906 59.143989562988281, -155.67501831054688 59.143936157226562, -155.6748046875 59.114841461181641, -155.67523193359375 59.100605010986328, -155.67521667480469 59.091953277587891, -155.67924499511719 59.092010498046875, -155.68949890136719 59.089656829833984, -155.69621276855469 59.087482452392578, -155.70480346679688 59.085666656494141, -155.7056884765625 59.085624694824219, -155.70626831054688 59.085735321044922, -155.70750427246094 59.085975646972656, -155.70755004882813 59.085983276367188, -155.70767211914063 59.086624145507812, -155.70767211914063 59.086639404296875, -155.70771789550781 59.086887359619141, -155.71138000488281 59.0863151550293, -155.71205139160156 59.086208343505859, -155.71304321289063 59.086280822753906, -155.71568298339844 59.086475372314453, -155.71763610839844 59.087287902832031, -155.72056579589844 59.088508605957031, -155.72836303710938 59.091754913330078, -155.7308349609375 59.090713500976562, -155.7320556640625 59.087894439697266, -155.73179626464844 59.0865478515625, -155.73191833496094 59.086086273193359, -155.73231506347656 59.084682464599609, -155.73408508300781 59.084590911865234, -155.73750305175781 59.083961486816406, -155.73753356933594 59.083953857421875, -155.74107360839844 59.083770751953125, -155.74974060058594 59.0824089050293, -155.74998474121094 59.082279205322266, -155.75120544433594 59.081645965576172, -155.75459289550781 59.079868316650391, -155.75662231445313 59.077140808105469, -155.75669860839844 59.077033996582031, -155.75872802734375 59.07373046875, -155.75845336914063 59.0723762512207, -155.75730895996094 59.071063995361328, -155.75349426269531 59.069877624511719, -155.74967956542969 59.068706512451172, -155.74919128417969 59.068309783935547, -155.74861145019531 59.067848205566406, -155.74850463867188 59.067279815673828, -155.74848937988281 59.067264556884766, -155.74826049804688 59.066055297851562, -155.74856567382813 59.065879821777344, -155.74957275390625 59.065357208251953, -155.75311279296875 59.063503265380859, -155.75389099121094 59.063018798828125, -155.75628662109375 59.0615119934082, -155.75721740722656 59.059848785400391, -155.75758361816406 59.059173583984375, -155.75874328613281 59.0559196472168, -155.75877380371094 59.055881500244141, -155.76068115234375 59.054359436035156, -155.76182556152344 59.0534553527832, -155.76332092285156 59.052009582519531, -155.76411437988281 59.051593780517578, -155.76817321777344 59.049468994140625, -155.77085876464844 59.049480438232422, -155.77621459960938 59.049507141113281, -155.779052734375 59.050270080566406, -155.78373718261719 59.051395416259766, -155.78530883789063 59.052261352539062, -155.78675842285156 59.053066253662109, -155.79241943359375 59.054595947265625, -155.79351806640625 59.0550537109375, -155.79728698730469 59.056621551513672, -155.79995727539063 59.056484222412109, -155.80259704589844 59.056346893310547, -155.80628967285156 59.055587768554688, -155.80859375 59.05511474609375, -155.81132507324219 59.054969787597656, -155.81565856933594 59.054740905761719, -155.82635498046875 59.054634094238281, -155.83317565917969 59.053829193115234, -155.83334350585938 59.053810119628906, -155.83961486816406 59.053932189941406, -155.84481811523438 59.053199768066406, -155.8475341796875 59.051044464111328, -155.847900390625 59.050754547119141, -155.84869384765625 59.050254821777344, -155.84930419921875 59.048866271972656, -155.84930419921875 59.048851013183594, -155.84902954101563 59.047508239746094, -155.84907531738281 59.047245025634766, -155.84945678710938 59.045204162597656, -155.84843444824219 59.043766021728516, -155.84825134277344 59.043491363525391, -155.84820556640625 59.043441772460938, -155.84625244140625 59.042617797851562, -155.84536743164063 59.042377471923828, -155.84342956542969 59.041854858398438, -155.84149169921875 59.0402946472168, -155.84129333496094 59.0401496887207, -155.84056091308594 59.038936614990234, -155.83995056152344 59.037940979003906, -155.84017944335938 59.036716461181641, -155.84037780761719 59.035636901855469, -155.83985900878906 59.035198211669922, -155.83932495117188 59.034774780273438, -155.84103393554688 59.034202575683594, -155.84434509277344 59.033126831054688, -155.84866333007813 59.032440185546875, -155.85054016113281 59.031551361083984, -155.8519287109375 59.0308952331543, -155.85183715820313 59.030460357666016, -155.85183715820313 59.030445098876953, -155.85165405273438 59.0295524597168, -155.8516845703125 59.029346466064453, -155.85208129882813 59.027244567871094, -155.85185241699219 59.026100158691406, -155.85185241699219 59.026081085205078, -155.85171508789063 59.025440216064453, -155.85188293457031 59.025314331054688, -155.85249328613281 59.024925231933594, -155.85250854492188 59.024856567382812, -155.85282897949219 59.022167205810547, -155.84664916992188 59.022495269775391, -155.84552001953125 59.022415161132812, -155.84303283691406 59.022232055664062, -155.841796875 59.020484924316406, -155.837890625 59.018848419189453, -155.83573913574219 59.017131805419922, -155.83477783203125 59.016727447509766, -155.82929992675781 59.0161018371582, -155.82496643066406 59.016788482666016, -155.82073974609375 59.017925262451172, -155.81979370117188 59.018146514892578, -155.81817626953125 59.018520355224609, -155.81474304199219 59.019161224365234, -155.81208801269531 59.019302368164062, -155.80424499511719 59.020172119140625, -155.7874755859375 59.025619506835938, -155.78184509277344 59.028656005859375, -155.77523803710938 59.031288146972656, -155.77001953125 59.032016754150391, -155.76826477050781 59.032108306884766, -155.76463317871094 59.031841278076172, -155.76153564453125 59.029720306396484, -155.76046752929688 59.028861999511719, -155.75845336914063 59.028469085693359, -155.75675964355469 59.028141021728516, -155.75030517578125 59.027107238769531, -155.740234375 59.025806427001953, -155.71974182128906 59.025959014892578, -155.71337890625 59.025375366210938, -155.70851135253906 59.023342132568359, -155.70751953125 59.021709442138672, -155.70718383789063 59.021144866943359, -155.70655822753906 59.017982482910156, -155.70663452148438 59.013866424560547, -155.70433044433594 59.011245727539062, -155.70425415039063 59.010791778564453, -155.70150756835938 59.010463714599609, -155.69973754882813 59.010551452636719, -155.69805908203125 59.0110969543457, -155.69233703613281 59.013679504394531, -155.69056701660156 59.013771057128906, -155.68862915039063 59.012958526611328, -155.68492126464844 59.012233734130859, -155.67926025390625 59.010700225830078, -155.67333984375 59.012199401855469, -155.67247009277344 59.012420654296875, -155.66664123535156 59.014549255371094, -155.66213989257813 59.014324188232422, -155.65861511230469 59.014507293701172, -155.65472412109375 59.0174446105957, -155.65234375 59.018939971923828, -155.64651489257813 59.021064758300781, -155.63865661621094 59.021926879882812, -155.62886047363281 59.02197265625, -155.62249755859375 59.021385192871094, -155.61781311035156 59.020256042480469, -155.61296081542969 59.018218994140625, -155.60957336425781 59.018104553222656, -155.60757446289063 59.018035888671875, -155.59848022460938 59.017131805419922, -155.59635925292969 59.015415191650391, -155.59230041503906 59.012882232666016, -155.59017944335938 59.011161804199219, -155.58612060546875 59.008628845214844, -155.58268737792969 59.004711151123047, -155.57650756835938 59.000442504882812, -155.57095336914063 58.999355316162109, -155.56196594238281 58.994335174560547, -155.55809020996094 58.992706298828125, -155.55534362792969 58.992385864257812, -155.5504150390625 58.989898681640625, -155.54759216308594 58.989128112792969, -155.54379272460938 58.987949371337891, -155.53921508789063 58.987270355224609, -155.53567504882813 58.987445831298828, -155.53277587890625 58.986225128173828, -155.52925109863281 58.986400604248047, -155.5284423828125 58.986900329589844, -155.52403259277344 58.987125396728516, -155.52323913574219 58.987617492675781, -155.52069091796875 58.988204956054688, -155.5189208984375 58.988296508789062, -155.51644897460938 58.989334106445312, -155.51371765136719 58.989013671875, -155.51026916503906 58.989643096923828, -155.50868225097656 58.990638732910156, -155.50611877441406 58.9912223815918, -155.50532531738281 58.991718292236328, -155.50209045410156 58.992221832275391, -155.50099182128906 58.992393493652344, -155.50090026855469 58.991939544677734, -155.49800109863281 58.990715026855469, -155.49685668945313 58.989402770996094, -155.49525451660156 58.988731384277344, -155.49395751953125 58.988182067871094, -155.49267578125 58.988033294677734, -155.4912109375 58.987861633300781, -155.48707580566406 58.98724365234375, -155.48663330078125 58.987178802490234, -155.48558044433594 58.986320495605469, -155.48170471191406 58.984687805175781, -155.47892761230469 58.982425689697266, -155.47853088378906 58.982109069824219, -155.47659301757813 58.981288909912109, -155.47578430175781 58.980949401855469, -155.47465515136719 58.980472564697266, -155.47360229492188 58.9796142578125, -155.47325134277344 58.979545593261719, -155.47175598144531 58.979248046875, -155.47087097167969 58.979293823242188, -155.4691162109375 58.9793815612793, -155.46795654296875 58.979244232177734, -155.46638488769531 58.979061126708984, -155.46382141113281 58.979648590087891, -155.46261596679688 58.979709625244141, -155.46205139160156 58.979736328125, -155.46026611328125 58.979824066162109, -155.45907592773438 58.979591369628906, -155.45841979980469 58.979461669921875, -155.45805358886719 58.97930908203125, -155.45770263671875 58.979160308837891, -155.45745849609375 58.979053497314453, -155.45736694335938 58.978599548339844, -155.45721435546875 58.9777946472168, -155.45710754394531 58.977241516113281, -155.45639038085938 58.9761962890625, -155.45588684082031 58.975479125976562, -155.45570373535156 58.974571228027344, -155.45474243164063 58.974166870117188, -155.45378112792969 58.973758697509766, -155.45370483398438 58.973373413085938, -155.45368957519531 58.973304748535156, -155.45320129394531 58.9732666015625, -155.4500732421875 58.973030090332031, -155.44853210449219 58.972381591796875, -155.44813537597656 58.972213745117188, -155.44601440429688 58.972698211669922, -155.44557189941406 58.972797393798828, -155.442138671875 58.973423004150391, -155.43948364257813 58.973556518554688, -155.43922424316406 58.973602294921875, -155.43605041503906 58.974185943603516, -155.43348693847656 58.974769592285156, -155.4290771484375 58.9749870300293, -155.42662048339844 58.975547790527344, -155.426513671875 58.975570678710938, -155.42643737792969 58.975566864013672, -155.42201232910156 58.975341796875, -155.41879272460938 58.975502014160156, -155.4176025390625 58.975559234619141, -155.41592407226563 58.976100921630859, -155.41288757324219 58.977077484130859, -155.41256713867188 58.977180480957031, -155.41204833984375 58.977348327636719, -155.40921020507813 58.9782600402832, -155.40753173828125 58.978797912597656, -155.40737915039063 58.978847503662109, -155.40621948242188 58.979221343994141, -155.40249633789063 58.980419158935547, -155.40000915527344 58.981452941894531, -155.3974609375 58.982036590576172, -155.3948974609375 58.982620239257812, -155.38888549804688 58.983833312988281, -155.38645935058594 58.983161926269531, -155.38607788085938 58.983055114746094, -155.38456726074219 58.983131408691406, -155.3834228515625 58.983188629150391, -155.38299560546875 58.983104705810547, -155.38157653808594 58.982822418212891, -155.37875366210938 58.982051849365234, -155.37730407714844 58.981651306152344, -155.37594604492188 58.981281280517578, -155.3751220703125 58.980934143066406, -155.37496948242188 58.980869293212891, -155.37214660644531 58.980094909667969, -155.36773681640625 58.980312347412109, -155.36685180664063 58.979934692382812, -155.36387634277344 58.978675842285156, -155.35786437988281 58.977287292480469, -155.35757446289063 58.977222442626953, -155.35736083984375 58.9771728515625, -155.35357666015625 58.975990295410156, -155.35028076171875 58.974884033203125, -155.34883117675781 58.974395751953125, -155.34523010253906 58.973190307617188, -155.34407043457031 58.972805023193359, -155.34117126464844 58.971576690673828, -155.337646484375 58.9700813293457, -155.33731079101563 58.969940185546875, -155.33523559570313 58.970043182373047, -155.33378601074219 58.970115661621094, -155.33033752441406 58.970737457275391, -155.32705688476563 58.972270965576172, -155.32418823242188 58.971931457519531, -155.32159423828125 58.971622467041016, -155.30929565429688 58.9676628112793, -155.30731201171875 58.967086791992188, -155.29988098144531 58.964923858642578, -155.28926086425781 58.960418701171875, -155.28459167480469 58.959278106689453, -155.27639770507813 58.958309173583984, -155.267578125 58.958736419677734, -155.26370239257813 58.958366394042969, -155.26123046875 58.9581298828125, -155.25698852539063 58.959247589111328, -155.25556945800781 58.960132598876953, -155.25379943847656 58.961227416992188, -155.25202941894531 58.960700988769531, -155.24720764160156 58.959266662597656, -155.24253845214844 58.958122253417969, -155.23541259765625 58.958011627197266, -155.23384094238281 58.958293914794922, -155.23196411132813 58.958633422851562, -155.23057556152344 58.958698272705078, -155.22930908203125 58.958759307861328, -155.22273254394531 58.956794738769531, -155.21939086914063 58.956401824951172, -155.21726989746094 58.956150054931641, -155.21659851074219 58.956184387207031, -155.2137451171875 58.956321716308594, -155.20941162109375 58.956985473632812, -155.20732116699219 58.9586181640625, -155.206298828125 58.959415435791016, -155.20417785644531 58.961582183837891, -155.20254516601563 58.963249206542969, -155.20048522949219 58.963172912597656, -155.19717407226563 58.963050842285156, -155.19075012207031 58.961990356445312, -155.18923950195313 58.962062835693359, -155.18545532226563 58.962242126464844, -155.18327331542969 58.9647216796875, -155.18251037597656 58.965579986572266, -155.18186950683594 58.966548919677734, -155.17971801757813 58.969818115234375, -155.17459106445313 58.970977783203125, -155.1724853515625 58.970085144042969, -155.17169189453125 58.969745635986328, -155.16937255859375 58.968276977539062, -155.16824340820313 58.967559814453125, -155.16767883300781 58.967201232910156, -155.1666259765625 58.967250823974609, -155.16502380371094 58.967327117919922, -155.15733337402344 58.969062805175781, -155.1502685546875 58.969398498535156, -155.14649963378906 58.968208312988281, -155.14651489257813 58.968166351318359, -155.14682006835938 58.967105865478516, -155.14704895019531 58.966358184814453, -155.15008544921875 58.964485168457031, -155.15025329589844 58.964378356933594, -155.15168762207031 58.962486267089844, -155.15144348144531 58.961128234863281, -155.15116882324219 58.961177825927734, -155.14799499511719 58.961750030517578, -155.14738464355469 58.9617805480957, -155.14181518554688 58.962043762207031, -155.13424682617188 58.961971282958984, -155.13380432128906 58.961967468261719, -155.12641906738281 58.960491180419922, -155.12289428710938 58.960659027099609, -155.11856079101563 58.961322784423828, -155.11740112304688 58.961692810058594, -155.11518859863281 58.962394714355469, -155.11517333984375 58.9635124206543, -155.11505126953125 58.966506958007812, -155.11561584472656 58.969673156738281, -155.11802673339844 58.973213195800781, -155.12005615234375 58.979507446289062, -155.12271118164063 58.984397888183594, -155.12400817871094 58.986621856689453, -155.12417602539063 58.987522125244141, -155.12286376953125 58.987995147705078, -155.12202453613281 58.993183135986328, -155.12493896484375 58.995395660400391, -155.12652587890625 58.9968147277832, -155.12783813476563 58.998363494873047, -155.12892150878906 58.999301910400391, -155.12910461425781 58.99951171875, -155.12947082519531 58.999805450439453, -155.12945556640625 59.000102996826172, -155.12936401367188 59.000514984130859, -155.12940979003906 59.000911712646484, -155.12948608398438 59.001373291015625, -155.12925720214844 59.001853942871094, -155.12896728515625 59.002120971679688, -155.12850952148438 59.002601623535156, -155.12808227539063 59.003314971923828, -155.12744140625 59.004360198974609, -155.12739562988281 59.004791259765625, -155.127197265625 59.005470275878906, -155.12680053710938 59.006034851074219, -155.12623596191406 59.006633758544922, -155.12590026855469 59.006904602050781, -155.13166809082031 59.013584136962891, -155.12442016601563 59.013500213623047, -155.12211608886719 59.013675689697266, -155.11972045898438 59.013774871826172, -155.11436462402344 59.013690948486328, -155.11077880859375 59.013641357421875, -155.10871887207031 59.013668060302734, -155.10568237304688 59.014087677001953, -155.10148620605469 59.014606475830078, -155.09535217285156 59.015785217285156, -155.09132385253906 59.016487121582031, -155.08631896972656 59.017124176025391, -155.08416748046875 59.017509460449219, -155.08049011230469 59.018226623535156, -155.07588195800781 59.0190315246582, -155.072265625 59.019588470458984, -155.07112121582031 59.019809722900391, -155.07026672363281 59.0200309753418, -155.06904602050781 59.020660400390625, -155.0679931640625 59.021492004394531, -155.06706237792969 59.022365570068359, -155.06536865234375 59.024787902832031, -155.065185546875 59.025440216064453, -155.06413269042969 59.026287078857422, -155.06240844726563 59.026714324951172, -155.05992126464844 59.027061462402344, -155.05709838867188 59.027496337890625, -155.05522155761719 59.0281982421875, -155.05366516113281 59.0289306640625, -155.05180358886719 59.02972412109375, -155.049072265625 59.030647277832031, -155.04730224609375 59.031322479248047, -155.04530334472656 59.032375335693359, -155.04461669921875 59.033245086669922, -155.04440307617188 59.034244537353516, -155.04473876953125 59.035415649414062, -155.04501342773438 59.0364990234375, -155.04487609863281 59.037105560302734, -155.04354858398438 59.037994384765625, -155.04104614257813 59.038833618164062, -155.03794860839844 59.039310455322266, -155.03419494628906 59.039794921875, -155.03215026855469 59.040325164794922, -155.03085327148438 59.041606903076172, -155.03028869628906 59.044139862060547, -155.03080749511719 59.046623229980469, -155.03163146972656 59.048671722412109, -155.03192138671875 59.050636291503906, -155.03179931640625 59.051620483398438, -155.03106689453125 59.053085327148438, -155.03012084960938 59.054622650146484, -155.02902221679688 59.056190490722656, -155.02825927734375 59.057266235351562, -155.02827453613281 59.058246612548828, -155.03004455566406 59.060062408447266, -155.03146362304688 59.062381744384766, -155.03201293945313 59.064609527587891, -155.03215026855469 59.066093444824219, -155.03172302246094 59.067325592041016, -155.03082275390625 59.068748474121094, -155.030029296875 59.069736480712891, -155.02934265136719 59.0704460144043, -155.02944946289063 59.071327209472656, -155.03036499023438 59.072898864746094, -155.03179931640625 59.074310302734375, -155.03407287597656 59.077205657958984, -155.035400390625 59.078933715820312, -155.03622436523438 59.080909729003906, -155.0374755859375 59.082103729248047, -155.03927612304688 59.083858489990234, -155.04185485839844 59.085304260253906, -155.04287719726563 59.085922241210938, -155.04356384277344 59.087005615234375, -155.04393005371094 59.08935546875, -155.04425048828125 59.089885711669922, -155.04562377929688 59.090911865234375, -155.04751586914063 59.092315673828125, -155.04830932617188 59.093921661376953, -155.04881286621094 59.096225738525391, -155.04924011230469 59.099472045898438, -155.0487060546875 59.100914001464844, -155.04817199707031 59.101852416992188, -155.0472412109375 59.102249145507812, -155.04171752929688 59.102676391601562, -155.03584289550781 59.103324890136719, -155.03138732910156 59.103885650634766, -155.02691650390625 59.104461669921875, -155.02337646484375 59.105506896972656, -155.02070617675781 59.107273101806641, -155.01925659179688 59.108448028564453, -155.01927185058594 59.109443664550781, -155.01979064941406 59.1099967956543, -155.02093505859375 59.110912322998047, -155.02139282226563 59.11126708984375, -155.02154541015625 59.111354827880859, -155.02146911621094 59.111034393310547, -155.02159118652344 59.110836029052734, -155.02177429199219 59.110618591308594, -155.02203369140625 59.110469818115234, -155.02261352539063 59.1104621887207, -155.02296447753906 59.110641479492188, -155.02297973632813 59.1109733581543, -155.02308654785156 59.1112174987793, -155.02325439453125 59.111366271972656, -155.02351379394531 59.11151123046875, -155.02363586425781 59.1116943359375, -155.0238037109375 59.111858367919922, -155.02384948730469 59.112251281738281, -155.02392578125 59.112556457519531, -155.02384948730469 59.113059997558594, -155.02407836914063 59.113307952880859, -155.02436828613281 59.113552093505859, -155.02456665039063 59.113700866699219, -155.02496337890625 59.113910675048828, -155.02505493164063 59.114109039306641, -155.02413940429688 59.127388000488281, -155.02297973632813 59.127964019775391, -155.02110290527344 59.1283073425293, -155.02085876464844 59.1283073425293, -155.02006530761719 59.128471374511719, -155.019775390625 59.128456115722656, -155.01907348632813 59.128288269042969, -155.01896667480469 59.128265380859375, -155.01838684082031 59.128154754638672, -155.01777648925781 59.128192901611328, -155.01707458496094 59.128280639648438, -155.01637268066406 59.128383636474609, -155.01591491699219 59.128303527832031, -155.01559448242188 59.128223419189453, -155.01530456542969 59.12811279296875, -155.01481628417969 59.128032684326172, -155.01417541503906 59.127971649169922, -155.01373291015625 59.1279411315918, -155.01321411132813 59.127830505371094, -155.01271057128906 59.127742767333984, -155.01260375976563 59.127719879150391, -155.01182556152344 59.127841949462891, -155.01173400878906 59.127986907958984, -155.01161193847656 59.128173828125, -155.01141357421875 59.128704071044922, -155.0108642578125 59.129055023193359, -155.01036071777344 59.129150390625, -155.01007080078125 59.129207611083984, -155.00921630859375 59.129364013671875, -155.00860595703125 59.129631042480469, -155.00820922851563 59.1301155090332, -155.00802612304688 59.130329132080078, -155.00778198242188 59.130352020263672, -155.00759887695313 59.130367279052734, -155.00724792480469 59.130420684814453, -155.00706481933594 59.130718231201172, -155.00691223144531 59.131130218505859, -155.00660705566406 59.131446838378906, -155.00613403320313 59.131534576416016, -155.005859375 59.131465911865234, -155.0057373046875 59.131435394287109, -155.00538635253906 59.131324768066406, -155.00477600097656 59.131477355957031, -155.00424194335938 59.131793975830078, -155.00347900390625 59.131965637207031, -155.00260925292969 59.132156372070312, -155.00181579589844 59.132392883300781, -155.00077819824219 59.132877349853516, -155.0003662109375 59.133213043212891, -155.00021362304688 59.133346557617188, -154.99971008300781 59.1339111328125, -154.99946594238281 59.134391784667969, -154.99945068359375 59.134639739990234, -154.99948120117188 59.134868621826172, -154.99967956542969 59.135181427001953, -154.99990844726563 59.1353759765625, -155.000244140625 59.135593414306641, -155.00038146972656 59.1357536315918, -155.00057983398438 59.135955810546875, -155.00086975097656 59.136211395263672, -155.00091552734375 59.136409759521484, -155.00077819824219 59.136531829833984, -154.99307250976563 59.136554718017578, -154.9732666015625 59.127960205078125, -154.97099304199219 59.126518249511719, -154.96867370605469 59.124977111816406, -154.96630859375 59.123477935791016, -154.96463012695313 59.122470855712891, -154.96153259277344 59.121639251708984, -154.95893859863281 59.121002197265625, -154.95668029785156 59.119773864746094, -154.95448303222656 59.118186950683594, -154.95219421386719 59.117019653320312, -154.94908142089844 59.116058349609375, -154.94676208496094 59.115409851074219, -154.94618225097656 59.115280151367188, -154.94328308105469 59.114456176757812, -154.94108581542969 59.113651275634766, -154.93913269042969 59.112777709960938, -154.93714904785156 59.112472534179688, -154.934326171875 59.112491607666016, -154.93194580078125 59.112422943115234, -154.93032836914063 59.112400054931641, -154.92782592773438 59.112323760986328, -154.92576599121094 59.112148284912109, -154.92337036132813 59.111648559570312, -154.92127990722656 59.110939025878906, -154.9195556640625 59.110397338867188, -154.9178466796875 59.110012054443359, -154.91567993164063 59.109970092773438, -154.9124755859375 59.110427856445312, -154.90969848632813 59.110893249511719, -154.90953063964844 59.110923767089844, -154.9071044921875 59.111091613769531, -154.90399169921875 59.111244201660156, -154.90122985839844 59.111068725585938, -154.89836120605469 59.110752105712891, -154.89634704589844 59.110359191894531, -154.89486694335938 59.109783172607422, -154.89373779296875 59.109066009521484, -154.89292907714844 59.108432769775391, -154.89178466796875 59.108081817626953, -154.88973999023438 59.108180999755859, -154.88734436035156 59.1087532043457, -154.88485717773438 59.109367370605469, -154.883544921875 59.109424591064453, -154.88174438476563 59.109836578369141, -154.87948608398438 59.110347747802734, -154.87718200683594 59.110824584960938, -154.87528991699219 59.110832214355469, -154.87104797363281 59.110393524169922, -154.86724853515625 59.109760284423828, -154.86421203613281 59.109100341796875, -154.86250305175781 59.108600616455078, -154.86141967773438 59.108066558837891, -154.86111450195313 59.107894897460938, -154.80764770507813 59.107692718505859, -154.80615234375 59.103755950927734, -154.8065185546875 59.102733612060547, -154.80772399902344 59.100742340087891, -154.80935668945313 59.098480224609375, -154.81028747558594 59.096591949462891, -154.81022644042969 59.094524383544922, -154.80879211425781 59.091831207275391, -154.806884765625 59.089393615722656, -154.80513000488281 59.087242126464844, -154.80332946777344 59.085639953613281, -154.80184936523438 59.084007263183594, -154.80128479003906 59.083511352539062, -154.79835510253906 59.083366394042969, -154.79562377929688 59.0833625793457, -154.792724609375 59.083347320556641, -154.78868103027344 59.083816528320312, -154.7850341796875 59.0849609375, -154.78237915039063 59.086097717285156, -154.78073120117188 59.086837768554688, -154.77847290039063 59.087188720703125, -154.77731323242188 59.087440490722656, -154.77560424804688 59.087661743164062, -154.77413940429688 59.087924957275391, -154.77247619628906 59.087856292724609, -154.7708740234375 59.087566375732422, -154.76933288574219 59.087265014648438, -154.76811218261719 59.087028503417969, -154.76771545410156 59.086952209472656, -154.76593017578125 59.086441040039062, -154.76431274414063 59.085781097412109, -154.76336669921875 59.085384368896484, -154.7625732421875 59.085105895996094, -154.76222229003906 59.0849494934082, -154.76173400878906 59.084552764892578, -154.76112365722656 59.083690643310547, -154.76060485839844 59.083045959472656, -154.76031494140625 59.0828742980957, -154.75997924804688 59.082950592041016, -154.75984191894531 59.083110809326172, -154.75942993164063 59.0833625793457, -154.75482177734375 59.084194183349609, -154.75440979003906 59.084228515625, -154.75286865234375 59.084243774414062, -154.75103759765625 59.084209442138672, -154.74887084960938 59.084262847900391, -154.74652099609375 59.084346771240234, -154.74447631835938 59.084510803222656, -154.74313354492188 59.085037231445312, -154.74075317382813 59.085910797119141, -154.73910522460938 59.086841583251953, -154.73799133300781 59.087837219238281, -154.73841857910156 59.087802886962891, -154.73841857910156 59.087833404541016, -154.73872375488281 59.091098785400391, -154.73837280273438 59.092185974121094, -154.738037109375 59.093780517578125, -154.73799133300781 59.094924926757812, -154.73797607421875 59.095455169677734, -154.73808288574219 59.095832824707031, -154.73844909667969 59.097114562988281, -154.73866271972656 59.098617553710938, -154.73866271972656 59.100177764892578, -154.73814392089844 59.101932525634766, -154.73716735839844 59.102787017822266, -154.737060546875 59.102886199951172, -154.73703002929688 59.102901458740234, -154.73626708984375 59.103473663330078, -154.73548889160156 59.104263305664062, -154.73493957519531 59.105152130126953, -154.73448181152344 59.105876922607422, -154.7337646484375 59.107807159423828, -154.73347473144531 59.108814239501953, -154.73320007324219 59.109767913818359, -154.73274230957031 59.110813140869141, -154.73225402832031 59.111499786376953, -154.7318115234375 59.111606597900391, -154.73123168945313 59.11175537109375, -154.73025512695313 59.112113952636719, -154.72938537597656 59.1126708984375, -154.72911071777344 59.113136291503906, -154.72952270507813 59.114059448242188, -154.729736328125 59.114288330078125, -154.73039245605469 59.1150016784668, -154.73043823242188 59.1159553527832, -154.72969055175781 59.116863250732422, -154.72872924804688 59.117523193359375, -154.72720336914063 59.117973327636719, -154.72677612304688 59.118099212646484, -154.72581481933594 59.118377685546875, -154.72462463378906 59.1191291809082, -154.72392272949219 59.119903564453125, -154.722900390625 59.121475219726562, -154.72267150878906 59.122882843017578, -154.72268676757813 59.123344421386719, -154.72271728515625 59.124122619628906, -154.72236633300781 59.125820159912109, -154.71910095214844 59.127956390380859, -154.718994140625 59.128025054931641, -154.71879577636719 59.128345489501953, -154.71827697753906 59.129203796386719, -154.71826171875 59.129497528076172, -154.71821594238281 59.130462646484375, -154.71809387207031 59.130741119384766, -154.71766662597656 59.131740570068359, -154.71763610839844 59.132160186767578, -154.71780395507813 59.132251739501953, -154.71797180175781 59.132347106933594, -154.71856689453125 59.132366180419922, -154.72023010253906 59.132366180419922, -154.72030639648438 59.132381439208984, -154.72116088867188 59.132522583007812, -154.72215270996094 59.1326904296875, -154.72412109375 59.133132934570312, -154.72590637207031 59.133632659912109, -154.72735595703125 59.133842468261719, -154.72840881347656 59.133995056152344, -154.73048400878906 59.134536743164062, -154.73158264160156 59.135341644287109, -154.731689453125 59.135421752929688, -154.7318115234375 59.135715484619141, -154.73216247558594 59.136600494384766, -154.73171997070313 59.1380500793457, -154.7315673828125 59.138637542724609, -154.73136901855469 59.139358520507812, -154.73146057128906 59.140209197998047, -154.73200988769531 59.141242980957031, -154.73350524902344 59.143295288085938, -154.73457336425781 59.145206451416016, -154.73585510253906 59.146507263183594, -154.73623657226563 59.146896362304688, -154.73686218261719 59.147411346435547, -154.73854064941406 59.148777008056641, -154.73875427246094 59.14892578125, -154.74105834960938 59.1505012512207, -154.74185180664063 59.151473999023438, -154.74189758300781 59.152442932128906, -154.74174499511719 59.153514862060547, -154.74139404296875 59.155197143554688, -154.74073791503906 59.15643310546875, -154.73983764648438 59.157020568847656, -154.73872375488281 59.157596588134766, -154.73648071289063 59.159225463867188, -154.73446655273438 59.160175323486328, -154.73274230957031 59.161155700683594, -154.732421875 59.161338806152344, -154.7281494140625 59.163597106933594, -154.72509765625 59.165496826171875, -154.72360229492188 59.166786193847656, -154.72288513183594 59.1678466796875, -154.72285461425781 59.16845703125, -154.72283935546875 59.168510437011719, -154.72236633300781 59.170558929443359, -154.72224426269531 59.172119140625, -154.72190856933594 59.173686981201172, -154.7215576171875 59.174919128417969, -154.72126770019531 59.176670074462891, -154.72090148925781 59.178279876708984, -154.72061157226563 59.178558349609375, -154.72032165527344 59.178604125976562, -154.71998596191406 59.178607940673828, -154.71925354003906 59.178573608398438, -154.71829223632813 59.178569793701172, -154.71685791015625 59.178569793701172, -154.71481323242188 59.1783447265625, -154.71270751953125 59.178325653076172, -154.71186828613281 59.178581237792969, -154.71070861816406 59.179012298583984, -154.71043395996094 59.179157257080078, -154.70921325683594 59.1798095703125, -154.70826721191406 59.180831909179688, -154.70779418945313 59.181812286376953, -154.70753479003906 59.182342529296875, -154.70697021484375 59.183635711669922, -154.70643615722656 59.185089111328125, -154.7052001953125 59.186519622802734, -154.70391845703125 59.187080383300781, -154.70315551757813 59.187705993652344, -154.70298767089844 59.187843322753906, -154.70252990722656 59.188468933105469, -154.70256042480469 59.191303253173828, -154.702880859375 59.192363739013672, -154.70289611816406 59.1923942565918, -154.70301818847656 59.1927604675293, -154.703857421875 59.194137573242188, -154.70420837402344 59.194709777832031, -154.70472717285156 59.1955451965332, -154.70481872558594 59.196296691894531, -154.70448303222656 59.1971549987793, -154.70443725585938 59.197185516357422, -154.70330810546875 59.197975158691406, -154.70216369628906 59.199161529541016, -154.701416015625 59.201393127441406, -154.70124816894531 59.201763153076172, -154.70079040527344 59.202831268310547, -154.69975280761719 59.203666687011719, -154.69569396972656 59.205375671386719, -154.69435119628906 59.205753326416016, -154.6932373046875 59.2060661315918, -154.6888427734375 59.206634521484375, -154.68547058105469 59.207115173339844, -154.68521118164063 59.207149505615234, -154.68368530273438 59.207683563232422, -154.68301391601563 59.208530426025391, -154.68316650390625 59.209701538085938, -154.68302917480469 59.210281372070312, -154.6829833984375 59.210514068603516, -154.68208312988281 59.211029052734375, -154.68173217773438 59.211235046386719, -154.6812744140625 59.211387634277344, -154.67976379394531 59.211906433105469, -154.67808532714844 59.212284088134766, -154.67706298828125 59.212135314941406, -154.67555236816406 59.211582183837891, -154.67549133300781 59.2115592956543, -154.67367553710938 59.211288452148438, -154.67123413085938 59.211097717285156, -154.66886901855469 59.210979461669922, -154.66812133789063 59.211036682128906, -154.66680908203125 59.211143493652344, -154.66609191894531 59.210922241210938, -154.66529846191406 59.210670471191406, -154.66415405273438 59.210060119628906, -154.66389465332031 59.209915161132812, -154.66209411621094 59.209373474121094, -154.66123962402344 59.209262847900391, -154.65992736816406 59.209091186523438, -154.65859985351563 59.208938598632812, -154.65727233886719 59.208786010742188, -154.65428161621094 59.208644866943359, -154.65402221679688 59.208644866943359, -154.65066528320313 59.208683013916016, -154.64913940429688 59.208786010742188, -154.64717102050781 59.208919525146484, -154.6444091796875 59.209381103515625, -154.64407348632813 59.209529876708984, -154.64384460449219 59.209632873535156, -154.64373779296875 59.210372924804688, -154.64382934570313 59.211181640625, -154.64376831054688 59.212570190429688, -154.64353942871094 59.213455200195312, -154.64279174804688 59.213954925537109, -154.64218139648438 59.214653015136719, -154.64176940917969 59.215827941894531, -154.64195251464844 59.216983795166016, -154.64227294921875 59.217922210693359, -154.64213562011719 59.219020843505859, -154.64143371582031 59.219806671142578, -154.64138793945313 59.219924926757812, -154.63993835449219 59.221328735351562, -154.63816833496094 59.222583770751953, -154.63783264160156 59.222824096679688, -154.63706970214844 59.223674774169922, -154.636474609375 59.224327087402344, -154.63606262207031 59.225357055664062, -154.63612365722656 59.227264404296875, -154.63716125488281 59.228355407714844, -154.6383056640625 59.2288932800293, -154.64019775390625 59.229450225830078, -154.64173889160156 59.2301025390625, -154.64358520507813 59.230384826660156, -154.64494323730469 59.230384826660156, -154.64595031738281 59.230373382568359, -154.64628601074219 59.230690002441406, -154.64697265625 59.231292724609375, -154.64607238769531 59.2317008972168, -154.64408874511719 59.231998443603516, -154.64234924316406 59.232593536376953, -154.640625 59.233333587646484, -154.64053344726563 59.233390808105469, -154.63937377929688 59.234050750732422, -154.63885498046875 59.234699249267578, -154.63972473144531 59.235897064208984, -154.64155578613281 59.236923217773438, -154.6434326171875 59.237957000732422, -154.64501953125 59.238784790039062, -154.64640808105469 59.239421844482422, -154.64802551269531 59.239986419677734, -154.6490478515625 59.240375518798828, -154.6495361328125 59.240871429443359, -154.64967346191406 59.241317749023438, -154.64955139160156 59.241580963134766, -154.64950561523438 59.241683959960938, -154.64910888671875 59.241722106933594, -154.65000915527344 59.241928100585938, -154.65174865722656 59.242286682128906, -154.65403747558594 59.242866516113281, -154.65411376953125 59.242885589599609, -154.65591430664063 59.243442535400391, -154.6575927734375 59.243961334228516, -154.66029357910156 59.245075225830078, -154.66116333007813 59.245403289794922, -154.66313171386719 59.246147155761719, -154.66622924804688 59.247100830078125, -154.66729736328125 59.247432708740234, -154.66943359375 59.247493743896484, -154.67184448242188 59.247432708740234, -154.67190551757813 59.247428894042969, -154.67512512207031 59.247299194335938, -154.67793273925781 59.247222900390625, -154.678466796875 59.247207641601562, -154.67997741699219 59.247341156005859, -154.68116760253906 59.2474479675293, -154.68212890625 59.247665405273438, -154.683349609375 59.247943878173828, -154.68458557128906 59.248874664306641, -154.68470764160156 59.249301910400391, -154.68446350097656 59.249431610107422, -154.68446350097656 59.249519348144531, -154.68438720703125 59.250457763671875, -154.68440246582031 59.250766754150391, -154.6844482421875 59.251567840576172, -154.68473815917969 59.2527961730957, -154.68533325195313 59.253532409667969, -154.68547058105469 59.253604888916016, -154.68601989746094 59.253921508789062, -154.68708801269531 59.254123687744141, -154.68768310546875 59.254238128662109, -154.68937683105469 59.254501342773438, -154.68984985351563 59.25457763671875, -154.69316101074219 59.255165100097656, -154.69363403320313 59.255252838134766, -154.69499206542969 59.2554931640625, -154.69685363769531 59.255825042724609, -154.69970703125 59.256340026855469, -154.70133972167969 59.256954193115234, -154.70285034179688 59.257518768310547, -154.70570373535156 59.258441925048828, -154.70858764648438 59.259330749511719, -154.70881652832031 59.259517669677734, -154.70887756347656 59.273967742919922, -154.93165588378906 59.273979187011719, -154.93165588378906 59.266326904296875, -154.94551086425781 59.266315460205078, -154.94549560546875 59.259555816650391, -154.97370910644531 59.259647369384766, -154.97369384765625 59.252288818359375, -154.98812866210938 59.252281188964844, -154.98811340332031 59.238330841064453, -155.00187683105469 59.238330841064453, -155.00184631347656 59.230636596679688, -155.07243347167969 59.230621337890625, -155.07270812988281 59.245082855224609, -155.08561706542969 59.245082855224609, -155.08564758300781 59.252262115478516, -155.11392211914063 59.252216339111328, -155.11392211914063 59.2552604675293, -155.11393737792969 59.266654968261719, -155.17037963867188 59.266567230224609, -155.17039489746094 59.273971557617188, -155.42237854003906 59.273967742919922, -155.42233276367188 59.259304046630859, -155.45075988769531 59.259700775146484, -155.45075988769531 59.245075225830078, -155.47897338867188 59.245075225830078, -155.47894287109375 59.230628967285156, -155.50685119628906 59.230567932128906, -155.52339172363281 59.222640991210938, -155.53179931640625 59.216400146484375, -155.55050659179688 59.201683044433594, -155.5635986328125 59.191425323486328, -155.58186340332031 59.183963775634766, -155.59088134765625 59.181381225585938, -155.59092712402344 59.181369781494141))', 0))
,(982, 'Katmai National Park', 'National Park NPS', Geometry::STPolyFromText('POLYGON ((-155.11517333984375 58.9635124206543, -155.08503723144531 58.968799591064453, -155.07968139648438 58.969154357910156, -155.07794189453125 58.968666076660156, -155.07177734375 58.968093872070312, -155.07000732421875 58.968063354492188, -155.06643676757813 58.968448638916016, -155.06288146972656 58.9683837890625, -155.05931091308594 58.968769073486328, -155.05403137207031 58.968215942382812, -155.0469970703125 58.967178344726562, -155.04264831542969 58.966182708740234, -155.03994750976563 58.966587066650391, -155.03811645507813 58.967464447021484, -155.03628540039063 58.968338012695312, -155.03526306152344 58.970138549804688, -155.03346252441406 58.970558166503906, -155.03169250488281 58.970523834228516, -155.02813720703125 58.970455169677734, -155.02548217773438 58.970405578613281, -155.02371215820313 58.970371246337891, -155.02108764648438 58.969867706298828, -155.01937866210938 58.968925476074219, -155.004150390625 58.959083557128906, -155.00341796875 58.956794738769531, -155.00263977050781 58.955413818359375, -155.0028076171875 58.953144073486328, -154.99966430664063 58.947624206542969, -154.99797058105469 58.946681976318359, -154.99800109863281 58.94622802734375, -154.99897766113281 58.94488525390625, -154.99996948242188 58.943538665771484, -155.00088500976563 58.9431037902832, -155.002685546875 58.942680358886719, -155.0179443359375 58.9279670715332, -155.0189208984375 58.9266242980957, -155.01817321777344 58.924789428710938, -155.01741027832031 58.922954559326172, -155.00778198242188 58.921405792236328, -155.00602722167969 58.921371459960938, -155.00340270996094 58.920867919921875, -155.00251770019531 58.920848846435547, -154.99900817871094 58.920326232910156, -154.9964599609375 58.918914794921875, -154.99482727050781 58.917064666748047, -154.9931640625 58.915664672851562, -154.99333190917969 58.913394927978516, -154.99345397949219 58.911579132080078, -154.99514770507813 58.90069580078125, -154.9954833984375 58.883876800537109, -154.99566650390625 58.869327545166016, -154.9954833984375 58.859771728515625, -154.97048950195313 58.851100921630859, -154.94557189941406 58.853340148925781, -154.92868041992188 58.854820251464844, -154.92103576660156 58.8505744934082, -154.92025756835938 58.849193572998047, -154.9202880859375 58.848739624023438, -154.92036437988281 58.847831726074219, -154.92047119140625 58.846469879150391, -154.92057800292969 58.845108032226562, -154.92152404785156 58.844219207763672, -154.92247009277344 58.843326568603516, -154.92402648925781 58.834262847900391, -154.91741943359375 58.828216552734375, -154.91571044921875 58.827274322509766, -154.9140625 58.825874328613281, -154.91366577148438 58.819499969482422, -154.912841796875 58.818572998046875, -154.91117858886719 58.817176818847656, -154.91036987304688 58.816253662109375, -154.910400390625 58.815799713134766, -154.90956115722656 58.815330505371094, -154.90962219238281 58.814418792724609, -154.91058349609375 58.813529968261719, -154.91236877441406 58.813106536865234, -154.91241455078125 58.812652587890625, -154.91244506835938 58.812198638916016, -154.91163635253906 58.811275482177734, -154.91078186035156 58.810806274414062, -154.90817260742188 58.810298919677734, -154.90736389160156 58.809371948242188, -154.9056396484375 58.808879852294922, -154.90386962890625 58.808845520019531, -154.90119934082031 58.809246063232422, -154.89942932128906 58.809211730957031, -154.89762878417969 58.809627532958984, -154.89495849609375 58.810031890869141, -154.89312744140625 58.8109016418457, -154.89132690429688 58.811321258544922, -154.88949584960938 58.81219482421875, -154.86175537109375 58.817085266113281, -154.83488464355469 58.821990966796875, -154.81159973144531 58.826057434082031, -154.8021240234375 58.823127746582031, -154.79075622558594 58.821525573730469, -154.78900146484375 58.821487426757812, -154.78466796875 58.820487976074219, -154.78208923339844 58.819522857666016, -154.7803955078125 58.818576812744141, -154.77778625488281 58.818065643310547, -154.77522277832031 58.817104339599609, -154.771728515625 58.816574096679688, -154.76997375488281 58.816535949707031, -154.7664794921875 58.816009521484375, -154.76475524902344 58.815517425537109, -154.75358581542969 58.811641693115234, -154.75277709960938 58.810714721679688, -154.75112915039063 58.8093147277832, -154.75035095214844 58.807933807373047, -154.74151611328125 58.807743072509766, -154.73973083496094 58.808158874511719, -154.73878479003906 58.809047698974609, -154.73782348632813 58.809940338134766, -154.73690795898438 58.810375213623047, -154.73507690429688 58.811244964599609, -154.73239135742188 58.811641693115234, -154.72970581054688 58.812038421630859, -154.72787475585938 58.812908172607422, -154.72607421875 58.813327789306641, -154.72581481933594 58.816501617431641, -154.7257080078125 58.817867279052734, -154.72476196289063 58.818756103515625, -154.724609375 58.820571899414062, -154.72445678710938 58.8223876953125, -154.72518920898438 58.824222564697266, -154.72599792480469 58.825149536132812, -154.72769165039063 58.826095581054688, -154.72758483886719 58.827457427978516, -154.72746276855469 58.828823089599609, -154.72651672363281 58.829708099365234, -154.69535827636719 58.832672119140625, -154.68910217285156 58.833446502685547, -154.68821716308594 58.833427429199219, -154.68661499023438 58.831573486328125, -154.68583679199219 58.830192565917969, -154.68507385253906 58.828807830810547, -154.68426513671875 58.827884674072266, -154.6826171875 58.826484680175781, -154.68003845214844 58.825515747070312, -154.67831420898438 58.825023651123047, -154.67567443847656 58.824966430664062, -154.67475891113281 58.825397491455078, -154.65763854980469 58.840034484863281, -154.65672302246094 58.840469360351562, -154.65667724609375 58.840923309326172, -154.65664672851563 58.841377258300781, -154.65745544433594 58.842304229736328, -154.6591796875 58.842796325683594, -154.66090393066406 58.843292236328125, -154.66259765625 58.84423828125, -154.66432189941406 58.844730377197266, -154.66600036621094 58.845676422119141, -154.67143249511719 58.854892730712891, -154.67643737792969 58.869102478027344, -154.6805419921875 58.883750915527344, -154.6846923828125 58.897941589355469, -154.6861572265625 58.901611328125, -154.69502258300781 58.901351928710938, -154.69497680664063 58.9127311706543, -154.69468688964844 59.0776252746582, -154.69595336914063 59.078533172607422, -154.69664001464844 59.079063415527344, -154.69715881347656 59.079460144042969, -154.69874572753906 59.080326080322266, -154.69969177246094 59.080596923828125, -154.69990539550781 59.080657958984375, -154.7001953125 59.080741882324219, -154.70210266113281 59.080852508544922, -154.70346069335938 59.08099365234375, -154.7039794921875 59.081050872802734, -154.70654296875 59.08123779296875, -154.7066650390625 59.081260681152344, -154.70951843261719 59.081783294677734, -154.7113037109375 59.082504272460938, -154.71331787109375 59.083564758300781, -154.71499633789063 59.084445953369141, -154.71510314941406 59.084503173828125, -154.71699523925781 59.085506439208984, -154.71717834472656 59.085723876953125, -154.71746826171875 59.086055755615234, -154.71755981445313 59.086158752441406, -154.7181396484375 59.086826324462891, -154.7188720703125 59.087368011474609, -154.71980285644531 59.087429046630859, -154.72178649902344 59.087436676025391, -154.7244873046875 59.087928771972656, -154.72720336914063 59.088546752929688, -154.72958374023438 59.088825225830078, -154.73249816894531 59.088722229003906, -154.73512268066406 59.088432312011719, -154.73715209960938 59.0879020690918, -154.73799133300781 59.087837219238281, -154.73910522460938 59.086841583251953, -154.74075317382813 59.085910797119141, -154.74313354492188 59.085037231445312, -154.74447631835938 59.084510803222656, -154.74652099609375 59.084346771240234, -154.74887084960938 59.084262847900391, -154.75103759765625 59.084209442138672, -154.75286865234375 59.084243774414062, -154.75440979003906 59.084228515625, -154.75482177734375 59.084194183349609, -154.75942993164063 59.0833625793457, -154.75984191894531 59.083110809326172, -154.75997924804688 59.082950592041016, -154.76031494140625 59.0828742980957, -154.76060485839844 59.083045959472656, -154.76112365722656 59.083690643310547, -154.76173400878906 59.084552764892578, -154.76222229003906 59.0849494934082, -154.7625732421875 59.085105895996094, -154.76336669921875 59.085384368896484, -154.76431274414063 59.085781097412109, -154.76593017578125 59.086441040039062, -154.76771545410156 59.086952209472656, -154.76811218261719 59.087028503417969, -154.76933288574219 59.087265014648438, -154.7708740234375 59.087566375732422, -154.77247619628906 59.087856292724609, -154.77413940429688 59.087924957275391, -154.77560424804688 59.087661743164062, -154.77731323242188 59.087440490722656, -154.77847290039063 59.087188720703125, -154.78073120117188 59.086837768554688, -154.78237915039063 59.086097717285156, -154.7850341796875 59.0849609375, -154.78868103027344 59.083816528320312, -154.792724609375 59.083347320556641, -154.79562377929688 59.0833625793457, -154.79835510253906 59.083366394042969, -154.80128479003906 59.083511352539062, -154.80184936523438 59.084007263183594, -154.80332946777344 59.085639953613281, -154.80513000488281 59.087242126464844, -154.806884765625 59.089393615722656, -154.80879211425781 59.091831207275391, -154.81022644042969 59.094524383544922, -154.81028747558594 59.096591949462891, -154.80935668945313 59.098480224609375, -154.80772399902344 59.100742340087891, -154.8065185546875 59.102733612060547, -154.80615234375 59.103755950927734, -154.80764770507813 59.107692718505859, -154.86111450195313 59.107894897460938, -154.86141967773438 59.108066558837891, -154.86250305175781 59.108600616455078, -154.86421203613281 59.109100341796875, -154.86724853515625 59.109760284423828, -154.87104797363281 59.110393524169922, -154.87528991699219 59.110832214355469, -154.87718200683594 59.110824584960938, -154.87948608398438 59.110347747802734, -154.88174438476563 59.109836578369141, -154.883544921875 59.109424591064453, -154.88485717773438 59.109367370605469, -154.88734436035156 59.1087532043457, -154.88973999023438 59.108180999755859, -154.89178466796875 59.108081817626953, -154.89292907714844 59.108432769775391, -154.89373779296875 59.109066009521484, -154.89486694335938 59.109783172607422, -154.89634704589844 59.110359191894531, -154.89836120605469 59.110752105712891, -154.90122985839844 59.111068725585938, -154.90399169921875 59.111244201660156, -154.9071044921875 59.111091613769531, -154.90953063964844 59.110923767089844, -154.90969848632813 59.110893249511719, -154.9124755859375 59.110427856445312, -154.91567993164063 59.109970092773438, -154.9178466796875 59.110012054443359, -154.9195556640625 59.110397338867188, -154.92127990722656 59.110939025878906, -154.92337036132813 59.111648559570312, -154.92576599121094 59.112148284912109, -154.92782592773438 59.112323760986328, -154.93032836914063 59.112400054931641, -154.93194580078125 59.112422943115234, -154.934326171875 59.112491607666016, -154.93714904785156 59.112472534179688, -154.93913269042969 59.112777709960938, -154.94108581542969 59.113651275634766, -154.94328308105469 59.114456176757812, -154.94618225097656 59.115280151367188, -154.94676208496094 59.115409851074219, -154.94908142089844 59.116058349609375, -154.95219421386719 59.117019653320312, -154.95448303222656 59.118186950683594, -154.95668029785156 59.119773864746094, -154.95893859863281 59.121002197265625, -154.96153259277344 59.121639251708984, -154.96463012695313 59.122470855712891, -154.96630859375 59.123477935791016, -154.96867370605469 59.124977111816406, -154.97099304199219 59.126518249511719, -154.9732666015625 59.127960205078125, -154.99307250976563 59.136554718017578, -155.00077819824219 59.136531829833984, -155.00091552734375 59.136409759521484, -155.00086975097656 59.136211395263672, -155.00057983398438 59.135955810546875, -155.00038146972656 59.1357536315918, -155.000244140625 59.135593414306641, -154.99990844726563 59.1353759765625, -154.99967956542969 59.135181427001953, -154.99948120117188 59.134868621826172, -154.99945068359375 59.134639739990234, -154.99946594238281 59.134391784667969, -154.99971008300781 59.1339111328125, -155.00021362304688 59.133346557617188, -155.0003662109375 59.133213043212891, -155.00077819824219 59.132877349853516, -155.00181579589844 59.132392883300781, -155.00260925292969 59.132156372070312, -155.00347900390625 59.131965637207031, -155.00424194335938 59.131793975830078, -155.00477600097656 59.131477355957031, -155.00538635253906 59.131324768066406, -155.0057373046875 59.131435394287109, -155.005859375 59.131465911865234, -155.00613403320313 59.131534576416016, -155.00660705566406 59.131446838378906, -155.00691223144531 59.131130218505859, -155.00706481933594 59.130718231201172, -155.00724792480469 59.130420684814453, -155.00759887695313 59.130367279052734, -155.00778198242188 59.130352020263672, -155.00802612304688 59.130329132080078, -155.00820922851563 59.1301155090332, -155.00860595703125 59.129631042480469, -155.00921630859375 59.129364013671875, -155.01007080078125 59.129207611083984, -155.01036071777344 59.129150390625, -155.0108642578125 59.129055023193359, -155.01141357421875 59.128704071044922, -155.01161193847656 59.128173828125, -155.01173400878906 59.127986907958984, -155.01182556152344 59.127841949462891, -155.01260375976563 59.127719879150391, -155.01271057128906 59.127742767333984, -155.01321411132813 59.127830505371094, -155.01373291015625 59.1279411315918, -155.01417541503906 59.127971649169922, -155.01481628417969 59.128032684326172, -155.01530456542969 59.12811279296875, -155.01559448242188 59.128223419189453, -155.01591491699219 59.128303527832031, -155.01637268066406 59.128383636474609, -155.01707458496094 59.128280639648438, -155.01777648925781 59.128192901611328, -155.01838684082031 59.128154754638672, -155.01896667480469 59.128265380859375, -155.01907348632813 59.128288269042969, -155.019775390625 59.128456115722656, -155.02006530761719 59.128471374511719, -155.02085876464844 59.1283073425293, -155.02110290527344 59.1283073425293, -155.02297973632813 59.127964019775391, -155.02413940429688 59.127388000488281, -155.02505493164063 59.114109039306641, -155.02496337890625 59.113910675048828, -155.02456665039063 59.113700866699219, -155.02436828613281 59.113552093505859, -155.02407836914063 59.113307952880859, -155.02384948730469 59.113059997558594, -155.02392578125 59.112556457519531, -155.02384948730469 59.112251281738281, -155.0238037109375 59.111858367919922, -155.02363586425781 59.1116943359375, -155.02351379394531 59.11151123046875, -155.02325439453125 59.111366271972656, -155.02308654785156 59.1112174987793, -155.02297973632813 59.1109733581543, -155.02296447753906 59.110641479492188, -155.02261352539063 59.1104621887207, -155.02203369140625 59.110469818115234, -155.02177429199219 59.110618591308594, -155.02159118652344 59.110836029052734, -155.02146911621094 59.111034393310547, -155.02154541015625 59.111354827880859, -155.02139282226563 59.11126708984375, -155.02093505859375 59.110912322998047, -155.01979064941406 59.1099967956543, -155.01927185058594 59.109443664550781, -155.01925659179688 59.108448028564453, -155.02070617675781 59.107273101806641, -155.02337646484375 59.105506896972656, -155.02691650390625 59.104461669921875, -155.03138732910156 59.103885650634766, -155.03584289550781 59.103324890136719, -155.04171752929688 59.102676391601562, -155.0472412109375 59.102249145507812, -155.04817199707031 59.101852416992188, -155.0487060546875 59.100914001464844, -155.04924011230469 59.099472045898438, -155.04881286621094 59.096225738525391, -155.04830932617188 59.093921661376953, -155.04751586914063 59.092315673828125, -155.04562377929688 59.090911865234375, -155.04425048828125 59.089885711669922, -155.04393005371094 59.08935546875, -155.04356384277344 59.087005615234375, -155.04287719726563 59.085922241210938, -155.04185485839844 59.085304260253906, -155.03927612304688 59.083858489990234, -155.0374755859375 59.082103729248047, -155.03622436523438 59.080909729003906, -155.035400390625 59.078933715820312, -155.03407287597656 59.077205657958984, -155.03179931640625 59.074310302734375, -155.03036499023438 59.072898864746094, -155.02944946289063 59.071327209472656, -155.02934265136719 59.0704460144043, -155.030029296875 59.069736480712891, -155.03082275390625 59.068748474121094, -155.03172302246094 59.067325592041016, -155.03215026855469 59.066093444824219, -155.03201293945313 59.064609527587891, -155.03146362304688 59.062381744384766, -155.03004455566406 59.060062408447266, -155.02827453613281 59.058246612548828, -155.02825927734375 59.057266235351562, -155.02902221679688 59.056190490722656, -155.03012084960938 59.054622650146484, -155.03106689453125 59.053085327148438, -155.03179931640625 59.051620483398438, -155.03192138671875 59.050636291503906, -155.03163146972656 59.048671722412109, -155.03080749511719 59.046623229980469, -155.03028869628906 59.044139862060547, -155.03085327148438 59.041606903076172, -155.03215026855469 59.040325164794922, -155.03419494628906 59.039794921875, -155.03794860839844 59.039310455322266, -155.04104614257813 59.038833618164062, -155.04354858398438 59.037994384765625, -155.04487609863281 59.037105560302734, -155.04501342773438 59.0364990234375, -155.04473876953125 59.035415649414062, -155.04440307617188 59.034244537353516, -155.04461669921875 59.033245086669922, -155.04530334472656 59.032375335693359, -155.04730224609375 59.031322479248047, -155.049072265625 59.030647277832031, -155.05180358886719 59.02972412109375, -155.05366516113281 59.0289306640625, -155.05522155761719 59.0281982421875, -155.05709838867188 59.027496337890625, -155.05992126464844 59.027061462402344, -155.06240844726563 59.026714324951172, -155.06413269042969 59.026287078857422, -155.065185546875 59.025440216064453, -155.06536865234375 59.024787902832031, -155.06706237792969 59.022365570068359, -155.0679931640625 59.021492004394531, -155.06904602050781 59.020660400390625, -155.07026672363281 59.0200309753418, -155.07112121582031 59.019809722900391, -155.072265625 59.019588470458984, -155.07588195800781 59.0190315246582, -155.08049011230469 59.018226623535156, -155.08416748046875 59.017509460449219, -155.08631896972656 59.017124176025391, -155.09132385253906 59.016487121582031, -155.09535217285156 59.015785217285156, -155.10148620605469 59.014606475830078, -155.10568237304688 59.014087677001953, -155.10871887207031 59.013668060302734, -155.11077880859375 59.013641357421875, -155.11436462402344 59.013690948486328, -155.11972045898438 59.013774871826172, -155.12211608886719 59.013675689697266, -155.12442016601563 59.013500213623047, -155.13166809082031 59.013584136962891, -155.12590026855469 59.006904602050781, -155.12623596191406 59.006633758544922, -155.12680053710938 59.006034851074219, -155.127197265625 59.005470275878906, -155.12739562988281 59.004791259765625, -155.12744140625 59.004360198974609, -155.12808227539063 59.003314971923828, -155.12850952148438 59.002601623535156, -155.12896728515625 59.002120971679688, -155.12925720214844 59.001853942871094, -155.12948608398438 59.001373291015625, -155.12940979003906 59.000911712646484, -155.12936401367188 59.000514984130859, -155.12945556640625 59.000102996826172, -155.12947082519531 58.999805450439453, -155.12910461425781 58.99951171875, -155.12892150878906 58.999301910400391, -155.12783813476563 58.998363494873047, -155.12652587890625 58.9968147277832, -155.12493896484375 58.995395660400391, -155.12202453613281 58.993183135986328, -155.12286376953125 58.987995147705078, -155.12417602539063 58.987522125244141, -155.12400817871094 58.986621856689453, -155.12271118164063 58.984397888183594, -155.12005615234375 58.979507446289062, -155.11802673339844 58.973213195800781, -155.11561584472656 58.969673156738281, -155.11505126953125 58.966506958007812, -155.11517333984375 58.9635124206543))', 0))
,(987, 'Katmai National Park', 'National Park NPS', Geometry::STPolyFromText('POLYGON ((-154.1610107421875 58.999549865722656, -153.66798400878906 58.999515533447266, -153.64302062988281 59.024250030517578, -153.64739990234375 59.027286529541016, -153.65382385253906 59.033390045166016, -153.66128540039063 59.038166046142578, -153.66645812988281 59.047420501708984, -153.67613220214844 59.056354522705078, -153.68199157714844 59.059711456298828, -153.68878173828125 59.062644958496094, -153.69526672363281 59.06829833984375, -153.69647216796875 59.073337554931641, -153.702392578125 59.076244354248047, -153.70855712890625 59.076877593994141, -153.71585083007813 59.075271606445312, -153.71995544433594 59.070384979248047, -153.72377014160156 59.068218231201172, -153.72317504882813 59.065471649169922, -153.7225341796875 59.063175201416016, -153.72677612304688 59.065120697021484, -153.73356628417969 59.068050384521484, -153.73796081542969 59.068630218505859, -153.74520874023438 59.067478179931641, -153.75062561035156 59.066722869873047, -153.7542724609375 59.06591796875, -153.75369262695313 59.06317138671875, -153.75498962402344 59.059566497802734, -153.75430297851563 59.0577278137207, -153.7564697265625 59.054145812988281, -153.75843811035156 59.052383422851562, -153.75996398925781 59.054706573486328, -153.75982666015625 59.056064605712891, -153.76316833496094 59.0579833984375, -153.76765441894531 59.057655334472656, -153.77046203613281 59.056369781494141, -153.77410888671875 59.055568695068359, -153.77587890625 59.055618286132812, -153.77568054199219 59.05743408203125, -153.77105712890625 59.059120178222656, -153.76730346679688 59.060832977294922, -153.76449584960938 59.062114715576172, -153.76345825195313 59.063453674316406, -153.76512145996094 59.064411163330078, -153.77326965332031 59.063278198242188, -153.77853393554688 59.063884735107422, -153.78262329101563 59.067188262939453, -153.78701782226563 59.067768096923828, -153.79495239257813 59.068447113037109, -153.79820251464844 59.071269989013672, -153.80239868164063 59.073665618896484, -153.80931091308594 59.07568359375, -153.81492614746094 59.073112487792969, -153.81976318359375 59.069610595703125, -153.82456970214844 59.066104888916016, -153.8302001953125 59.063533782958984, -153.84127807617188 59.059749603271484, -153.85133361816406 59.057304382324219, -153.85871887207031 59.054782867431641, -153.87100219726563 59.056491851806641, -153.87870788574219 59.0594367980957, -153.88916015625 59.061546325683594, -153.90335083007813 59.061943054199219, -153.91671752929688 59.061851501464844, -153.93431091308594 59.063701629638672, -153.94734191894531 59.066791534423828, -153.95947265625 59.069854736328125, -153.97274780273438 59.070671081542969, -153.98484802246094 59.074184417724609, -153.99819946289063 59.074089050292969, -154.01235961914063 59.074928283691406, -154.02212524414063 59.075187683105469, -154.03025817871094 59.074039459228516, -154.03898620605469 59.075637817382812, -154.04263305664063 59.074825286865234, -154.04534912109375 59.074440002441406, -154.04983520507813 59.074104309082031, -154.05953979492188 59.0748176574707, -154.06758117675781 59.074577331542969, -154.0767822265625 59.071632385253906, -154.08634948730469 59.065059661865234, -154.09133911132813 59.059734344482422, -154.0943603515625 59.056171417236328, -154.09919738769531 59.052204132080078, -154.10200500488281 59.050910949707031, -154.10749816894531 59.049236297607422, -154.10856628417969 59.047443389892578, -154.10884094238281 59.044723510742188, -154.11000061035156 59.042022705078125, -154.11106872558594 59.040229797363281, -154.11476135253906 59.038955688476562, -154.11927795410156 59.038166046142578, -154.12287902832031 59.037803649902344, -154.12602233886719 59.032878875732422, -154.1279296875 59.031566619873047, -154.13236999511719 59.031681060791016, -154.13764953613281 59.032272338867188, -154.14230346679688 59.030120849609375, -154.13888549804688 59.028663635253906, -154.13557434082031 59.026302337646484, -154.13746643066406 59.024990081787109, -154.13946533203125 59.02276611328125, -154.14309692382813 59.021949768066406, -154.14926147460938 59.022563934326172, -154.150146484375 59.022586822509766, -154.15634155273438 59.022747039794922, -154.16090393066406 59.021499633789062, -154.16574096679688 59.017528533935547, -154.16853332519531 59.0114631652832, -154.16777038574219 59.006477355957031, -154.16578674316406 59.005191802978516, -154.16204833984375 59.003971099853516, -154.15994262695313 59.001777648925781, -154.1610107421875 58.999549865722656))', 0))
,(991, 'Katmai Wilderness', 'Wilderness NPS', Geometry::STPolyFromText('POLYGON ((-155.85282897949219 59.022167205810547, -155.85618591308594 59.021080017089844, -155.85865783691406 59.020034790039062, -155.86288452148438 59.018894195556641, -155.86808776855469 59.018161773681641, -155.87583923339844 59.0168342590332, -155.88626098632813 59.015365600585938, -155.89498901367188 59.014442443847656, -155.90910339355469 59.013690948486328, -155.91290283203125 59.01348876953125, -155.91352844238281 59.013454437255859, -155.91677856445313 59.013278961181641, -155.92208862304688 59.012996673583984, -155.92234802246094 59.012981414794922, -155.92343139648438 59.012767791748047, -155.92347717285156 59.01275634765625, -155.93177795410156 59.011104583740234, -155.93681335449219 59.0102424621582, -155.93952941894531 59.0097770690918, -155.94993591308594 59.008304595947266, -155.9559326171875 59.007064819335938, -155.95924377441406 59.004531860351562, -155.95977783203125 59.004116058349609, -155.96734619140625 59.002498626708984, -155.96832275390625 59.002288818359375, -155.96864318847656 59.002182006835938, -155.97000122070313 59.001739501953125, -155.97821044921875 59.002666473388672, -155.98121643066406 59.0030632019043, -155.98554992675781 59.003639221191406, -155.98918151855469 59.003902435302734, -155.989501953125 59.003864288330078, -155.99613952636719 59.003067016601562, -155.99763488769531 59.002986907958984, -156.0023193359375 59.002735137939453, -156.00444030761719 59.002838134765625, -156.00682067871094 59.002948760986328, -156.01141357421875 59.003612518310547, -156.01513671875 59.004325866699219, -156.02236938476563 59.004844665527344, -156.02449035644531 59.004730224609375, -156.02766418457031 59.004554748535156, -156.02928161621094 59.00469970703125, -156.02925109863281 58.985008239746094, -155.99528503417969 58.9688835144043, -156.04298400878906 58.917869567871094, -156.03346252441406 58.912670135498047, -156.002197265625 58.895572662353516, -155.99395751953125 58.891719818115234, -155.96348571777344 58.891197204589844, -155.96150207519531 58.890277862548828, -155.95927429199219 58.889606475830078, -155.95661926269531 58.888931274414062, -155.95408630371094 58.887687683105469, -155.95320129394531 58.887088775634766, -155.95162963867188 58.886020660400391, -155.94906616210938 58.884952545166016, -155.94783020019531 58.884586334228516, -155.94624328613281 58.884117126464844, -155.94416809082031 58.883083343505859, -155.94241333007813 58.882606506347656, -155.94146728515625 58.882717132568359, -155.94071960449219 58.882808685302734, -155.940673828125 58.882820129394531, -155.93946838378906 58.88311767578125, -155.93670654296875 58.883235931396484, -155.93344116210938 58.883319854736328, -155.92996215820313 58.883449554443359, -155.92910766601563 58.883480072021484, -155.92556762695313 58.8834228515625, -155.92280578613281 58.883571624755859, -155.91952514648438 58.883365631103516, -155.91641235351563 58.8835334777832, -155.91331481933594 58.883380889892578, -155.91117858886719 58.883171081542969, -155.9073486328125 58.882511138916016, -155.90507507324219 58.881855010986328, -155.90313720703125 58.881252288818359, -155.90115356445313 58.880649566650391, -155.89997863769531 58.880519866943359, -155.89968872070313 58.880485534667969, -155.89939880371094 58.880512237548828, -155.89883422851563 58.880558013916016, -155.8974609375 58.881488800048828, -155.89674377441406 58.882427215576172, -155.89588928222656 58.883625030517578, -155.89546203613281 58.884239196777344, -155.89479064941406 58.884670257568359, -155.89404296875 58.885246276855469, -155.89378356933594 58.885612487792969, -155.89337158203125 58.8858642578125, -155.89205932617188 58.886318206787109, -155.88996887207031 58.886642456054688, -155.88798522949219 58.887035369873047, -155.88665771484375 58.8873176574707, -155.88568115234375 58.887783050537109, -155.88485717773438 58.888359069824219, -155.8836669921875 58.889015197753906, -155.88313293457031 58.889385223388672, -155.88282775878906 58.890041351318359, -155.88299560546875 58.890918731689453, -155.88311767578125 58.891941070556641, -155.88282775878906 58.892772674560547, -155.88261413574219 58.89324951171875, -155.88243103027344 58.893501281738281, -155.88128662109375 58.893966674804688, -155.87858581542969 58.894630432128906, -155.87583923339844 58.895198822021484, -155.87370300292969 58.895462036132812, -155.87220764160156 58.896194458007812, -155.87101745605469 58.896690368652344, -155.86962890625 58.897308349609375, -155.86732482910156 58.897544860839844, -155.86453247070313 58.897518157958984, -155.86265563964844 58.897346496582031, -155.86244201660156 58.8973388671875, -155.862060546875 58.8973274230957, -155.83509826660156 58.908641815185547, -155.81144714355469 58.91839599609375, -155.8115234375 58.9188232421875, -155.81304931640625 58.921939849853516, -155.81253051757813 58.923793792724609, -155.81150817871094 58.927471160888672, -155.81149291992188 58.927505493164062, -155.80349731445313 58.932037353515625, -155.79769897460938 58.934173583984375, -155.79356384277344 58.935760498046875, -155.78924560546875 58.936443328857422, -155.78359985351563 58.934913635253906, -155.77668762207031 58.932254791259766, -155.75762939453125 58.9423713684082, -155.75791931152344 58.942554473876953, -155.75798034667969 58.942813873291016, -155.75822448730469 58.943172454833984, -155.75846862792969 58.943416595458984, -155.75857543945313 58.943527221679688, -155.75868225097656 58.943706512451172, -155.75877380371094 58.9438591003418, -155.75889587402344 58.944507598876953, -155.75898742675781 58.944660186767578, -155.75910949707031 58.944862365722656, -155.75942993164063 58.945133209228516, -155.75996398925781 58.945327758789062, -155.7607421875 58.9455451965332, -155.76121520996094 58.945713043212891, -155.76181030273438 58.9460334777832, -155.76191711425781 58.946090698242188, -155.7620849609375 58.946292877197266, -155.76225280761719 58.946857452392578, -155.76240539550781 58.947341918945312, -155.76242065429688 58.947776794433594, -155.76226806640625 58.947978973388672, -155.76176452636719 58.947929382324219, -155.76119995117188 58.948200225830078, -155.76071166992188 58.948554992675781, -155.76060485839844 58.949016571044922, -155.76040649414063 58.949527740478516, -155.76066589355469 58.9498405456543, -155.76094055175781 58.950096130371094, -155.76075744628906 58.950447082519531, -155.76042175292969 58.950740814208984, -155.75933837890625 58.950859069824219, -155.75872802734375 58.950981140136719, -155.75788879394531 58.951557159423828, -155.75758361816406 58.952156066894531, -155.75648498535156 58.952926635742188, -155.75613403320313 58.953105926513672, -155.75596618652344 58.953193664550781, -155.75587463378906 58.953411102294922, -155.75584411621094 58.953483581542969, -155.75611877441406 58.953739166259766, -155.75602722167969 58.954158782958984, -155.75619506835938 58.954765319824219, -155.75633239746094 58.955165863037109, -155.75593566894531 58.955593109130859, -155.75587463378906 58.955852508544922, -155.75628662109375 58.956279754638672, -155.75694274902344 58.956516265869141, -155.75703430175781 58.956729888916016, -155.75721740722656 58.956932067871094, -155.7576904296875 58.957256317138672, -155.75772094726563 58.957820892333984, -155.75773620605469 58.958152770996094, -155.75758361816406 58.958644866943359, -155.7574462890625 58.959110260009766, -155.75657653808594 58.959945678710938, -155.75540161132813 58.960891723632812, -155.75428771972656 58.96148681640625, -155.7535400390625 58.961757659912109, -155.75276184082031 58.962043762207031, -155.75140380859375 58.962352752685547, -155.75035095214844 58.9624137878418, -155.75 58.962448120117188, -155.74971008300781 58.962478637695312, -155.74935913085938 58.962802886962891, -155.74778747558594 58.963088989257812, -155.74703979492188 58.963851928710938, -155.74600219726563 58.965297698974609, -155.74446105957031 58.966693878173828, -155.74433898925781 58.966968536376953, -155.74346923828125 58.967056274414062, -155.74308776855469 58.967582702636719, -155.74281311035156 58.968177795410156, -155.74203491210938 58.968353271484375, -155.74137878417969 58.968502044677734, -155.73977661132813 58.968917846679688, -155.73930358886719 58.968914031982422, -155.73765563964844 58.968906402587891, -155.73564147949219 58.968978881835938, -155.73373413085938 58.968734741210938, -155.73216247558594 58.969120025634766, -155.73104858398438 58.970222473144531, -155.73065185546875 58.971366882324219, -155.73037719726563 58.971920013427734, -155.7293701171875 58.971893310546875, -155.72769165039063 58.971817016601562, -155.72593688964844 58.972465515136719, -155.72567749023438 58.973350524902344, -155.725830078125 58.974285125732422, -155.72589111328125 58.974582672119141, -155.72592163085938 58.974777221679688, -155.72471618652344 58.975620269775391, -155.72270202636719 58.976226806640625, -155.72142028808594 58.97662353515625, -155.72065734863281 58.976799011230469, -155.71978759765625 58.976993560791016, -155.71940612792969 58.977699279785156, -155.66886901855469 58.977458953857422, -155.64077758789063 58.977554321289062, -155.6407470703125 58.970565795898438, -155.50198364257813 58.9705696105957, -155.50209045410156 58.992221832275391, -155.50532531738281 58.991718292236328, -155.50611877441406 58.9912223815918, -155.50868225097656 58.990638732910156, -155.51026916503906 58.989643096923828, -155.51371765136719 58.989013671875, -155.51644897460938 58.989334106445312, -155.5189208984375 58.988296508789062, -155.52069091796875 58.988204956054688, -155.52323913574219 58.987617492675781, -155.52403259277344 58.987125396728516, -155.5284423828125 58.986900329589844, -155.52925109863281 58.986400604248047, -155.53277587890625 58.986225128173828, -155.53567504882813 58.987445831298828, -155.53921508789063 58.987270355224609, -155.54379272460938 58.987949371337891, -155.54759216308594 58.989128112792969, -155.5504150390625 58.989898681640625, -155.55534362792969 58.992385864257812, -155.55809020996094 58.992706298828125, -155.56196594238281 58.994335174560547, -155.57095336914063 58.999355316162109, -155.57650756835938 59.000442504882812, -155.58268737792969 59.004711151123047, -155.58612060546875 59.008628845214844, -155.59017944335938 59.011161804199219, -155.59230041503906 59.012882232666016, -155.59635925292969 59.015415191650391, -155.59848022460938 59.017131805419922, -155.60757446289063 59.018035888671875, -155.60957336425781 59.018104553222656, -155.61296081542969 59.018218994140625, -155.61781311035156 59.020256042480469, -155.62249755859375 59.021385192871094, -155.62886047363281 59.02197265625, -155.63865661621094 59.021926879882812, -155.64651489257813 59.021064758300781, -155.65234375 59.018939971923828, -155.65472412109375 59.0174446105957, -155.65861511230469 59.014507293701172, -155.66213989257813 59.014324188232422, -155.66664123535156 59.014549255371094, -155.67247009277344 59.012420654296875, -155.67333984375 59.012199401855469, -155.67926025390625 59.010700225830078, -155.68492126464844 59.012233734130859, -155.68862915039063 59.012958526611328, -155.69056701660156 59.013771057128906, -155.69233703613281 59.013679504394531, -155.69805908203125 59.0110969543457, -155.69973754882813 59.010551452636719, -155.70150756835938 59.010463714599609, -155.70425415039063 59.010791778564453, -155.70433044433594 59.011245727539062, -155.70663452148438 59.013866424560547, -155.70655822753906 59.017982482910156, -155.70718383789063 59.021144866943359, -155.70751953125 59.021709442138672, -155.70851135253906 59.023342132568359, -155.71337890625 59.025375366210938, -155.71974182128906 59.025959014892578, -155.740234375 59.025806427001953, -155.75030517578125 59.027107238769531, -155.75675964355469 59.028141021728516, -155.75845336914063 59.028469085693359, -155.76046752929688 59.028861999511719, -155.76153564453125 59.029720306396484, -155.76463317871094 59.031841278076172, -155.76826477050781 59.032108306884766, -155.77001953125 59.032016754150391, -155.77523803710938 59.031288146972656, -155.78184509277344 59.028656005859375, -155.7874755859375 59.025619506835938, -155.80424499511719 59.020172119140625, -155.81208801269531 59.019302368164062, -155.81474304199219 59.019161224365234, -155.81817626953125 59.018520355224609, -155.81979370117188 59.018146514892578, -155.82073974609375 59.017925262451172, -155.82496643066406 59.016788482666016, -155.82929992675781 59.0161018371582, -155.83477783203125 59.016727447509766, -155.83573913574219 59.017131805419922, -155.837890625 59.018848419189453, -155.841796875 59.020484924316406, -155.84303283691406 59.022232055664062, -155.84552001953125 59.022415161132812, -155.84664916992188 59.022495269775391, -155.85282897949219 59.022167205810547))', 0))

,(1013, 'Katmai National Park', 'National Park NPS', Geometry::STPolyFromText('POLYGON ((-155.52076721191406 58.738410949707031, -155.52365112304688 58.739631652832031, -155.52908325195313 58.740268707275391, -155.53556823730469 58.741767883300781, -155.53775024414063 58.743938446044922, -155.5396728515625 58.744754791259766, -155.54325866699219 58.745025634765625, -155.54835510253906 58.743854522705078, -155.55448913574219 58.7435417175293, -155.56184387207031 58.744991302490234, -155.57023620605469 58.747295379638672, -155.57585144042969 58.74884033203125, -155.58154296875 58.750831604003906, -155.58767700195313 58.755081176757812, -155.59249877929688 58.757118225097656, -155.59556579589844 58.759243011474609, -155.59767150878906 58.760963439941406, -155.60256958007813 58.763450622558594, -155.60371398925781 58.764762878417969, -155.60493469238281 58.766529083251953, -155.60958862304688 58.767658233642578, -155.61256408691406 58.769332885742188, -155.61651611328125 58.771411895751953, -155.617919921875 58.774078369140625, -155.62185668945313 58.776161193847656, -155.62808227539063 58.780864715576172, -155.63308715820313 58.7838020324707, -155.63633728027344 58.786830902099609, -155.64080810546875 58.7916259765625, -155.64202880859375 58.793388366699219, -155.64413452148438 58.79510498046875, -155.64651489257813 58.798179626464844, -155.64862060546875 58.799896240234375, -155.65081787109375 58.802070617675781, -155.65203857421875 58.8038330078125, -155.65397644042969 58.804645538330078, -155.65757751464844 58.804916381835938, -155.66134643554688 58.80609130859375, -155.66433715820313 58.807765960693359, -155.666259765625 58.808574676513672, -155.66740417480469 58.809886932373047, -155.66925048828125 58.810249328613281, -155.67196655273438 58.810562133789062, -155.67636108398438 58.810337066650391, -155.68092346191406 58.811012268066406, -155.68276977539063 58.811374664306641, -155.68374633789063 58.8117790222168, -155.68426513671875 58.814495086669922, -155.68463134765625 58.816303253173828, -155.68585205078125 58.818065643310547, -155.68682861328125 58.8184700012207, -155.68788146972656 58.819328308105469, -155.68972778320313 58.8196907043457, -155.69393920898438 58.818557739257812, -155.69454956054688 58.817157745361328, -155.69602966308594 58.815708160400391, -155.69673156738281 58.81475830078125, -155.69715881347656 58.812450408935547, -155.69664001464844 58.809738159179688, -155.69601440429688 58.806571960449219, -155.69575500488281 58.805217742919922, -155.69538879394531 58.803409576416016, -155.69424438476563 58.802097320556641, -155.69204711914063 58.799930572509766, -155.69082641601563 58.798164367675781, -155.68870544433594 58.79644775390625, -155.68756103515625 58.795135498046875, -155.68466186523438 58.793918609619141, -155.68159484863281 58.791793823242188, -155.67860412597656 58.790122985839844, -155.67579650878906 58.789352416992188, -155.67378234863281 58.7880859375, -155.67352294921875 58.7867317199707, -155.67247009277344 58.785873413085938, -155.66851806640625 58.783794403076172, -155.66535949707031 58.781219482421875, -155.66325378417969 58.779499053955078, -155.66017150878906 58.777374267578125, -155.65797424316406 58.77520751953125, -155.65666198730469 58.772987365722656, -155.65640258789063 58.771633148193359, -155.65420532226563 58.769462585449219, -155.65464782714844 58.767158508300781, -155.65245056152344 58.764984130859375, -155.652099609375 58.763175964355469, -155.65086364746094 58.76141357421875, -155.65147399902344 58.760013580322266, -155.64938354492188 58.758296966552734, -155.64910888671875 58.756938934326172, -155.64990234375 58.756439208984375, -155.65042114257813 58.754585266113281, -155.64840698242188 58.753322601318359, -155.6470947265625 58.751106262207031, -155.64674377441406 58.749294281005859, -155.6436767578125 58.747169494628906, -155.64157104492188 58.745452880859375, -155.63859558105469 58.743778228759766, -155.63735961914063 58.742015838623047, -155.63543701171875 58.741203308105469, -155.63438415527344 58.7403450012207, -155.63307189941406 58.738128662109375, -155.63192749023438 58.73681640625, -155.63078308105469 58.735504150390625, -155.62973022460938 58.734645843505859, -155.62684631347656 58.733425140380859, -155.62193298339844 58.730937957763672, -155.6181640625 58.729763031005859, -155.61631774902344 58.729400634765625, -155.61369323730469 58.729537963867188, -155.61195373535156 58.7296257019043, -155.61019897460938 58.729717254638672, -155.60739135742188 58.728946685791016, -155.60197448730469 58.728313446044922, -155.59916687011719 58.727542877197266, -155.59715270996094 58.726276397705078, -155.59548950195313 58.7268180847168, -155.59469604492188 58.727317810058594, -155.590576171875 58.728900909423828, -155.58708190917969 58.729080200195312, -155.5853271484375 58.729167938232422, -155.58270263671875 58.729305267333984, -155.58183288574219 58.729347229003906, -155.57998657226563 58.728984832763672, -155.57832336425781 58.729530334472656, -155.57745361328125 58.729572296142578, -155.57394409179688 58.729755401611328, -155.57131958007813 58.729888916015625, -155.56326293945313 58.729393005371094, -155.55853271484375 58.727806091308594, -155.55494689941406 58.727531433105469, -155.55232238769531 58.727668762207031, -155.54953002929688 58.726898193359375, -155.54672241210938 58.726123809814453, -155.5401611328125 58.724178314208984, -155.53080749511719 58.721458435058594, -155.52607727050781 58.719871520996094, -155.52232360839844 58.718692779541016, -155.52040100097656 58.717880249023438, -155.51864624023438 58.717967987060547, -155.51768493652344 58.717559814453125, -155.51679992675781 58.717601776123047, -155.51513671875 58.718143463134766, -155.51530456542969 58.719047546386719, -155.51356506347656 58.719139099121094, -155.51119995117188 58.720626831054688, -155.509521484375 58.721168518066406, -155.50778198242188 58.721260070800781, -155.50602722167969 58.721347808837891, -155.50506591796875 58.720939636230469, -155.5042724609375 58.721435546875, -155.50636291503906 58.727725982666016, -155.50775146484375 58.730392456054688, -155.51080322265625 58.732521057128906, -155.51202392578125 58.734287261962891, -155.515869140625 58.735916137695312, -155.52076721191406 58.738410949707031))', 0))

,(1031, 'Katmai Wilderness', 'Wilderness NPS', Geometry::STPolyFromText('POLYGON ((-155.95281982421875 58.6411247253418, -155.95283508300781 58.640670776367188, -155.94935607910156 58.640171051025391, -155.94584655761719 58.640129089355469, -155.94061279296875 58.639156341552734, -155.93798828125 58.639125823974609, -155.93710327148438 58.639114379882812, -155.93623352050781 58.639102935791016, -155.93540954589844 58.637729644775391, -155.93368530273438 58.637252807617188, -155.93196105957031 58.636322021484375, -155.93022155761719 58.636302947998047, -155.92668151855469 58.636714935302734, -155.92320251464844 58.636215209960938, -155.92056274414063 58.636184692382812, -155.91880798339844 58.636161804199219, -155.91618347167969 58.636131286621094, -155.91273498535156 58.634723663330078, -155.90927124023438 58.633769989013672, -155.90493774414063 58.632354736328125, -155.90061950683594 58.630939483642578, -155.89796447753906 58.6313591003418, -155.89535522460938 58.630874633789062, -155.89186096191406 58.630374908447266, -155.88833618164063 58.630783081054688, -155.88742065429688 58.631454467773438, -155.88652038574219 58.632125854492188, -155.88470458984375 58.633468627929688, -155.88380432128906 58.633907318115234, -155.88203430175781 58.634342193603516, -155.88113403320313 58.634784698486328, -155.87847900390625 58.635208129882812, -155.87669372558594 58.635639190673828, -155.87579345703125 58.636081695556641, -155.87489318847656 58.636528015136719, -155.87399291992188 58.636966705322266, -155.87303161621094 58.638774871826172, -155.87385559082031 58.6401481628418, -155.87471008300781 58.6406135559082, -155.87556457519531 58.641078948974609, -155.87815856933594 58.642021179199219, -155.88075256347656 58.642509460449219, -155.88247680664063 58.643440246582031, -155.88587951660156 58.645755767822266, -155.88673400878906 58.646221160888672, -155.888427734375 58.647605895996094, -155.89363098144531 58.6490364074707, -155.89625549316406 58.649070739746094, -155.89891052246094 58.648647308349609, -155.90240478515625 58.649147033691406, -155.90330505371094 58.648700714111328, -155.90420532226563 58.648258209228516, -155.90660095214844 58.647373199462891, -155.90777587890625 58.646942138671875, -155.90924072265625 58.646507263183594, -155.9122314453125 58.645626068115234, -155.91665649414063 58.644771575927734, -155.92193603515625 58.644386291503906, -155.92721557617188 58.644447326660156, -155.93598937988281 58.644557952880859, -155.94302368164063 58.644184112548828, -155.94741821289063 58.644241333007812, -155.94830322265625 58.643795013427734, -155.95008850097656 58.643363952636719, -155.95098876953125 58.642921447753906, -155.95185852050781 58.642929077148438, -155.9527587890625 58.642486572265625, -155.95362854003906 58.642498016357422, -155.95278930664063 58.642032623291016, -155.95281982421875 58.6411247253418))', 0))



Geospatial Data/GML

The Geography Markup Language (GML) is the XML grammar defined by the Open Geospatial Consortium (OGC) to express geographical features. GML serves as a modeling language for geographic systems as well as an open interchange format for geographic transactions on the Internet. Note that the concept of feature in GML is a very general one and includes not only conventional "vector" or discrete objects, but also coverages (see also GMLJP2) and sensor data. The ability to integrate all forms of geographic information is key to the utility of GML.

Standards[edit]

The OGC is an international voluntary consensus standards organization whose members maintain the Geography Markup Language standard. The OGC coordinates with the ISO TC 211 standards organization to maintain consistency between OGC and ISO standards work. GML is in the process of being adopted as an ISO standard (ISO 19136) and is expected to be released as an International Standard in 2007.

GML is the XML data standard for the GeoWeb infrastructure, enabling Internet-connected devices to access geographical information, including, for example, merchant locations and traffic conditions.

GML can also be included in version 1.0 of the United States National Information Exchange Model.

GML model[edit]

The original GML model was based on the World Wide Web Consortium's Resource Description Framework (RDF). Subsequently, the OGC introduced XML schemas into GML's structure to help connect the various existing geographic databases, whose relational structure XML schemas more easily define. The resulting XML-schema-based GML retains many features of RDF, including the idea of child elements as properties of the parent object (RDFS) and the use of remote property references.

GML contains a rich set of primitives which are used to build application specific schemas or application languages. These primitives include:

  • Feature
  • Geometry
  • Coordinate Reference System
  • Time
  • Dynamic feature
  • Coverage (including geographic images)
  • Unit of measure
  • Map presentation styling rules

Profile[edit]

GML profiles are logical restrictions to GML, and may be expressed by a document, an XML schema or both. These profiles are intended to simplify adoption of GML, to facilitate rapid adoption of the standard. The following profiles, as defined by the GML specification, have been published or proposed for public use:

  • A Point Profile for applications with point geometric data but without the need for the full GML grammar
  • A GML Simple Features profile supporting vector feature requests and transactions, e.g. with a WFS
  • A GML profile for GMJP2 (GML in JPEG 2000)
  • A GML profile for RSS

Note that Profiles are distinct from application schemas. Profiles are part of GML namespaces and define restricted subsets of GML. Application schemas are XML vocabularies defined using GML and which live in an application-defined target namespace. Application schemas can be built on specific GML profiles or use the full GML schema set.

Profiles are often created in support for GML derived languages (see application schemas) created in support of particular application domains such as commercial aviation, nautical charting or resource exploitation.

The GML Specification (Since GML v3.) contains a pair of XSLT scripts (usually referred to as the "subset tool") that can be used to construct GML profiles.

GML Simple Features Profile[edit]

The GML Simple Features Profile is a more complete profile of GML than the above Point Profile and supports a wide range of vector feature objects, including the following:

  1. A reduced geometry model allowing 0d, 1d and 2d linear geometric objects (all based on linear interpolation) and the corresponding aggregate geometries (gml:MultiPoint, gml:MultiCurve, etc.).
  2. A simplified feature model which can only be one level deep (in the general GML model, arbitrary nesting of features and feature properties is not permitted).
  3. All non-geometric properties must be XML Schema simple types – i.e. cannot contain nested elements.
  4. Remote property value references (xlink:href) just like in the main GML specification.

Since the profile aims to provide a simple entry point, it does not provide support for the following:

  • coverages
  • topology
  • observations
  • value objects (for real time sensor data)
  • nor support for dynamic features.

Nonetheless it supports a good variety of real world problems.

Subset tool[edit]

In addition, the GML specification provides a subset tool to generate GML profiles containing a user-specified list of components. The tool consists of a pair of XSLT scripts. The scripts generate a profile that a developer may extend manually or otherwise enhance through schema restriction. Note that as restrictions of the full GML specification, application schemas that a profile can generate must themselves be valid GML application schemas.

The subset tool can generate profiles for many other reasons as well. Listing the elements and attributes to include in the resultant profile schema and running the tool results in a single profile schema file containing only the user-specified items and all of the element, attribute and type declarations on which the specified items depend. Some Profile schemas created in this manner support other specifications including IHO S-57 and GML in JPEG 2000.

Application schema[edit]

In order to expose an application's geographic data with GML, a community or organization creates an XML schema specific to the application domain of interest(the application schema). This schema describes the object types whose data the community is interested in and which community applications must expose. For example, an application for tourism may define object types including monuments, places of interest, museums, road exits, and viewpoints in its application schema. Those object types in turn reference the primitive object types defined in the GML standard.

A list of known publicly available GML Application Schemas is being assembled.

Some other markup languages for geography use schema constructs, but GML builds on the existing XML schema model instead of creating a new schema language.

GML and KML[edit]

Note that the KML (Keyhole Markup Language) language made popular by Google is a complementary to GML. Whereas GML is a language to encode geographic content, by describing a spectrum of application objects and their properties (e.g. bridges, roads, buoys, vehicles etc.), KML is a language for the visualization of geographic information. KML can be used to carry GML content, and GML can be "styled" to KML for the purposes of presentation.

GML geometries[edit]

GML encodes the GML geometries, or geometric characteristics, of geographic objects as elements within GML documents. The geometries of those objects may describe, for example, roads, rivers, and bridges.

The key GML geometry object types in GML 1.0 and GML 2.0, are the following:

  • Point
  • LineString
  • Polygon

Note that this geometry model is identical to the geometry model in KML.

Features[edit]

GML defines features distinct from geometry objects. A feature is an application object that represents a physical entity, e.g. a building, a river, or a person. A feature may or may not have geometric aspects. A geometry object defines a location or region instead of a physical entity, and hence is different from a feature. The distinction between features and geometry objects in GML contrasts with models used in other geographic information systems (GIS) that make no such distinction. That is, although some other GIS define features and geometry objects interchangeably as items on a map, GML maintains them as separate entity types.

In GML, a feature can have various geometry properties that describe geometric aspects or characteristics of the feature (e.g. the feature's Point or Extent properties). GML also provides the ability for features to share a geometry property with one another by using a remote property reference on the shared geometry property. Remote properties are a general feature of GML borrowed from RDF. An xlink:href attribute on a GML geometry property means that the value of the property is the resource referenced in the link.

For example, a Building feature in a particular GML application schema might have a position given by the primitive GML geometry object type Point. However, the Building is a separate entity from the Point that defines its position. In addition, a feature may have several geometry properties (or none at all), for example an extent and a position.

Coordinates[edit]

Coordinates in GML represent the coordinates of geometry objects. Coordinates can be specified by any of the following GML elements:

  • <gml:coordinates>
  • <gml:pos>
  • <gml:posList>

GML has multiple ways to represent coordinates. For example, the <gml:coordinates> element can be used, as follows:

<gml:Point gml:id="p21" srsName="urn:ogc:def:crs:EPSG:6.6:4326">
   <gml:coordinates>45.67, 88.56</gml:coordinates>
</gml:Point>

Note that, when expressed as above, the individual coordinates (e.g. 88.56) are not separately accessible through the XML Document Object Model since the content of the <gml:coordinates> element is just a single string.

To make GML coordinates accessible through the XML DOM, GML 3.0 introduced the <gml:pos> and <gml:posList> elements. (Note that although GML versions 1 and 2 had the <gml:coord> element, it is treated as a defect and is not used.) Using the <gml:pos> element instead of the <gml:coordinates> element, the same point can be represented as follows:

<gml:Point gml:id="p21" srsName="urn:ogc:def:crs:EPSG:6.6:4326">
   <gml:pos dimension="2">45.67 88.56</gml:pos>
</gml:Point>

The coordinates of a <gml:LineString> geometry object can be represented with the <gml:coordinates> element:

<gml:LineString gml:id="p21" srsName="urn:ogc:def:crs:EPSG:6.6:4326">
   <gml:coordinates>45.67, 88.56 55.56,89.44</gml:coordinates>
</gml:LineString >

The <gml:posList> element is used to represent a list of coordinate tuples, as required for linear geometries:

<gml:LineString gml:id="p21" srsName="urn:ogc:def:crs:EPSG:6.6:4326">
   <gml:posList dimension="2">45.67 88.56 55.56 89.44</gml:posList>
</gml:LineString >

For GML data servers (WFS) and conversion tools that only support GML 1 or GML 2 (i.e. only the <gml:coordinates> element), there is no alternative to <gml:coordinates>. For GML 3 documents and later, however, <gml:pos> and <gml:posList> are preferable to <gml:coordinates>.

For more information on the srsName attribute, see Coordinate Reference System below.

Coordinate Reference System[edit]

A Coordinate Reference System (CRS) determines the geometry of each geometry element in a GML document.

Unlike KML or GeoRSS, GML does not default to a coordinate system when none is provided. Instead, the desired coordinate system must be specified explicitly with a Coordinate Reference System (CRS) or Spatial Reference System (SRS). The elements whose coordinates are interpreted with respect to such a CRS include the following:

  • <gml:coordinates>
  • <gml:pos>
  • <gml:posList>


An srsName attribute attached to a geometry object specifies the object's CRS, as shown in the following example:

<gml:Point gml:id="p1" srsName="#srs36">
    <gml:coordinates>100,200</gml:coordinates>
</gml:Point>

The value of the srsName attribute is a Uniform Resource Identifier (URI). It refers to a definition of the Coordinate Reference System that is used to interpret the coordinates in the geometry. The CRS definition may be in a document (i.e. a flat file) or in an online web service.

The srsName URI may also be a Uniform Resource Name (URN) for referencing a common CRS definition. The OGC has developed a URN structure and a set specific URNs to encode some common Coordinate Reference Systems. A URN resolver resolves those URNs to GML CRS definitions.

Examples[edit]

Polygons, Points, and LineString objects are encoded in GML 1.0 and 2.0 as follows:

    <gml:Polygon>
        <gml:outerBoundaryIs>
                <gml:LinearRing>
                        <gml:coordinates>0,0 100,0 100,100 0,100 0,0</gml:coordinates>
                </gml:LinearRing>
       </gml:outerBoundaryIs>
    </gml:Polygon>
    <gml:Point>
       <gml:coordinates>100,200</gml:coordinates>
    </gml:Point>
    <gml:LineString>
       <gml:coordinates>100,200 150,300</gml:coordinates>
    </gml:LineString>

Note that LineString objects, along with LinearRing objects, assume linear interpolation between the specified points.

Features using geometries[edit]

The following GML example illustrates the distinction between features and geometry objects. The Building feature has several geometry objects, sharing one of them (the Point with identifier p21) with the SurveyMonument feature:

<abc:Building gml:id="SearsTower">
    <gml:name>Sears Tower</gml:name>
    <abc:height>52</abc:height>
    <abc:position>
        <gml:Point>
            <gml:coordinates>100,200</gml:coordinates>
        </gml:Point>
    </abc:position>
    <app:extent>
        <gml:Polygon>
            <gml:exterior>
                <gml:LinearRing>
                    <gml:coordinates>100,200</gml:coordinates>
                </gml:LinearRing>
            </gml:exterior>
        </gml:Polygon>
    </app:extent>
</abc:Building>
<abc:Building gml:id="SearsTower">
    <abc:position xlink:type="Simple" xlink:href="#p21"/>
</abc:Building>
<abc:SurveyMonument gml:id="g234">
    <abc:position>
        <gml:Point gml:id="p21">
            <gml:coordinates>100,200</gml:coordinates>
        </gml:Point>
    </abc:position>
</abc:SurveyMonument>

Note that the reference is to the shared Point and not to the SurveyMonument, since any feature object can have more than one geometry object property.

Point Profile[edit]

The GML Point Profile contains a single GML geometry, namely a <gml:Point> object type. Any XML Schema can use the Point Profile by importing it and referencing the subject <gml:Point> instance:

<PhotoCollection xmlns="http://www.myphotos.org" xmlns:gml="http://www.opengis.net/gml"    
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://www.myphotos.org
     MyGoodPhotos.xsd">
    <items>
        <Item>
            <name>Lynn Valley</name>
            <description>A shot of the falls from the suspension bridge</description>
            <where>North Vancouver</where>
            <position>
                <gml:Point srsDimension="2" srsName="urn:ogc:def:crs:EPSG:6.6:4326">                                                       
                       <gml:pos>49.40 -123.26</gml:pos>
                 </gml:Point>
             </position>
        </Item>
    </items>
</PhotoCollection>

Note that when using the Point Profile, the only geometry object is the '<gml:Point>' object. The rest of the geography is defined by the photo-collection schema.



Geospatial Data/WKT

Well-known text (WKT) is a text markup language for representing vector geometry objects on a map, spatial reference systems of spatial objects and transformations between spatial reference systems. A binary equivalent, known as well-known binary (WKB) is used to transfer and store the same information on databases, such as PostGIS. The formats are regulated by the Open Geospatial Consortium (OGC) and described in their Simple Feature Access and Coordinate Transformation Service specifications.

Geometric Objects[edit]

Geometric objects that can be represented with WKT are: points, lines, polygons, TINs and Polyhedron]. Multi geometries are also available to represent more than one geometry of the same dimension in a single object, and geometries of different dimensions can be stored in a geometry collection.

Coordinates for geometries may be 2D (x, y), 3D (x, y, z), 4D (x, y, z, m) with a m value that is part of a linear reference system or 3D with a m value (x, y, m). Three dimensional geometries are designated by a Z after the geometry type and geometries with a linear reference system have a M after the geometry type.

WKT geometries are used throughout OGC specifications and are present in applications that implement these specifications. For example, PostGIS contains functions that can convert geometries to and from a WKT representation, making them human readable.

The following are some example geometric WKT strings.

 POINT(6 10)
 LINESTRING(3 4,10 50,20 25)
 POLYGON((1 1,5 1,5 5,1 5,1 1),(2 2, 3 2, 3 3, 2 3,2 2))
 MULTIPOINT(3.5 5.6,4.8 10.5)
 MULTILINESTRING((3 4,10 50,20 25),(-5 -8,-10 -8,-15 -4))
 MULTIPOLYGON(((1 1,5 1,5 5,1 5,1 1),(2 2, 3 2, 3 3, 2 3,2 2)),((3 3,6 2,6 4,3 3)))
 GEOMETRYCOLLECTION(POINT(4 6),LINESTRING(4 6,7 10))
 POINT ZM (1 1 5 60)
 POINT M (1 1 80)

Spatial Reference Systems[edit]

A WKT string for a spatial reference system describes the datum, geoid, coordinate system, and map projection of the spatial objects.

Well-known text is used extensively throughout many GIS programs. ESRI uses WKT in the shapefile *.prj file.

The following is an example of a spatial reference system WKT string.

COMPD_CS["OSGB36 / British National Grid + ODN",
    PROJCS["OSGB 1936 / British National Grid",
        GEOGCS["OSGB 1936",
            DATUM["OSGB_1936",
                SPHEROID["Airy 1830",6377563.396,299.3249646,AUTHORITY["EPSG","7001"]],
                TOWGS84[375,-111,431,0,0,0,0],
                AUTHORITY["EPSG","6277"]],
            PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],
            UNIT["DMSH",0.0174532925199433,AUTHORITY["EPSG","9108"]],
            AXIS["Lat",NORTH],
            AXIS["Long",EAST],
            AUTHORITY["EPSG","4277"]],
        PROJECTION["Transverse_Mercator"],
        PARAMETER["latitude_of_origin",49],
        PARAMETER["central_meridian",-2],
        PARAMETER["scale_factor",0.999601272],
        PARAMETER["false_easting",400000],
        PARAMETER["false_northing",-100000],
        UNIT["metre",1,AUTHORITY["EPSG","9001"]],
        AXIS["E",EAST],
        AXIS["N",NORTH],
        AUTHORITY["EPSG","27700"]],
    VERT_CS["Newlyn",
        VERT_DATUM["Ordnance Datum Newlyn",2005,AUTHORITY["EPSG","5101"]],
        UNIT["metre",1,AUTHORITY["EPSG","9001"]],
        AXIS["Up",UP],
        AUTHORITY["EPSG","5701"]],
    AUTHORITY["EPSG","7405"]]

Transformations[edit]

A WKT format is defined to describe the transformation methods and parameters used to convert coordinates between two different spatial reference systems.

Below are two examples of WKT transformation descriptions.

PARAM_MT["Mercator_2SP", 
    PARAMETER["semi_major",6370997.0], 
    PARAMETER["semi_minor",6370997.0], 
    PARAMETER["central_meridian",180.0], 
    PARAMETER["false_easting",-500000.0], 
    PARAMETER["false_northing",-1000000.0], 
    PARAMETER["standard_parallel_1",60.0]]
PARAM_MT["Affine",
    PARAMETER["num_row",3],
    PARAMETER["num_col",3],
    PARAMETER["elt_0_1",1],
    PARAMETER["elt_0_2",2],
    PARAMETER["elt_1_2",3]]