Geodatabase Programming with SQL

Similar documents
ArcGIS 10.1 Geodatabase Administration. Gordon Sumerling & Christopher Brown

Supported DBMS platforms DB2. Informix. Enterprise ArcSDE Technology. Oracle. GIS data. GIS clients DB2. SQL Server. Enterprise Geodatabase 9.

Working with the Geodatabase Using SQL

Prerequisites Attended the previous technical session: Understanding geodatabase editing workflows: Introduction

Chapter 1: Introduction to ArcGIS Server

GIS Databases With focused on ArcSDE


Basics on Geodatabases

Spatial data models (types) Not taught yet

Data Modeling Basics. John Auel GIS Technician II United Services Group

Bentley ArcGIS. Connector

Enterprise GIS: Database Planning

Database Servers Tutorial

Data Integration for ArcGIS Users Data Interoperability. Charmel Menzel, ESRI Don Murray, Safe Software

ArcGIS Data Models Practical Templates for Implementing GIS Projects

Cookbook 23 September 2013 GIS Analysis Part 1 - A GIS is NOT a Map!

Administering your Oracle Geodatabase

An Esri White Paper February 2011 Best Practices for Storing the ArcGIS Data Reviewer Workspace in an Enterprise Geodatabase for Oracle

Enterprise GIS Solutions to GIS Data Dissemination

Developing Apps with the ArcGIS Runtime SDK for Android. Ben Ramseth Esri Inc. Instructor Technical Lead

Attribute Data and Relational Database. Lecture 5 9/21/2006

Spatial Database Support

Developing Microsoft SQL Server Databases MOC 20464

DBMS / Business Intelligence, SQL Server

A Web services solution for Work Management Operations. Venu Kanaparthy Dr. Charles O Hara, Ph. D. Abstract

Geodatabase Tuning and Performance. Gillian Silvertand Greg Cunningham

Introduction to the ArcGIS Data Model and Application Structure

Oracle Database 10g Express

Using CAD Data in ArcGIS

Archival Challenges Associated with the Esri Personal Geodatabase and File Geodatabase Formats

INTRODUCTION TO ARCGIS SOFTWARE

ArcSDE Spatial Data Management Roles and Responsibilities

ArcGIS Server and Geodatabase Administration for 10.2

SQL Server An Overview

An Esri White Paper February 2011 Best Practices for Storing the ArcGIS Data Reviewer Workspace in an Enterprise Geodatabase for SQL Server

Developing Microsoft SQL Server Databases 20464C; 5 Days

Course 20464C: Developing Microsoft SQL Server Databases

TELECOM FIBER EDITING TOOLS REFERENCE GUIDE Version 1.2

Administering your PostgreSQL Geodatabase

Lecture 8. Online GIS

Course 6232A: Implementing a Microsoft SQL Server 2008 Database

ArcGIS. Server. A Complete and Integrated Server GIS

Oracle Data Integrator: Administration and Development

Terry Sherman Oklahoma South Central Arc-Users Group th Annual Conference 9/23/2014

David Dye. Extract, Transform, Load

Web Editing Tutorial. Copyright Esri All rights reserved.

SAP Business Objects Business Intelligence platform Document Version: 4.1 Support Package Data Federation Administration Tool Guide

20464C: Developing Microsoft SQL Server Databases

SQL Server for developers. murach's TRAINING & REFERENCE. Bryan Syverson. Mike Murach & Associates, Inc. Joel Murach

Managing Imagery and Raster Data in ArcGIS

Data Interoperability Extension Tutorial

UNLEASHED. The Field Calculator. By Tom Neer, EDAW, Inc.

Understanding ArcSDE. GIS by ESRI

Adam Rauch Partner, LabKey Software Extending LabKey Server Part 1: Retrieving and Presenting Data

Course 20464: Developing Microsoft SQL Server Databases

Developing Microsoft SQL Server Databases

DATABASE MANAGEMENT FILES GIS06

Personal Geodatabase 101

ArcGIS Workflow Manager: An Overview

DEVELOPING AND IMPLEMENTING MULTIUSER, FULLY RELATIONAL GIS DATABASE FOR DESKTOP SYSTEMS USING OPEN SOURCE TECHNOLOGIES

