Download 2015 WinGap Conference

Document related concepts

Relational algebra wikipedia , lookup

Ingres (database) wikipedia , lookup

Database wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Versant Object Database wikipedia , lookup

Join (SQL) wikipedia , lookup

Clusterpoint wikipedia , lookup

PL/SQL wikipedia , lookup

SQL wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

Transcript
2015 WinGap
Conference
WinGapSQL and GIS
Mark Lovett & Rusty Scoven

Managing GIS data using database connections

ArcMap for Desktop Basic License

SSMS (Sequel Server Management Studio)

ArcMap Query Layer

Stand alone table created from a connected database

Provides for live updates from the database directly to the map project

Must have a database connection in order to be created

Utilizes SQL syntax in order to create the stand alone table

Works much like a SQL view query

Only exists within the map project it was created in

Are read only

Editable when accessed via certain types of services/licenses

From the catalogue tree create a database connection

Double click Add Database Connection

Database Connection window will appear and be blank

Must add the SQL Instance and the Authentication Type

The Instance can be found within SSMS (see next slide)

The Authentication Type for Windows Authentication will be Operating system
authentication

Those users that use password protected authentication will select Database
Authentication and enter the user name and password

SQL Instance name as seen from SSMS

Back to the Database Connection window

The Database can either be keyed or as a test to see if you entered the
correct Instance and Authentication Type, you can click the drop down arrow
and select the database you wish to query from.

The Query Layer will only pull from that database

Once the database connection is established it will display in the Catalogue
tree

You can rename it by right clicking on it if you prefer or take the default

It will default to being disconnected (appear with a red x beside it)

To connect it double click the connection you created (red x will disappear
and a + will appear to the left

Once connected you will be able to
see all of the WinGap dbo tables
within the database

These dbo tables cannot and should
not be renamed, deleted, copied,
cut, changed or manipulated in any
shape form or fashion

Any manipulation of these tables
could result in WinGap SQL
malfunctioning

If you are an individual that is click
happy DO NOT click the + symbol

To create the Query Layer Go to:

File>>>>>Add Data>>>>>Add Query Layer

The New Query Layer window opens

Select your database connection by clicking the drop down arrow

A list of all the dbo tables within the database will appear

First give the query layer a name on the Name line

As for the query, a couple of ways to skin this cat

You can build the query by navigating through the list of dbo tables, selecting
the table and then selecting the field names from the columns box

OR you can use SSMS to build your query and copy and paste

After you have built your query you can click Validate to ensure it is correct
and then click Finish

After you click finish the new Query Layer table will appear in the Table of
Contents window

To view the table, right click on the table, and select Open

The attribute table will display showing the columns you
selected in the query

The table will update as changes are made in WinGap SQL

Example is Realkey 2, lets remove the Homestead Code in
WinGap SQL

Once the change is made in WinGap SQL you must refresh the
data so that it can update in ArcMap

Refreshing the data can be done in two ways, closing the table
and reopening it OR by selecting Reload Cache from the table
while it is open

After performing either option to refresh the table will update

The Query Layer can be edited or changed to fit the user’s
needs

To edit the Query Layer, right click on the table, select
properties

From the Source tab select Change Query

The Edit Query Layer will open

You can now add or subtract from the original query

The Query Layer also allows for pulling data from multiple
tables using SQL join commands

For these types of queries I prefer SSMS but you can use the
query window within ArcMap as well

Major benefit in using Query Layer is on the fly updates from
WinGAP SQL

Another PLUS is not having to maintain a bunch of fields
within shapefile or geodatabase

The Query Layer can be joined to spatial layers and as
updates are made in WinGap SQL they will be reflected in the
map

Attribute table from parcel data

To perform the join, right click on the shapefile, select Joins
and Relates, the select Join

Join Data window appears

Select the primary key to join the data on, click OK

Message below may appear

Select Perform Join Now Without Index

Join occurs

Open attribute table to review the joined data

For the update example lets look at Realkey 5723

Acreage discrepancy requires an update

Refresh the attribute table using the same method

Table updates

Can be used with symbology and thematic mapping updates

To use symbology, right click on the layer you want to symbolize, then click
properties

The Layer Properties window will appear

Click on the Symbology tab, select categories, then select the field you wish
to symbolize on followed by add all values

The example I am using is the Taxdistrict field from WinGapSQL

The example shows a parcel that appears to be in the wrong Tax District

Click the refresh button from the map to see the update.
Using a SQL View with ARCGIS

SQL Views

Creating SQL Views

Joining SQL views with ARCGIS
Query from SSMS: Lets say you have a
complex query, and you would like to
use those results with your parcel
data
This a query that compares
data from two different data
years
 CREATING A
VIEW IN SIMPLE FORM

CREATE VIEW view_name AS

SELECT column_name(s)

FROM table_name

WHERE condition
CREATING A VIEW FROM THE
SSMS QUERY
CREATE VIEW view_name AS
SELECT column_name(s)
FROM table_name
WHERE condition
Where does my VIEW live?
Adding the VIEW to ARCGIS
Joining the View to the
Parcel Layer
Now Lets Display the
Queried Parcels
Visual display of our data may
indicate incorrect Neighborhood
changes
Example: You want to determine if parcels
are more valuable within a one mile radius
of a school
In our example you have joined a
Query Layer or a View to your
Parcel Layer
Select by Location from PARCELS that are
within a distance of 5,280 feet (1 mile)
from SCHOOLS
Now you have your selection, lets
move it to a usable report
What if you have a spreadsheet of
information that you would like to
Map and Analyze with your Parcel
Data?
Example: You have been given a list of
parcels that should have been combined.
You want to determine if these combinations
have been completed.
First you will add your Excel
data to ARCGIS
Next step: Joining to our
Parcel Layer
Now that you have joined the
combination list to the parcel data
you can select parcels by attributes
from the Excel data.
Using SELECT BY ATTRIBUTES
You can select any parcel
that was supposed to be
Deleted as a result of a
combination by selecting
any parcel that has a
Realkey from the Deleted
Parcel
WinGAPSQL + ARCGIS
= Time Saving Analysis