Advanced Mapping Techniques

37
All rights reserved. © 2009 Tableau Software Inc. All rights reserved. © 2009 Tableau Software Inc. All rights reserved. © 2009 Tableau Software Inc. Advanced Mapping Techniques Austin Dahl, Dirk Karis, Robert Morton Tableau Software

Transcript of Advanced Mapping Techniques

Page 1: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Advanced Mapping Techniques

Austin Dahl, Dirk Karis, Robert MortonTableau Software

Page 2: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Agenda

•Big Picture•Review of 4.0 Features•Custom Geocoding

Geographic Hierarchies

Creating new role: Regions

Augmenting an existing role: UK Postal Codes

Adding a new hierarchy: FIPS Codes•WMS – Web Mapping Service•Leveraging Geospatial Capabilities of Databases

Page 3: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Mapping ServiceMapping ServiceGeocodingGeocoding

Big Picture

Page 4: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Mapping ServiceMapping ServiceGeocodingGeocoding

Big Picture, Example

Page 5: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Mapping ServiceMapping ServiceGeocodingGeocoding

+ Data

Page 6: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

DemoBasics

Page 7: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Review of 4.0 FeaturesBasic Mapping and Challenges

•Creation

Double click on any geocoded field to get a map

Use Show Me•Resolving Ambiguity•LOD Best Practices

Put full hierarchy on LOD

e.g. Country, State, Zip•2008 Conference talk by Austin Dahl has lots more

http://conference.tableausoftware.com/2008/sessions/training

Page 8: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Agenda

•Big Picture•Review of 4.0 Features•Custom Geocoding

Geographic Hierarchies

Creating new role: Regions

Augmenting an existing role: UK Postal Codes

Adding a new hierarchy: FIPS Codes•WMS – Web Mapping Service•Leveraging Geospatial Capabilities of Databases

Page 9: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Mapping ServiceMapping ServiceGeocodingGeocoding

Custom Geocoding

Page 10: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Geographic Hierarchies

Page 11: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Built In Geocoding

Existing HierarchiesCountry (Name, FIPS 10, ISO 3166-2, ISO 3166)

CMSA Area Code State (Name Abbreviation)

County Zip Code

Page 12: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.

Hierarchy Examples

C:\Program Files\Tableau\Tableau 5.0\Local\data\ZipCode.tds

Country State Zip Code

C:\Program Files\Tableau\Tableau 5.0\Local\data\AreaCode.tds

Country Area Code

Page 13: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Custom Geocoding

•What you can do

Add new hierarchies

e.g. Sales Regions, Airports, Store Locations

Add new sub-levels to existing hierarchies

e.g. Cities

Add new locations to an existing level

e.g. UK Postal Codes•What you cannot do

Put existing levels under your new levels

Add additional alternate names to existing levels

Change the location for an existing entry•But, you can duplicate existing levels and do all of the above

Page 14: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

What You Need

•CSV File with:

• Unique ID (no duplicates)

• Optional: IDs of containing levels (a.k.a. foreign key)

• Latitude

• Longitude

•Optional: Schema.ini file

• IDs should be Text

• Even numeric fields like zip code

• Latitude and Longitude should be Double

See http://msdn.microsoft.com/en-us/library/ms709353(VS.85).aspx for details on Schema.ini

Page 15: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Simple GeocodingLittle League World Series

Page 16: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

LLWSRegion Encoding CSV File

Page 17: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Two Locations