Oracle Database 10g: Building GIS Applications Using the Oracle Spatial Network Data Model. An Oracle Technical White Paper May 2005

Oracle Data Integrator 12c: Integration and Administration

Oracle Data Integrator 11g: Integration and Administration

Using SAS as a Relational Database

10. Creating and Maintaining Geographic Databases. Learning objectives. Keywords and concepts. Overview. Definitions

An Esri White Paper August 2009 ArcGIS Server in Practice Series High-Capacity Map Services: A Use Case with CORINE Land-Cover Data

INTRODUCING ORACLE APPLICATION EXPRESS. Keywords: database, Oracle, web application, forms, reports

Schema Evolution in SQL-99 and Commercial (Object-)Relational DBMS

Outline. MCSE: Data Platform. Course Content. Course 10776C: MCSA: Developing Microsoft SQL Server 2012 Databases 5 Days

Optimizing the Performance of the Oracle BI Applications using Oracle Datawarehousing Features and Oracle DAC

Comparing Microsoft SQL Server 2005 Replication and DataXtend Remote Edition for Mobile and Distributed Applications

SQL Server Training Course Content

An Esri White Paper October 2010 Esri Production Mapping Product Library: Spatially Enabled Document Management System

Creating a File Geodatabase

Government 1008: Introduction to Geographic Information Systems. LAB EXERCISE 4: Got Database?

Mobile Solutions for Data Collection. Sarah Croft and Laura Pierik

Virtuoso Replication and Synchronization Services

Leveraging Cloud-Based Mapping Solutions

How To Create A Table In Sql (Ahem)

Oracle Essbase Integration Services. Readme. Release

GIS Architecture and Data Management Practices Boone County GIS Created and Maintained by the Boone County Planning Commission GIS Services Division

The Spatial Data Standards for Facilities, Infrastructure, and Environment Online (SDSFIE Online) Web Site.

How To Improve Gis Data Quality

(Geo)database and Data Management

Netezza Workbench Documentation

The Relational Model. Why Study the Relational Model?

University of Arkansas Libraries ArcGIS Desktop Tutorial. Section 4: Preparing Data for Analysis

Developing Microsoft SQL Server Databases (20464) H8N64S

Data Validation Online References

The Importance of Data Quality in your Enterprise

Analysing Big Data in ArcGIS

INTEGRATING BIM AND GIS FOR ASSET MANAGEMENT

GIS Data in ArcGIS. Pay Attention to Data!!!

13/10/2011. Data Integration and Interoperability. Gordon Sumerling & Maree Wilson

Sisense. Product Highlights.

Basic Concepts of Database Systems

A Workflow for Creating and Sharing Maps

MARICOPA COUNTY ASSESSOR S OFFICE

2 Working with a Desktop GeoDatabase

Transcription:

DevSummit DC February 11, 2015 Washington, DC Geodatabase Programming with SQL Craig Gillgrass

Assumptions Basic knowledge of SQL and relational databases Basic knowledge of the Geodatabase We ll hold all questions till end Please turn off cell phones

Roadmap Using databases in ArcGIS Building on databases with the geodatabase Accessing the schema of a geodatabase through SQL Editing a geodatabase through SQL

Databases You might have spatial or nonspatial data in a database that you want to use in ArcGIS - Oracle, SQL Server, DB2, Informix, PostGreSQL, Netezza You can connect directly to a supported database and view the data in the tables by making a connection from the Catalog tree in ArcGIS for Desktop To filter what data appears in ArcMap, you can use a query layer Use SQL to access the data within the database

What can you access in a Database? Rows and Tables - Containing zero to many rows - One to many columns - All rows in the table have the same schema Can perform table management tasks - View and modify schema - Add and remove rows - Perform queries

What can you access in a Database? A table with a column that stores a spatial type - We call this a feature class Each row represents a feature The fields in each row represent various characteristics or properties of the feature One of the fields holds the feature geometry which is stored as a spatial type

Viewing database data in ArcGIS Tables (with and without a spatial type) are viewed in ArcGIS through a query layer - Define the layer yourself or let ArcGIS discover how to define it Query Layer is a layer that is defined by a SQL query - Provide data integration with geodatabases as well as from databases - Can quickly integrate spatial and nonspatial information into GIS projects independently of where and how that information is stored

