Ws sde tab_relslides

24
CPPresenter: Keldah Hedstrom ESRI Redlands, California Understanding ArcSDE Table Relationships Understanding ArcSDE Table Relationships

Transcript of Ws sde tab_relslides

The presentation will begin at 3PM Pacific Time

Crossword PuzzleClue

Presenter: Keldah Hedstrom ESRI Redlands, California

Understanding ArcSDE Table Relationships

Understanding ArcSDE Table Relationships

Copyright © 2002 ESRI. All rights reserved.

Seminar OverviewTopics

Overview of table relationships in ArcGISChoosing a join type Optimizing table relationships

FormatSlide shows followed by software demonstrationsEach topic followed by brief review and question and answer period

Copyright © 2002 ESRI. All rights reserved.

Table relationships

Can be established across multiple data formats, or within one specific formatTemporary or permanent

Associations linking tables together throughcommon columns

Copyright © 2002 ESRI. All rights reserved.

Relationship types in ArcGISArcMap

JoinsRelatesRelationship classes

ArcIMS<QUERY> tag<SPATIALQUERY> tag

ArcSDESpatial and non-spatial views

Copyright © 2002 ESRI. All rights reserved.

Joining tablesColumns appended together virtually, but source files remain separate

Temporary association created in ArcMap

Applied to multiple data formats

Copyright © 2002 ESRI. All rights reserved.

Tables not appended together

Tables viewed separately

Relating tables

Manually update selectionsTemporary association created in ArcMapApplied to multiple data formats

Copyright © 2002 ESRI. All rights reserved.

Relationship classes

Accessible to only one geodatabaseUser controls relationship rulesMainly used for editing

Behave similar to ArcMap relatesPermanent associations created in ArcCatalog

Copyright © 2002 ESRI. All rights reserved.

Joining and selecting dataSQL: Structured Query Language

Used to query multiple database tables to retrieve dataCan be used to select features or table records in any data format supported by ArcGIS

SELECT wilson.coffee.NAME, wilson.coffee.Coffee_ID, wilson.coffee.Own_ID, wilson.owner.Own_ID, wilson.owner.OWNER_NAMEFROM wilson.coffee, wilson.ownerWHERE wilson.coffee.Own_ID = wilson.owner.Own_ID

SELECT, FROM, and WHERE clauses

Copyright © 2002 ESRI. All rights reserved.

ArcIMS joins

<SPATIALQUERY where=”DB.CITY.FIPS = DB.SCHOOLS.FIPS”jointables=”DB.SCHOOLS” />

<QUERY where=”FOO.PARCELS.ZONE_CODE = FOO.ZONING.ZONE_CODE” jointables=”FOO.ZONING” />

Created using ArcXMLUse <SPATIALQUERY> or <QUERY> tags

Used with SQL WHERE statement attributeUsed with jointables attribute

Across only one data formatShapefile DBF to DBF tableArcSDE feature class to ArcSDE table

Copyright © 2002 ESRI. All rights reserved.

ArcSDE views

Read-onlyMust be created on non-versioned tables

Associate multiple ArcSDE tables Permanent SQL query stored in database

View including spatial column behaves like feature classCan change query to get different data

sdetable -o create_view -T road_view –troad_geometry,road_info -c shape,name -w”road_geometry.road_id = road_info.road_id”-D wilson -u myusername -p mypassword

Syntax to create a spatial view

Copyright © 2002 ESRI. All rights reserved.

Software Demonstration

Copyright © 2002 ESRI. All rights reserved.

Topic Review and Q & ATypes of table relationships in ArcGIS

JoinsRelatesRelationship classesSQL statementsArcIMS joinsArcSDE views

Copyright © 2002 ESRI. All rights reserved.

Inner join

ArcMap: “Keep only matching records”

SELECT *FROM parcelsINNER JOIN zoningON parcels.zone_code = zoning.zone_code

SQL join syntax

PARCELSZone_Code

RES2RES2RES1RES1RES2RES1RES2COM

ZONINGZone_Code

RES1RES2

INNER JOINZone_Code

RES2RES2RES1RES1RES2RES1RES2

PARCELS + ZONING =

ArcSDE view default type of join

Copyright © 2002 ESRI. All rights reserved.

Outer join

Left Outer join supported by ArcMap, and is default join

ArcMap join: “Keep allrecords (default)”

ArcSDE views support:Left Outer joinRight Outer joinFull Outer join

SELECT *FROM parcelsLEFT OUTER JOIN zoningON parcels.zone_code =

zoning.zone_code

SQL join syntax

Copyright © 2002 ESRI. All rights reserved.

Inner and Outer joins

Inner Join 2 23 3

Left Outer Join 12 23 3

Right Outer Join 2 23 3

4

Full Outer Join 12 23 3

4

Source DataTable 1 Table 2

12 23 3

4

ArcMap joinsArcSDE views

Copyright © 2002 ESRI. All rights reserved.

CardinalityDetermines how many features in a feature class are related to how many records in an attribute table

One-to-Many Many-to-ManyMany-to-OneOne-to-One

One parcelhas one owner

Many parcelshave many owners

Many parcelshave one owner

One parcelhas many owners

Must follow rules for connecting tables together

Copyright © 2002 ESRI. All rights reserved.

Supported ArcGIS cardinalityDifferent types of relationships have different cardinality choices

Join Relate RelationshipClass

ArcSDE View ArcXML

1 to 1 x x x x x1 to M x x x * x *

M to 1 x x x x

M to M x x x * x *Car

dina

lity

Type of Relationship

* Not supported in ArcMap

Copyright © 2002 ESRI. All rights reserved.

Software Demonstration

Copyright © 2002 ESRI. All rights reserved.

Topic Review and Q & ADifferent options available for joining with ArcMap and ArcSDE Join types

Inner joinOuter join: Left, Right, and Full

CardinalityOne-to-one, one-to-many, many-to-one, many-to-many

Copyright © 2002 ESRI. All rights reserved.

Joins processed by ClientTypes

ArcMap join with “Keep all records” optionArcMap join across connectionsArcMap relateGeodatabase relationship class

ClientClient

RDBMS

ArcSDE

BenefitsEnables advanced functionality

Joins across database connections

DrawbacksPotentially slow

Copyright © 2002 ESRI. All rights reserved.

Joins processed by ServerTypes

ArcMap join with:“Keep only matching records” optionSame database connection

ArcIMS <QUERY> and <SPATIALQUERY>ArcSDE view

AND

Client

RDBMSRDBMS

ArcSDE

BenefitsBest performance

Use DBMS join algorithmsServer hardware typically faster

DrawbacksMay require advanced knowledgeor additional DBMS privileges

Copyright © 2002 ESRI. All rights reserved.

Use indexesQuickly search attribute or spatial data Create with:

ArcCatalogArcSDE

sdetable –o create_index

DBMS tools Recommendations for creating indexes

Always index join columnsIndex join columns on both tables

Copyright © 2002 ESRI. All rights reserved.

Create DBMS statisticsEnable DBMS to choose best execution plan

Stores number of rowsStores number of unique values

Create with:ArcCatalog

Right-click and choose AnalyzeArcSDE

sdetable -o update_dbms_statistics

DBMS Varies depending on DBMS

Update when data changes significantlyLoading dataCompressing a versioned database

Copyright © 2002 ESRI. All rights reserved.

Topic Review and Q & AOptimize table relationships by:

Joining on client vs. server Using indexesCreating DBMS statistics