GEOGRAPHY DATATYPES in SQL Server by jared nielsen linkedin.com/nielsendata.

Slides:



Advertisements
Similar presentations
Week 1: Introduction to GIS
Advertisements

What are Geographical Information Systems (GIS) & ArcView GIS software? What is a Geographical Information System (GIS)? Introduction to ESRI ArcView 3.x.
Importing GPS Data Lecture 13. EasyGPS  Free software for downloading waypoints  EasyGPS ( EasyGPS  Free software for downloading.
Creating a County ArcMap with Fiscal Year Conservation Practice Locations David Hoover ASTC, Idaho 2007 DC Meeting.
TileMill Quickly and Easily Design Maps for the Web Shaky Sherpa Matt Berg Modi Research Group The Earth Institute. Columbia University.
Module 19 Working with SQL Server® 2008 R2 Spatial Data.
ESRM 250 & CFR 520: Introduction to GIS © Phil Hurvitz, KEEP THIS TEXT BOX this slide includes some ESRI fonts. when you save this presentation,
GIS Level 2 MIT GIS Services
GIS Matthew Rosencrans Tom DiLiberto. Outline What is GIS? What can we do with it? What data can we work with?
IS 466 ADVANCED TOPICS IN INFORMATION SYSTEMS LECTURER : NOUF ALMUJALLY 20 – 11 – 2011 College Of Computer Science and Information, Information Systems.
Hope Foley Perpetual Technologies SQL Saturday #51 - Nashville.
Your Data Any Place, Any Time Delivering Location Intelligence with Spatial Data.
Unit One: GIS Concepts In this unit… ► What is GIS? ► Types of GIS data ► What can you do with GIS? ► ArcGIS 9 license levels ► Basics of the ArcGIS 9.
Lecture 3 How does GIS work. How does GIS work? Maps are stored in computers Databases and Tables Geometry Attributes.
Geog 458: Map Sources and Error January 18, 2006 Georeferencing.
Lecture 16: Data input 1: Digitizing and Geocoding By Austin Troy University of Vermont Using GIS-- Introduction to GIS.
GIS Brownbag Series Part 3: Georeferencing and Projections Or… Why does my data not line up?
Basic Concepts of GIS January 29, What is GIS? “A powerful set of tools for collecting, storing, retrieving, transforming and displaying spatial.
Intro. To GIS Lecture 6 Spatial Analysis April 8th, 2013
ESRM 250 & CFR 520: Introduction to GIS © Phil Hurvitz, KEEP THIS TEXT BOX this slide includes some ESRI fonts. when you save this presentation,
Geography 121 Project Two: Locating Geographic Coordinates using GPS Jeffrey Hayden Kristen Muscat Jamie Pfitzenmeyer William Steudler.
Rebecca Boger Earth and Environmental Sciences Brooklyn College.
Introduction to ArcGIS for Environmental Scientists Module 2 – GIS Fundamentals Lecture 5 – Coordinate Systems and Map Projections.
Add a File with X, Y coordinates to MapWindow
Latitude / Longitude Lat/lon practice map. The Equator and Parallels of Latitude.
Background in geospatial data modeling Presenter: Manolis Koubarakis Extended Semantic Web Conference 2012.
Lecture 4 Understanding Coordinate Systems. Geographic Coordinate systems GCS Spherical Ellipsoidal Curved.
Overview Dennis L. Johnson What is GIS? Geographic Information System Geographic implies of or pertaining to the surface of the earth Information implies.
CE 525. Grading GIS Proficiency Exam 10% Attendance 10% 90–100 = A Pop Quiz Questions 10% 80 – 89 = B Homework/Certifications 20% 70 – 79 = C Midterm.
Taking Microsoft SQL Server into the World of Spatial Data Management Milan Stojic, Michael Rys Program Managers
Geography 370 Locating Positions on the Earth
1 Chapter 2 – Coordinate Systems Week 1.
Major parts of ArcGIS ArcView -Basic mapping, editing and Analysis tools ArcEditor -all of ArcView plus Adds ability to deal with topological and network.
Creating High Performance Spatial Databases with SQL Server 2008 Alastair Aitchison.
GIS concepts, skills and tools
The IRI Climate Data Library: translating between data cultures Benno Blumenthal International Research Institute for Climate Prediction Columbia University.
Using New Data Types in 2008 Andrew Couch UK Access User Group ASC associates
Exploring ArcToolbox Presented by: Isaac Johnson.
SQL access and working with ST_Geometry Functions
National Weather Service Goes Digital With Internet Mapping Ken Waters National Weather Service, Honolulu HI Jack Settelmaier National Weather Service,
Geo-processing tools Tools: Buffer Geo-processing tools allow you to work with your data bases on spatial relations.... at a specified distance... with.
John Pickford IBM H11 Wednesday, October 4, :30. – 14:30. Platform: Informix Practical Applications of IDS Extensibility (Part 2 of 2)
LBR & WS LAB 1: INTRODUCTION TO GIS.
A Quick Introduction to GIS
Unit Nine: Georeferenced Data In this unit… ► Data Supported by ArcGIS ► Geodesy  Datum  Coordinate Systems  Projections ► ArcGIS and Projections ►
Guofeng Cao CyberInfrastructure and Geospatial Information Laboratory Department of Geography National Center for Supercomputing Applications (NCSA) University.
INTRO TO SPATIAL DATA ANALYSIS JOU-1526 Computer Assisted Reporting.
Data Interoperability at the IRI: translating between data cultures Benno Blumenthal International Research Institute for Climate Prediction Columbia University.
Project IIa GPS Jeff Houston Jeff Filson Tim Culbreth Jennifer Martin.
Intro. To GIS Pre-Lab Spatial Analysis April 1 st, 2013.
GPS Road Assessments Using GPS to Map and Assess the Transportation Infrastructure.
Large Datasets and Path Mapping in Tableau A V Flinsch Information Visualization Fall 2015.
Geocoding and Georeferencing Scott Bell GIS Institute.
Get Familiar with Spatial Data. Slava Murygin – SQL SlavaSQL.BlogSpot.com.
Geocoding Chapter 16 GISV431 &GEN405 Dr W Britz. Georeferencing, Transformations and Geocoding Georeferencing is the aligning of geographic data to a.
Geocoding Chapter 16 GISV431 &GEN405 Dr W Britz. Georeferencing, Transformations and Geocoding Georeferencing is the aligning of geographic data to a.
Introduction to GIS Programming Final Project Submitted by Todd Lenkin Geography 375 Spring of 2011 American River College.
Geocoding and Georeferencing
Get Familiar with Spatial Data
A Look at Creating & Updating Point Files
Fun with SQL Server Spatial Data
Introduction to Coordinate Systems and Projections
Understanding & Using Spatial Data Features in SQL Server
Spatial Data Types And Indexing SQL Server 2008
Preliminaries: -- vector, raster, shapefiles, feature classes.
Fun with SQL Server Spatial Data
Geography 413/613 Lecturer: John Masich
LA GIS Council Presentation January 20, 2005
Presentation transcript:

GEOGRAPHY DATATYPES in SQL Server by jared nielsen linkedin.com/nielsendata

GEOGRAPHY vs GEOMETRY Geography Plots ellipsoidal “Round Earth” data using latitude, longitude and altitude* coordinates Geometry Plots polygonal, geometric and linear data using X, Y and Z* coordinates * not implemented well

Measuring the Earth Coordinates Longitude = X Latitude = Y Altitude = Z

Measuring the Earth Ranges Longitude = 0 to 360° Latitude = 90° to -90° Altitude = 0 to ∞ (ft)

World Geodetic System Global standards body that defines the coordinate systems for Earth The latest revision is WGS 84 - referred to as EPSG:

EPSG: 4326 This geodetic standard is specified in many geography datatype queries: UPDATE SQLDevelopers SET GeoPosition = geography:: Point( , , 4326 )

BASIC GIS CONCEPTS Well Known Text ESRI Shape and Data Sources

Well Known Text - WKT TypeExampleConvert to Spatial PointPoint(x,y).STPointFromText() MultiPointMultiPoint( (x,y), (x,y) ).STMPointFromText() LineStringLineString( x y, x y, x y).STLineFromText() MultiLineStringMultiLineString( (x y, x y) (x y, x y) ).STMLineFromText() Polygon Polygon ( ( x1 y1, x2 y2, x3 y3, x1 y1 ) ).STPolyFromText() MultiPolygonYou get the idea… Keep using those parenthesis….STMPolyFromText()

How LONG is your LAT? Sometimes you should use LON/LAT (WKT) Other times you need to use LAT/LON (SQL) LAT LON San Jacinto College = , SET GeoPosition = geography:: STGeomFromText('POINT( )', 4326) SET GeoPosition = geography:: Point(29.578, , 4326)

Get Some Data Positions for the International Space Station: Global Country Maps: Zip Codes, School Districts, Demographics: Railroads, Rivers, Cities, Volcanoes:

ESRI Shapefile Converters Convert ESRI Shapefiles to SQL Geography: Queries SQL Geography to a Map: ESRI Metadata Translation: /gp_toolref/conversion_tools/esri_metadata_translator _conversion_.htm

SQL SERVER SPATIAL Make a Table Load Data Query Spatial-ly

Making a Table CREATE TABLE dbo.ISSPosition( Longitude decimal(18, 15) NULL, Latitude decimal(18, 15) NULL, Sampled datetime NULL, LocalTime nvarchar(50) NULL, GeoPosition geography NULL, GeomShape geometry NULL )

Loading Data INSERT INTO ISSPosition (Sampled, Longitude, Latitude, LocalTime) VALUES ('01/01/ :00:00',-125.4,41,'15:38:18’) Naturally I loaded more data … one data point per minute from January 1 to present It turns out that the Space Station falls fast at 17,136 mph

Convert to Geography UPDATE ISSPosition SET GeoPosition = geography:: Point([Latitude], [Longitude], 4326) GO (note we are using the native SQL Point method so we keep LAT/LON)

Query our Data select top 180 * from dbo.ISSPosition Not the most thrilling outcome… Let’s try the Spatial Results Tab…

Spatial Results Tab select top 180 * from dbo.ISSPosition Still not that exciting… a bunch of dots

Space Station Orbit select top 180 * from dbo.ISSPosition order by Sampled Now we are getting somewhere!

Comma Delimited Points nvarchar(max) = STUFF((SELECT TOP 180 ',' + Convert(nvarchar(25),Longitude) + ' ' + Convert(nvarchar(25),Latitude) FROM dbo.ISSPosition ORDER BY Sampled FOR XML PATH('')),1,1,'')

Convert Points to LineStrings geography = geography::STLineFromText('LINESTRING('

Space Station Orbit Now you have connected points in a linestring showing the orbit…

Space Station Orbit CREATE TABLE CoolShapes( Name Nvarchar(100) NOT NULL, GeoShape geography NULL) GO INSERT into CoolShapes (Name, GeoShape) values (‘ISS Orbital I like this shape so much I’m going to keep a copy of it

World Geography Global Datasets From ESRI Shapefiles

Load Global Maps

union all select GeoMap from dbo.world With a UNION, we simply plot the orbit on the Global ESRI Shapefile Map

GEOGRAPHY Case Studies INTERSECTION BUFFERS

Spatial Methods TypeExampleSyntax

STIntersection Method UNION ALL SELECT GeoMap FROM World WHERE Name='China' A human knows that the orbit crosses China, but how do we tell the computers?

STIntersection Method SELECT We know it intersects… but WHERE?

STIntersection Method SELECT Can you see them?

STIntersection Method SELECT UNION ALL Let’s add a few.STBuffer(s)

MAKING IT LOCAL San Jacinto College

Make Some Developers insert into SQLDevelopers (Name, Latitude, Longitude, Altitude) values ('Jared Nielsen Dark Matter', , , 15) insert into SQLDevelopers (Name, Latitude, Longitude, Altitude) values ('Jared Nielsen', , , 15) insert into SQLDevelopers (Name, Latitude, Longitude, Altitude) values ('Nancy Hidy Wilson', , , 14) insert into SQLDevelopers (Name, Latitude, Longitude, Altitude) values ('Robert Gremillion', , ,16) UPDATE SQLDevelopers SET GeoPosition = geography::Point([Latitude], [Longitude], 4326) GO

San Jacinto College is Cool ALTER TABLE CoolShapes ADD GeoPosition geography NULL GO INSERT INTO CoolShapes (Name, GeoPosition) VALUES ('San Jacinto College', geography::Point( , , 4326))

STIntersection Method One Developer is Not Attending SELECT GeoPosition.STBuffer(100) FROM CoolShapes WHERE Name='San Jacinto College' UNION ALL SELECT GeoPosition.STBuffer(30) FROM SQLDevelopers

STIntersection Method Who else is here? SELECT GeoPosition.STBuffer(100) FROM CoolShapes WHERE Name='San Jacinto College' UNION ALL SELECT GeoPosition.STBuffer(30) FROM SQLDevelopers WHERE NAME NOT IN ('Robert Gremillion')

More Methods geography geography geography Geography geography = GeoPosition.STBuffer(5) FROM SQLDevelopers WHERE Name = 'Jared Nielsen' = Geoposition.STBuffer(5) from SQLDevelopers WHERE Name='Robert Gremillion' = Geoposition.STBuffer(5) from SQLDevelopers wHERE Name LIKE 'Nancy%' = Geoposition.STBuffer(100) from CoolShapes WHERE Name = 'San Jacinto College' = Geoposition.STBuffer(2) from SQLDevelopers WHERE Name = 'Jared Nielsen Dark Matter’

More Methods Do I stink? SELECT = Boolean True SELECT = Boolean False SELECT = meters geography

More Methods Boolean = 1

JARED NIELSEN Serial Entrepreneur Investor Software Architect Questions?