Viewing database data in ArcGIS Simple SQL query SELECT * FROM dbo.hurricanetracks_2005 hurricane

Viewing database data in ArcGIS Most complex SQL query that uses casting, derived columns and spatial operators SELECT county.id, county.state_name, county.name county_name, county.pop1990 population, CAST(county.POP1990 as decimal)/cast(states.pop1990 as decimal)*100 PctStatePop, county.shape FROM dbo.hurricanetracks_2005 hurricane, dbo.counties county, dbo.states states WHERE hurricane.name = 'KATRINA' AND hurricane.shape.stintersects(county.shape) = 1

Viewing database data in ArcGIS Most complex SQL query that uses casting, derived columns and spatial operators SELECT county.id, county.state_name, county.name county_name, county.pop1990 population, CAST(county.POP1990 as decimal)/cast(states.pop1990 as decimal)*100 PctStatePop, county.shape FROM dbo.hurricanetracks_2005 hurricane, dbo.counties county, dbo.states states WHERE hurricane.name = 'KATRINA' AND hurricane.shape.stintersects(county.shape) = 1

Viewing database data in ArcGIS Most complex SQL query that uses casting, derived columns and spatial operators SELECT county.id, county.state_name, county.name county_name, county.pop1990 population, CAST(county.POP1990 as decimal)/cast(states.pop1990 as decimal)*100 PctStatePop, county.shape FROM dbo.hurricanetracks_2005 hurricane, dbo.counties county, dbo.states states WHERE hurricane.name = 'KATRINA' AND hurricane.shape.stintersects(county.shape) = 1

Viewing database data in ArcGIS Most complex SQL query that uses casting, derived columns and spatial operators SELECT county.id, county.state_name, county.name county_name, county.pop1990 population, CAST(county.POP1990 as decimal)/cast(states.pop1990 as decimal)*100 PctStatePop, county.shape FROM dbo.hurricanetracks_2005 hurricane, dbo.counties county, dbo.states states WHERE hurricane.name = 'KATRINA' AND hurricane.shape.stintersects(county.shape) = 1

Viewing database data in ArcGIS Most complex SQL query that uses casting, derived columns and spatial operators SELECT county.id, county.state_name, county.name county_name, county.pop1990 population, CAST(county.POP1990 as decimal)/cast(states.pop1990 as decimal)*100 PctStatePop, county.shape FROM dbo.hurricanetracks_2005 hurricane, dbo.counties county, dbo.states states WHERE hurricane.name = 'KATRINA' AND hurricane.shape.stintersects(county.shape) = 1

Other Database Tasks Connecting to a database Supported data types Viewing data and query layers Administer the database (e.g. grant access) Create new tables and alter schema

Building on top of Database Functionality Cases where you want to do more with your data Store business rules with the data so they re available to everyone who accesses the data Advanced data modeling such as with transportation or utility networks Store and work with detailed cartography Multiple editors working on the same data at the same time without impacting each other

What is the Geodatabase? A physical store of geographic data - Scalable storage model supported on different platforms Core ArcGIS information model - A comprehensive model for representing and managing GIS data - Implemented as a series of simple tables A transactional model for managing GIS workflows Set of components for accessing data

Geodatabase is based on relational principles The geodatabase is built on an extended relational database Leverages key DBMS principles and concepts to store geographic data as tables in a DBMS The core of the geodatabase is a standard relational database schema - a series of standard database tables, column types, indexes, and other database objects

Geodatabase Schema There are two sets of tables: - Dataset tables (user-defined tables) - Geodatabase system tables System tables XML User data SQL Type

User-defined tables Stores the content of each dataset in the geodatabase Datasets are stored in 1 or more tables Spatial Types enhance the capabilities of the geodatabase - SQL access to geometry - Industry standard storage model and API System tables XML User data SQL Type

Geodatabase system tables System tables store definitions, rules, and behavior for datasets Tracks contents within a geodatabase 4 main system tables Geodatabase schema is stored primarily within an XML field System tables XML User data SQL Type

Geodatabase Schema System tables XML User data SQL Type