SELECT [LLWS#csv].[Runner-Up Region] AS [Runner-Up Region],

[LLWS#csv].[Runner-Up Score] AS [Runner-Up Score],

[LLWS#csv].[Winner Region] AS [Winner Region],

[LLWS#csv].[Winner Score] AS [Winner Score],

[LLWS#csv].[Year] AS [Year]

FROM [LLWS#csv]

Page 18: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Two Locations

SELECT [LLWS#csv].[Runner-Up Region] AS [Region],

[LLWS#csv].[Runner-Up Score] AS [Score],

[LLWS#csv].[Year] AS [Year],

'Runner-Up' AS [Winner - Runner-Up]

FROM [LLWS#csv]

UNION

SELECT

[LLWS#csv].[Winner Region] AS [Region],

[LLWS#csv].[Winner Score] AS [Score],

[LLWS#csv].[Year] AS [Year],

'Winner' AS [Winner - Runner-Up]

FROM [LLWS#csv]

Page 19: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Augmenting the Built In GeocodingUK Postal Codes

Page 20: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

UK Postal CodesClean Up

Page 21: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

UK Postal CodesSchema.ini

Page 22: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Adding Geocoding HierarchiesFIPS Codes

Desired Hierarchy

Country (Name, FIPS 10) FIPS State (Abbreviation, 2 Digits)

FIPS County (3 Digits, 5 Digits)

Page 23: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.

Adding Geocoding HierarchiesFIPS Geocoding Files

FIPS CountyFIPS State

Page 24: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Adding Geocoding HierarchiesFIPS Schema.ini

Page 25: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Custom Geocoding Best Practices

•Clean the data

Remove blank or duplicate rows

Check the data types

Format for leading zeros if needed•Use Schema.ini to enforce types and column names•Store in a common directory

Use subfolders for different locations or roles

Keep your CSV files•Order the fields with the most readable name first•Use Tableau to connect to it as a sanity check

Page 26: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Sharing Your Custom Geocoding

•One-off:

Save to TWBX and send

Import from TWBX•Group Wide

One person imports everything

Distribute My Tableau Repository\Local Data

(Advanced) It is possible to have TDS files in Local Data reference in-house databases

•On Tableau Server

Publish and custom geocoding will get sent if needed.

Page 27: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Agenda

•Big Picture•Review of 4.0 Features•Custom Geocoding

Geographic Hierarchies

Creating new role: Regions

Augmenting an existing role: UK Postal Codes

Adding a new hierarchy: FIPS Codes•WMS – Web Mapping Service•Leveraging Geospatial Capabilities of Databases

Page 28: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

GeocodingGeocoding Mapping ServiceMapping Service

WMS

Page 29: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

WMS Basics

1

2

3

Page 30: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

WMS Examples

http://wms.jpl.nasa.gov/wms.cgi?

Page 31: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

WMS Examples

http://apps1.gdr.nrcan.gc.ca/cgi-bin/worldmin_en-ca_ows

Page 32: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

WMS Examples

http://wms1.ccgis.de/cgi-bin/mapserv?map=/data/umn/germany/germany.map&&

Page 33: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Agenda

•Big Picture•Review of 4.0 Features•Custom Geocoding

Geographic Hierarchies

Creating new role: Regions

Augmenting an existing role: UK Postal Codes

Adding a new hierarchy: FIPS Codes•WMS – Web Mapping Service•Leveraging Geospatial Capabilities of Databases

Page 34: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Tapping Into Geospatial Databases

• Contains• Intersection• Distance

Page 35: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Summary

•Custom Geocoding

Add your locations, augment Tableau locations•WMS

In house via ArcGIS and others; numerous public servers

Different layers than the Tableau built-in•Geospatial Databases

Calculations of Distance, Intersection, Containment

Geographic Types

Page 36: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Questions

?

•Austin Dahl [email protected]•Dirk Karis [email protected]•Robert Morton [email protected]

Page 37: Advanced Mapping Techniques

All rights reserved. © 2009 Tableau Software Inc.All rights reserved. © 2009 Tableau Software Inc.

Resources

•Geospatial Data Sets

National Atlas - http://www.nationalatlas.gov/atlasftp.html

NOAA - http://csc-s-maps-q.csc.noaa.gov/hurricanes/download.jsp

•Upload Shapefiles to SQL Server 2008

Shape2SQL - http://www.sharpgis.net/page/SQL-Server-2008-Spatial-Tools.aspx

•Edit and Manipulate Shapefiles

OpenJUMP - http://www.openjump.org/