Geodatabase Schema System tables XML User data SQL Type

Geodatabase Schema System tables XML User data SQL Type

Geodatabase Schema System tables XML User data SQL Type

Geodatabase Schema System tables XML User data SQL Type

Accessing Geodatabase through SQL Access schema and properties of existing datasets - Use SQL statements to query the definition attribute on the gdb_items table Editing tables/feature classes, whether versioned or not - Via versioned views with versioned classes Create tables with SQL containing spatial or raster types Leverage SQL functions to evaluate attributes and spatial relationships, perform spatial operations, and return and set spatial properties

Accessing Geodatabase through SQL With SQL, you access the data at the DBMS level - Bypass behaviors and functionality enforced by the geodatabase or ArcGIS clients Need to be aware of what you can and cannot edit - Relationship classes - Geometric networks - Topology Python ArcGIS Geodatabase SQL DBMS

Demo Accessing a geodatabase through SQL Resolving - Coded Value Domains - Feature Dataset Relationships - Domain References

What is a spatial type? A spatial type (ST) is a type that stores geometry data in a single spatial attribute - Geometry type, coordinates, dimension, spatial reference Spatial Index - Access path for quick retrieval Relational and geometry operators and Functions - Constructors - Accessor - Relational - Geometry

What are the benefits of a spatial type? Efficiency - Spatial data and methods are stored in the database - Applications access native dbms type Accessed using common API s and SQL - C, C++, C#, Java, OLEDB - Adheres to standards for SQL access

What are the benefits of a spatial type? Using SQL with a spatial type you can - Create tables with a spatial attribute - Read and analyze the spatial data - Insert, update, and delete simple geometry data Spatial Type SQL

Accessing geodatabase through SQL Can use SQL to create, insert and update tables - Need to register the table with the geodatabase to participate in geodatabase functionality CREATE TABLE hazardous_sites (oid INTEGER NOT NULL, site_id INTEGER, name VARCHAR(40), location sde.st_geometry) Cannot modify schema of registered tables (i.e add a field) or create geodatabase items (i.e domains) through SQL

Accessing Geodatabase through SQL Editing feature classes with SQL and spatial type - Simple features (Points, lines, polygons) - Without geodatabase behavior - Use the Is_Simple function to determine whether your data can be updated Editing tables/feature classes - Use SQL SELECT statements - Directly editing the database tables (no delta tables) - Non-versioned editing in ArcGIS terminology Editing versioned tables/feature classes - Requires versioned views

Editing tables/feature classes Use SQL to update, insert and delete data from tables that are not versioned Can leverage DBMS functionality - Unique indexes, constraints, referential integrity, default values, triggers Requires a unique identifier (ObjectID) when inserting - Used to uniquely identify rows in tables in a geodatabase - Obtained from classes sequence or procedure - Object ID is used by ArcGIS to do such things as display selection sets and perform identify operations on features

Editing versioned tables/feature classes Changes tracked on delta tables (Adds and Deletes tables) Support concurrent editing with long transactions (hours/days) Undo/redo editing experience No locking or data extraction required

Editing versioned tables and feature classes Use versioned views - Created when data registered as versioned with ArcGIS 10.1 and later - Conditions where no view is present; use the Enable SQL Access command. Must use several stored procedures/commands installed with the geodatabase - Create a new version (create_version) - Set which version to access (set_current_version) - Perform edits within the new version (edit_version ) Unlike non-versioned editing, ObjectID values for new records are automatically generated - Changes are made to the delta tables - Versions must be reconciled through ArcGIS

Demo Accessing a geodatabase through SQL Editing - Versioned and Non Versioned Classes - Working with Views

What s new in ArcGIS 10.3? Nine tools added to the Geodatabase Administration toolset for enterprise geodatabase management - Replace functionality previously performed using ArcSDE administration command line utilities. Configure Geodatabase Log File Tables Create Raster Type Delete Schema Geodatabase Diagnose Version Metadata Diagnose Version Tables Export Geodatabase Configuration Keyword Import Geodatabase Configuration Keyword Repair Version Metadata Repair Version Tables

Summary GDB is open to SQL Devs Through SQL use XML field in the GDB_Items table Can also edit data through SQL