SlideShare una empresa de Scribd logo
1 de 20
Fun with SQL Server
Spatial Data
Mindy Curnutt
VP, Information Management
TMW Systems, Inc.
8/25/2016
About Me
VP, Information Management, TMW
SQL Server MVP
SQL Server since 6.5 / 1995 (20 Years)
SQLPASS Speaker, 2005, 2012-2015
PASS Program Manager 2015 & 2016
Twitter: @sqlgirl
Email: mindycurnutt@hotmail.com
• Geography
– Ellipsoidal (Lat, Long, Z, M)
– Define points, lines & areas
with latitude & longitude
Spatial Data Types
• Geometry
– Flat Map (X, Y, Z, M)
– Define points, lines &
areas with coordinates
– Use for localized &
interior spaces
What Can I Represent?
POINT MULTIPOINT
LINESTRING
MULTI-
LINESTRING
POLYGON MULTI-POLYGON
There’s more too!
Complex Polygons & Multi-Polygons, Collection, Curves, Combinations…
What Can I Represent?
• Points
– A GPS Position:
Declare @location geography = geography::Point(@lat, @long,
4326);
– A Region of 20 meters around a Point (Buffer):
Declare @region geography = geography::Point(@lat, @long,
4326).STBuffer(20);
Circular
Arcs
What Can I Represent?
DECLARE @g geography =
'CIRCULARSTRING(
-122.358 47.653,
-122.348 47.649,
-122.348 47.658,
-122.358 47.658,
-122.358 47.653)';
Circular
Arcs
What Can I Represent?
DECLARE @g geometry =
'COMPOUNDCURVE
(
CIRCULARSTRING(1 0, 0 2, 3 1),
(3 1, 1 1),
CIRCULARSTRING(1 1, 3 4, 4 1)
)';
Circular
Arcs
What Can I Represent?
DECLARE @g geometry =
'CURVEPOLYGON
(
CIRCULARSTRING(0 4, 4 0, 8 4, 4 8, 0 4),
CIRCULARSTRING(2 4, 4 2, 6 4, 4 6, 2 4)
)';
SELECT @g.STArea() AS Area;
What Can I Represent?
• Complex Polygons
• select * from timezone_world
where ID = 86
• select * from timezone_world
where ID in (
• 27,17,7,273,41,204,86,81,149,74,1
26,296,312,44,82,389,124,400,251
,206,104,67,102,41)
Common Spatial Methods in T-
SQL
• STBuffer (return type: Geography)
Draws a buffer of the specified distance around the geography shape. If the shape is a point,
the buffer will draw a circle.
• ShortestLineTo (return type: Geography)
Returns an object that represent the shortest distance between two objects
• STIntersection (return type: Geography)
Returns an object that represents the points where a geography instance intersects
another geography instance.
• STUnion (return type: Geography)
Returns an object that represents the points where a geography instance intersects
another geography instance.
Common Spatial Methods in T-
SQL
• STContains (return type: Boolean)
Specifies whether the calling geography instance spatially contains the geography instance
passed to the method.
• STIntersects (return type: Boolean)
Returns 1 if a geography instance spatially overlaps another geography instance, or 0 if it
does not.
• STDistance (return type: Float)
Returns the shortest distance between a point in a geography instance and a point in
another geography instance. (Float)
• STLength (return type: Float)
Returns in Meters the length of a Line or Curve object
• STArea (return type: Float)
Returns Square Meters of the Area of the resulting
What is that 4326?
• SRID – Spatial Reference ID
– Determines Measurements
– GeoID Dimensions
– All objects must be of the same SRID
– Based on European Petroleum Survey Group
select * from sys.spatial_reference_systems
Examples
• Get all Customers within a distance of X
Select * from Customers c where s.geo.STDistance(@me) < @x
• Get all Customers within a particular City’s Boundary
Select * from Customers c where
c.geo.STIntersects(@ACityBoundary) = 1
• How many miles is a walk in my neighborhood with my dog?
declare @g geography;
SET @g= geography::STGeomFromText('LINESTRING
(-96.777639 32.951932, -96.777639 32.951932, -96.777620 32.952159,
-96.778624 32.952167, -96.779098 32.952243, -96.778716 32.978184)',4326);
select @g;
select @g.STLength() * .000621371 * 2;
Convert Objects to Spatial
Data
• Geocoder Services
– GPS Visualizer – Batch Address Locator
• Give a list of addresses, returns Lat/Long
http://www.gpsvisualizer.com/geocoder/
– ArcGIS
https://developers.arcgis.com/features/geocoding/
– Google Maps
https://google-
developers.appspot.com/maps/documentation/utils/geocoder/
Texas A & M
http://geoservices.tamu.edu/Services/Geocode/
Sources of Free Data
• Shapefiles
– United States Census - https://www.census.gov/
– State and Local Governments – http://geo.data.gov
– http://www.mapcruzin.com/download-free-arcgis-shapefiles.htm
– http://www.naturalearthdata.com/
– http://freegisdata.rtwilson.com/ (huge list of links)
– http://download.geofabrik.de/
– http://nationalmap.gov/small_scale/
– http://tnmap.tn.gov/
– ArcGIS - http://opendata.arcgis.com/
Loading Spatial Data
• Shape2SQL
– http://www.sharpgis.net/page/SQL-Server-2008-Spatial-Tools
SQL Server Art using Spatial
Data
• http://www.purplefrogsystems.com/blog/2011/0
5/sql-server-art-using-spatial-data/
– Convert image to a bitmap
– Convert bitmap to a vector (vectormagic.com)
– Use Excel workbook for formatting
– Paste in SQL
• http://michaeljswart.com/2010/02/more-
images-from-the-spatial-results-tab/
Credits
• Michael Rys, Milan Stojic – TechEd Europe 2012
DBI324
• Michael J Swart Blog
• Alex Whittles – Purple Frog Consultancy Blog
Head over to IDERA.com to
download any of our product
trials free for 14-days.
Free Trials
Questions?
Mindy Curnutt
mindycurnutt@Hotmail.com
Twitter: @SQLGirl

Más contenido relacionado

La actualidad más candente

Dmitriy Kolesov - GIS as an environment for integration and analysis of spati...
Dmitriy Kolesov - GIS as an environment for integration and analysis of spati...Dmitriy Kolesov - GIS as an environment for integration and analysis of spati...
Dmitriy Kolesov - GIS as an environment for integration and analysis of spati...AIST
 
Dijkstra algorithm a dynammic programming approach
Dijkstra algorithm   a dynammic programming approachDijkstra algorithm   a dynammic programming approach
Dijkstra algorithm a dynammic programming approachAkash Sethiya
 
Chris hill rps_postgis_threeoutoffouraintbad_20150505_1
Chris hill rps_postgis_threeoutoffouraintbad_20150505_1Chris hill rps_postgis_threeoutoffouraintbad_20150505_1
Chris hill rps_postgis_threeoutoffouraintbad_20150505_1Chris Hill
 
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)Mohanlal Sukhadia University (MLSU)
 
Networks dijkstra's algorithm- pgsr
Networks  dijkstra's algorithm- pgsrNetworks  dijkstra's algorithm- pgsr
Networks dijkstra's algorithm- pgsrLinawati Adiman
 
Discrete Mathematics Presentation
Discrete Mathematics PresentationDiscrete Mathematics Presentation
Discrete Mathematics PresentationSalman Elahi
 
Raster data analysis
Raster data analysisRaster data analysis
Raster data analysisAbdul Raziq
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithmSrikrishnan Suresh
 
Spatial analysis and Analysis Tools ( GIS )
Spatial analysis and Analysis Tools ( GIS )Spatial analysis and Analysis Tools ( GIS )
Spatial analysis and Analysis Tools ( GIS )designQube
 
Shortest path search for real road networks and dynamic costs with pgRouting
Shortest path search for real road networks and dynamic costs with pgRoutingShortest path search for real road networks and dynamic costs with pgRouting
Shortest path search for real road networks and dynamic costs with pgRoutingantonpa
 
How Matlab Helps
How Matlab HelpsHow Matlab Helps
How Matlab Helpssiufu
 
Cg 3 d translation
 Cg   3 d translation Cg   3 d translation
Cg 3 d translationMeenakshiK19
 
Bellman ford Algorithm
Bellman ford AlgorithmBellman ford Algorithm
Bellman ford Algorithmtaimurkhan803
 
Djikstra's Algorithm
Djikstra's Algorithm Djikstra's Algorithm
Djikstra's Algorithm Samar Kenkre
 
Spatial interpolation techniques
Spatial interpolation techniquesSpatial interpolation techniques
Spatial interpolation techniquesManisha Shrivastava
 

La actualidad más candente (19)

Dmitriy Kolesov - GIS as an environment for integration and analysis of spati...
Dmitriy Kolesov - GIS as an environment for integration and analysis of spati...Dmitriy Kolesov - GIS as an environment for integration and analysis of spati...
Dmitriy Kolesov - GIS as an environment for integration and analysis of spati...
 
Gis Concepts 5/5
Gis Concepts 5/5Gis Concepts 5/5
Gis Concepts 5/5
 
Dijkstra algorithm a dynammic programming approach
Dijkstra algorithm   a dynammic programming approachDijkstra algorithm   a dynammic programming approach
Dijkstra algorithm a dynammic programming approach
 
Gis Concepts 1/5
Gis Concepts 1/5Gis Concepts 1/5
Gis Concepts 1/5
 
Chris hill rps_postgis_threeoutoffouraintbad_20150505_1
Chris hill rps_postgis_threeoutoffouraintbad_20150505_1Chris hill rps_postgis_threeoutoffouraintbad_20150505_1
Chris hill rps_postgis_threeoutoffouraintbad_20150505_1
 
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
 
Networks dijkstra's algorithm- pgsr
Networks  dijkstra's algorithm- pgsrNetworks  dijkstra's algorithm- pgsr
Networks dijkstra's algorithm- pgsr
 
d
dd
d
 
Discrete Mathematics Presentation
Discrete Mathematics PresentationDiscrete Mathematics Presentation
Discrete Mathematics Presentation
 
Dijkstra's Algorithm
Dijkstra's Algorithm Dijkstra's Algorithm
Dijkstra's Algorithm
 
Raster data analysis
Raster data analysisRaster data analysis
Raster data analysis
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithm
 
Spatial analysis and Analysis Tools ( GIS )
Spatial analysis and Analysis Tools ( GIS )Spatial analysis and Analysis Tools ( GIS )
Spatial analysis and Analysis Tools ( GIS )
 
Shortest path search for real road networks and dynamic costs with pgRouting
Shortest path search for real road networks and dynamic costs with pgRoutingShortest path search for real road networks and dynamic costs with pgRouting
Shortest path search for real road networks and dynamic costs with pgRouting
 
How Matlab Helps
How Matlab HelpsHow Matlab Helps
How Matlab Helps
 
Cg 3 d translation
 Cg   3 d translation Cg   3 d translation
Cg 3 d translation
 
Bellman ford Algorithm
Bellman ford AlgorithmBellman ford Algorithm
Bellman ford Algorithm
 
Djikstra's Algorithm
Djikstra's Algorithm Djikstra's Algorithm
Djikstra's Algorithm
 
Spatial interpolation techniques
Spatial interpolation techniquesSpatial interpolation techniques
Spatial interpolation techniques
 

Similar a Geek Sync | Having Fun with Spatial Data

Covering the earth and the cloud the next generation of spatial in sql server...
Covering the earth and the cloud the next generation of spatial in sql server...Covering the earth and the cloud the next generation of spatial in sql server...
Covering the earth and the cloud the next generation of spatial in sql server...Texas Natural Resources Information System
 
2017 RM-URISA Track: Spatial SQL - The Best Kept Secret in the Geospatial World
2017 RM-URISA Track:  Spatial SQL - The Best Kept Secret in the Geospatial World2017 RM-URISA Track:  Spatial SQL - The Best Kept Secret in the Geospatial World
2017 RM-URISA Track: Spatial SQL - The Best Kept Secret in the Geospatial WorldGIS in the Rockies
 
Opensource gis development - part 2
Opensource gis development - part 2Opensource gis development - part 2
Opensource gis development - part 2Andrea Antonello
 
Managing GeoData with PostGIS @ KhmelnytskyiPy #1
Managing GeoData with PostGIS @ KhmelnytskyiPy #1Managing GeoData with PostGIS @ KhmelnytskyiPy #1
Managing GeoData with PostGIS @ KhmelnytskyiPy #1Volodymyr Gamula
 
Cab travel time prediction using ensemble models
Cab travel time prediction using ensemble modelsCab travel time prediction using ensemble models
Cab travel time prediction using ensemble modelsAyan Sengupta
 
Presto Summit 2018 - 06 - Facebook Geospatial
Presto Summit 2018 - 06 - Facebook GeospatialPresto Summit 2018 - 06 - Facebook Geospatial
Presto Summit 2018 - 06 - Facebook Geospatialkbajda
 
SQLBits X SQL Server 2012 Spatial
SQLBits X SQL Server 2012 SpatialSQLBits X SQL Server 2012 Spatial
SQLBits X SQL Server 2012 SpatialMichael Rys
 
SQL Geography Datatypes by Jared Nielsen and the FUZION Agency
SQL Geography Datatypes by Jared Nielsen and the FUZION AgencySQL Geography Datatypes by Jared Nielsen and the FUZION Agency
SQL Geography Datatypes by Jared Nielsen and the FUZION AgencyJared Nielsen
 
Introduction geostatistic for_mineral_resources
Introduction geostatistic for_mineral_resourcesIntroduction geostatistic for_mineral_resources
Introduction geostatistic for_mineral_resourcesAdi Handarbeni
 
Mining interesting locations and travel sequences from gps trajectories
Mining interesting locations and travel sequences from gps trajectoriesMining interesting locations and travel sequences from gps trajectories
Mining interesting locations and travel sequences from gps trajectoriesHopeBay Technologies, Inc.
 
Geopy module in python
Geopy module in pythonGeopy module in python
Geopy module in pythonAshmita Dhakal
 
Application of particle swarm optimization in 3 dimensional travelling salesm...
Application of particle swarm optimization in 3 dimensional travelling salesm...Application of particle swarm optimization in 3 dimensional travelling salesm...
Application of particle swarm optimization in 3 dimensional travelling salesm...Maad M. Mijwil
 
GIS Analysis For Site Remediation
GIS Analysis For Site RemediationGIS Analysis For Site Remediation
GIS Analysis For Site RemediationJoseph Luchette
 
Where the %$#^ Is Everybody? Geospatial Solutions For Oracle APEX
Where the %$#^ Is Everybody? Geospatial Solutions For Oracle APEXWhere the %$#^ Is Everybody? Geospatial Solutions For Oracle APEX
Where the %$#^ Is Everybody? Geospatial Solutions For Oracle APEXJim Czuprynski
 
Locality Sensitive Hashing By Spark
Locality Sensitive Hashing By SparkLocality Sensitive Hashing By Spark
Locality Sensitive Hashing By SparkSpark Summit
 

Similar a Geek Sync | Having Fun with Spatial Data (20)

Covering the earth and the cloud the next generation of spatial in sql server...
Covering the earth and the cloud the next generation of spatial in sql server...Covering the earth and the cloud the next generation of spatial in sql server...
Covering the earth and the cloud the next generation of spatial in sql server...
 
2017 RM-URISA Track: Spatial SQL - The Best Kept Secret in the Geospatial World
2017 RM-URISA Track:  Spatial SQL - The Best Kept Secret in the Geospatial World2017 RM-URISA Track:  Spatial SQL - The Best Kept Secret in the Geospatial World
2017 RM-URISA Track: Spatial SQL - The Best Kept Secret in the Geospatial World
 
Day 6 - PostGIS
Day 6 - PostGISDay 6 - PostGIS
Day 6 - PostGIS
 
Opensource gis development - part 2
Opensource gis development - part 2Opensource gis development - part 2
Opensource gis development - part 2
 
Managing GeoData with PostGIS @ KhmelnytskyiPy #1
Managing GeoData with PostGIS @ KhmelnytskyiPy #1Managing GeoData with PostGIS @ KhmelnytskyiPy #1
Managing GeoData with PostGIS @ KhmelnytskyiPy #1
 
Cab travel time prediction using ensemble models
Cab travel time prediction using ensemble modelsCab travel time prediction using ensemble models
Cab travel time prediction using ensemble models
 
Presto Summit 2018 - 06 - Facebook Geospatial
Presto Summit 2018 - 06 - Facebook GeospatialPresto Summit 2018 - 06 - Facebook Geospatial
Presto Summit 2018 - 06 - Facebook Geospatial
 
SQLBits X SQL Server 2012 Spatial
SQLBits X SQL Server 2012 SpatialSQLBits X SQL Server 2012 Spatial
SQLBits X SQL Server 2012 Spatial
 
SQL Geography Datatypes by Jared Nielsen and the FUZION Agency
SQL Geography Datatypes by Jared Nielsen and the FUZION AgencySQL Geography Datatypes by Jared Nielsen and the FUZION Agency
SQL Geography Datatypes by Jared Nielsen and the FUZION Agency
 
Introduction geostatistic for_mineral_resources
Introduction geostatistic for_mineral_resourcesIntroduction geostatistic for_mineral_resources
Introduction geostatistic for_mineral_resources
 
Mining interesting locations and travel sequences from gps trajectories
Mining interesting locations and travel sequences from gps trajectoriesMining interesting locations and travel sequences from gps trajectories
Mining interesting locations and travel sequences from gps trajectories
 
Geopy module in python
Geopy module in pythonGeopy module in python
Geopy module in python
 
Application of particle swarm optimization in 3 dimensional travelling salesm...
Application of particle swarm optimization in 3 dimensional travelling salesm...Application of particle swarm optimization in 3 dimensional travelling salesm...
Application of particle swarm optimization in 3 dimensional travelling salesm...
 
1.pptx
1.pptx1.pptx
1.pptx
 
Coordinate Systems
Coordinate SystemsCoordinate Systems
Coordinate Systems
 
GIS Analysis For Site Remediation
GIS Analysis For Site RemediationGIS Analysis For Site Remediation
GIS Analysis For Site Remediation
 
Coordinate systems
Coordinate systemsCoordinate systems
Coordinate systems
 
Where the %$#^ Is Everybody? Geospatial Solutions For Oracle APEX
Where the %$#^ Is Everybody? Geospatial Solutions For Oracle APEXWhere the %$#^ Is Everybody? Geospatial Solutions For Oracle APEX
Where the %$#^ Is Everybody? Geospatial Solutions For Oracle APEX
 
Locality Sensitive Hashing By Spark
Locality Sensitive Hashing By SparkLocality Sensitive Hashing By Spark
Locality Sensitive Hashing By Spark
 
Unidata's Common Data Model
Unidata's Common Data ModelUnidata's Common Data Model
Unidata's Common Data Model
 

Más de IDERA Software

The role of the database administrator (DBA) in 2020: Changes, challenges, an...
The role of the database administrator (DBA) in 2020: Changes, challenges, an...The role of the database administrator (DBA) in 2020: Changes, challenges, an...
The role of the database administrator (DBA) in 2020: Changes, challenges, an...IDERA Software
 
Problems and solutions for migrating databases to the cloud
Problems and solutions for migrating databases to the cloudProblems and solutions for migrating databases to the cloud
Problems and solutions for migrating databases to the cloudIDERA Software
 
Public cloud uses and limitations
Public cloud uses and limitationsPublic cloud uses and limitations
Public cloud uses and limitationsIDERA Software
 
Optimize the performance, cost, and value of databases.pptx
Optimize the performance, cost, and value of databases.pptxOptimize the performance, cost, and value of databases.pptx
Optimize the performance, cost, and value of databases.pptxIDERA Software
 
Monitor cloud database with SQL Diagnostic Manager for SQL Server
Monitor cloud database with SQL Diagnostic Manager for SQL ServerMonitor cloud database with SQL Diagnostic Manager for SQL Server
Monitor cloud database with SQL Diagnostic Manager for SQL ServerIDERA Software
 
Database administrators (dbas) face increasing pressure to monitor databases
Database administrators (dbas) face increasing pressure to monitor databasesDatabase administrators (dbas) face increasing pressure to monitor databases
Database administrators (dbas) face increasing pressure to monitor databasesIDERA Software
 
Six tips for cutting sql server licensing costs
Six tips for cutting sql server licensing costsSix tips for cutting sql server licensing costs
Six tips for cutting sql server licensing costsIDERA Software
 
Idera live 2021: The Power of Abstraction by Steve Hoberman
Idera live 2021:  The Power of Abstraction by Steve HobermanIdera live 2021:  The Power of Abstraction by Steve Hoberman
Idera live 2021: The Power of Abstraction by Steve HobermanIDERA Software
 
Idera live 2021: Why Data Lakes are Critical for AI, ML, and IoT By Brian Flug
Idera live 2021:  Why Data Lakes are Critical for AI, ML, and IoT  By Brian FlugIdera live 2021:  Why Data Lakes are Critical for AI, ML, and IoT  By Brian Flug
Idera live 2021: Why Data Lakes are Critical for AI, ML, and IoT By Brian FlugIDERA Software
 
Idera live 2021: Will Data Vault add Value to Your Data Warehouse? 3 Signs th...
Idera live 2021: Will Data Vault add Value to Your Data Warehouse? 3 Signs th...Idera live 2021: Will Data Vault add Value to Your Data Warehouse? 3 Signs th...
Idera live 2021: Will Data Vault add Value to Your Data Warehouse? 3 Signs th...IDERA Software
 
Idera live 2021: Managing Digital Transformation on a Budget by Bert Scalzo
Idera live 2021:  Managing Digital Transformation on a Budget by Bert ScalzoIdera live 2021:  Managing Digital Transformation on a Budget by Bert Scalzo
Idera live 2021: Managing Digital Transformation on a Budget by Bert ScalzoIDERA Software
 
Idera live 2021: Keynote Presentation The Future of Data is The Data Cloud b...
Idera live 2021:  Keynote Presentation The Future of Data is The Data Cloud b...Idera live 2021:  Keynote Presentation The Future of Data is The Data Cloud b...
Idera live 2021: Keynote Presentation The Future of Data is The Data Cloud b...IDERA Software
 
Idera live 2021: Managing Databases in the Cloud - the First Step, a Succes...
Idera live 2021:   Managing Databases in the Cloud - the First Step, a Succes...Idera live 2021:   Managing Databases in the Cloud - the First Step, a Succes...
Idera live 2021: Managing Databases in the Cloud - the First Step, a Succes...IDERA Software
 
Idera live 2021: Database Auditing - on-Premises and in the Cloud by Craig M...
Idera live 2021:  Database Auditing - on-Premises and in the Cloud by Craig M...Idera live 2021:  Database Auditing - on-Premises and in the Cloud by Craig M...
Idera live 2021: Database Auditing - on-Premises and in the Cloud by Craig M...IDERA Software
 
Idera live 2021: Performance Tuning Azure SQL Database by Monica Rathbun
Idera live 2021:  Performance Tuning Azure SQL Database by Monica RathbunIdera live 2021:  Performance Tuning Azure SQL Database by Monica Rathbun
Idera live 2021: Performance Tuning Azure SQL Database by Monica RathbunIDERA Software
 
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERAGeek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERAIDERA Software
 
How Users of a Performance Monitoring Tool Can Benefit from an Inventory Mana...
How Users of a Performance Monitoring Tool Can Benefit from an Inventory Mana...How Users of a Performance Monitoring Tool Can Benefit from an Inventory Mana...
How Users of a Performance Monitoring Tool Can Benefit from an Inventory Mana...IDERA Software
 
Benefits of Third Party Tools for MySQL | IDERA
Benefits of Third Party Tools for MySQL | IDERABenefits of Third Party Tools for MySQL | IDERA
Benefits of Third Party Tools for MySQL | IDERAIDERA Software
 
Achieve More with Less Resources | IDERA
Achieve More with Less Resources | IDERAAchieve More with Less Resources | IDERA
Achieve More with Less Resources | IDERAIDERA Software
 
Benefits of SQL Server 2017 and 2019 | IDERA
Benefits of SQL Server 2017 and 2019 | IDERABenefits of SQL Server 2017 and 2019 | IDERA
Benefits of SQL Server 2017 and 2019 | IDERAIDERA Software
 

Más de IDERA Software (20)

The role of the database administrator (DBA) in 2020: Changes, challenges, an...
The role of the database administrator (DBA) in 2020: Changes, challenges, an...The role of the database administrator (DBA) in 2020: Changes, challenges, an...
The role of the database administrator (DBA) in 2020: Changes, challenges, an...
 
Problems and solutions for migrating databases to the cloud
Problems and solutions for migrating databases to the cloudProblems and solutions for migrating databases to the cloud
Problems and solutions for migrating databases to the cloud
 
Public cloud uses and limitations
Public cloud uses and limitationsPublic cloud uses and limitations
Public cloud uses and limitations
 
Optimize the performance, cost, and value of databases.pptx
Optimize the performance, cost, and value of databases.pptxOptimize the performance, cost, and value of databases.pptx
Optimize the performance, cost, and value of databases.pptx
 
Monitor cloud database with SQL Diagnostic Manager for SQL Server
Monitor cloud database with SQL Diagnostic Manager for SQL ServerMonitor cloud database with SQL Diagnostic Manager for SQL Server
Monitor cloud database with SQL Diagnostic Manager for SQL Server
 
Database administrators (dbas) face increasing pressure to monitor databases
Database administrators (dbas) face increasing pressure to monitor databasesDatabase administrators (dbas) face increasing pressure to monitor databases
Database administrators (dbas) face increasing pressure to monitor databases
 
Six tips for cutting sql server licensing costs
Six tips for cutting sql server licensing costsSix tips for cutting sql server licensing costs
Six tips for cutting sql server licensing costs
 
Idera live 2021: The Power of Abstraction by Steve Hoberman
Idera live 2021:  The Power of Abstraction by Steve HobermanIdera live 2021:  The Power of Abstraction by Steve Hoberman
Idera live 2021: The Power of Abstraction by Steve Hoberman
 
Idera live 2021: Why Data Lakes are Critical for AI, ML, and IoT By Brian Flug
Idera live 2021:  Why Data Lakes are Critical for AI, ML, and IoT  By Brian FlugIdera live 2021:  Why Data Lakes are Critical for AI, ML, and IoT  By Brian Flug
Idera live 2021: Why Data Lakes are Critical for AI, ML, and IoT By Brian Flug
 
Idera live 2021: Will Data Vault add Value to Your Data Warehouse? 3 Signs th...
Idera live 2021: Will Data Vault add Value to Your Data Warehouse? 3 Signs th...Idera live 2021: Will Data Vault add Value to Your Data Warehouse? 3 Signs th...
Idera live 2021: Will Data Vault add Value to Your Data Warehouse? 3 Signs th...
 
Idera live 2021: Managing Digital Transformation on a Budget by Bert Scalzo
Idera live 2021:  Managing Digital Transformation on a Budget by Bert ScalzoIdera live 2021:  Managing Digital Transformation on a Budget by Bert Scalzo
Idera live 2021: Managing Digital Transformation on a Budget by Bert Scalzo
 
Idera live 2021: Keynote Presentation The Future of Data is The Data Cloud b...
Idera live 2021:  Keynote Presentation The Future of Data is The Data Cloud b...Idera live 2021:  Keynote Presentation The Future of Data is The Data Cloud b...
Idera live 2021: Keynote Presentation The Future of Data is The Data Cloud b...
 
Idera live 2021: Managing Databases in the Cloud - the First Step, a Succes...
Idera live 2021:   Managing Databases in the Cloud - the First Step, a Succes...Idera live 2021:   Managing Databases in the Cloud - the First Step, a Succes...
Idera live 2021: Managing Databases in the Cloud - the First Step, a Succes...
 
Idera live 2021: Database Auditing - on-Premises and in the Cloud by Craig M...
Idera live 2021:  Database Auditing - on-Premises and in the Cloud by Craig M...Idera live 2021:  Database Auditing - on-Premises and in the Cloud by Craig M...
Idera live 2021: Database Auditing - on-Premises and in the Cloud by Craig M...
 
Idera live 2021: Performance Tuning Azure SQL Database by Monica Rathbun
Idera live 2021:  Performance Tuning Azure SQL Database by Monica RathbunIdera live 2021:  Performance Tuning Azure SQL Database by Monica Rathbun
Idera live 2021: Performance Tuning Azure SQL Database by Monica Rathbun
 
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERAGeek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
 
How Users of a Performance Monitoring Tool Can Benefit from an Inventory Mana...
How Users of a Performance Monitoring Tool Can Benefit from an Inventory Mana...How Users of a Performance Monitoring Tool Can Benefit from an Inventory Mana...
How Users of a Performance Monitoring Tool Can Benefit from an Inventory Mana...
 
Benefits of Third Party Tools for MySQL | IDERA
Benefits of Third Party Tools for MySQL | IDERABenefits of Third Party Tools for MySQL | IDERA
Benefits of Third Party Tools for MySQL | IDERA
 
Achieve More with Less Resources | IDERA
Achieve More with Less Resources | IDERAAchieve More with Less Resources | IDERA
Achieve More with Less Resources | IDERA
 
Benefits of SQL Server 2017 and 2019 | IDERA
Benefits of SQL Server 2017 and 2019 | IDERABenefits of SQL Server 2017 and 2019 | IDERA
Benefits of SQL Server 2017 and 2019 | IDERA
 

Último

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 

Último (20)

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 

Geek Sync | Having Fun with Spatial Data

  • 1. Fun with SQL Server Spatial Data Mindy Curnutt VP, Information Management TMW Systems, Inc. 8/25/2016
  • 2. About Me VP, Information Management, TMW SQL Server MVP SQL Server since 6.5 / 1995 (20 Years) SQLPASS Speaker, 2005, 2012-2015 PASS Program Manager 2015 & 2016 Twitter: @sqlgirl Email: mindycurnutt@hotmail.com
  • 3. • Geography – Ellipsoidal (Lat, Long, Z, M) – Define points, lines & areas with latitude & longitude Spatial Data Types • Geometry – Flat Map (X, Y, Z, M) – Define points, lines & areas with coordinates – Use for localized & interior spaces
  • 4. What Can I Represent? POINT MULTIPOINT LINESTRING MULTI- LINESTRING POLYGON MULTI-POLYGON There’s more too! Complex Polygons & Multi-Polygons, Collection, Curves, Combinations…
  • 5. What Can I Represent? • Points – A GPS Position: Declare @location geography = geography::Point(@lat, @long, 4326); – A Region of 20 meters around a Point (Buffer): Declare @region geography = geography::Point(@lat, @long, 4326).STBuffer(20);
  • 6. Circular Arcs What Can I Represent? DECLARE @g geography = 'CIRCULARSTRING( -122.358 47.653, -122.348 47.649, -122.348 47.658, -122.358 47.658, -122.358 47.653)';
  • 7. Circular Arcs What Can I Represent? DECLARE @g geometry = 'COMPOUNDCURVE ( CIRCULARSTRING(1 0, 0 2, 3 1), (3 1, 1 1), CIRCULARSTRING(1 1, 3 4, 4 1) )';
  • 8. Circular Arcs What Can I Represent? DECLARE @g geometry = 'CURVEPOLYGON ( CIRCULARSTRING(0 4, 4 0, 8 4, 4 8, 0 4), CIRCULARSTRING(2 4, 4 2, 6 4, 4 6, 2 4) )'; SELECT @g.STArea() AS Area;
  • 9. What Can I Represent? • Complex Polygons • select * from timezone_world where ID = 86 • select * from timezone_world where ID in ( • 27,17,7,273,41,204,86,81,149,74,1 26,296,312,44,82,389,124,400,251 ,206,104,67,102,41)
  • 10. Common Spatial Methods in T- SQL • STBuffer (return type: Geography) Draws a buffer of the specified distance around the geography shape. If the shape is a point, the buffer will draw a circle. • ShortestLineTo (return type: Geography) Returns an object that represent the shortest distance between two objects • STIntersection (return type: Geography) Returns an object that represents the points where a geography instance intersects another geography instance. • STUnion (return type: Geography) Returns an object that represents the points where a geography instance intersects another geography instance.
  • 11. Common Spatial Methods in T- SQL • STContains (return type: Boolean) Specifies whether the calling geography instance spatially contains the geography instance passed to the method. • STIntersects (return type: Boolean) Returns 1 if a geography instance spatially overlaps another geography instance, or 0 if it does not. • STDistance (return type: Float) Returns the shortest distance between a point in a geography instance and a point in another geography instance. (Float) • STLength (return type: Float) Returns in Meters the length of a Line or Curve object • STArea (return type: Float) Returns Square Meters of the Area of the resulting
  • 12. What is that 4326? • SRID – Spatial Reference ID – Determines Measurements – GeoID Dimensions – All objects must be of the same SRID – Based on European Petroleum Survey Group select * from sys.spatial_reference_systems
  • 13. Examples • Get all Customers within a distance of X Select * from Customers c where s.geo.STDistance(@me) < @x • Get all Customers within a particular City’s Boundary Select * from Customers c where c.geo.STIntersects(@ACityBoundary) = 1 • How many miles is a walk in my neighborhood with my dog? declare @g geography; SET @g= geography::STGeomFromText('LINESTRING (-96.777639 32.951932, -96.777639 32.951932, -96.777620 32.952159, -96.778624 32.952167, -96.779098 32.952243, -96.778716 32.978184)',4326); select @g; select @g.STLength() * .000621371 * 2;
  • 14. Convert Objects to Spatial Data • Geocoder Services – GPS Visualizer – Batch Address Locator • Give a list of addresses, returns Lat/Long http://www.gpsvisualizer.com/geocoder/ – ArcGIS https://developers.arcgis.com/features/geocoding/ – Google Maps https://google- developers.appspot.com/maps/documentation/utils/geocoder/ Texas A & M http://geoservices.tamu.edu/Services/Geocode/
  • 15. Sources of Free Data • Shapefiles – United States Census - https://www.census.gov/ – State and Local Governments – http://geo.data.gov – http://www.mapcruzin.com/download-free-arcgis-shapefiles.htm – http://www.naturalearthdata.com/ – http://freegisdata.rtwilson.com/ (huge list of links) – http://download.geofabrik.de/ – http://nationalmap.gov/small_scale/ – http://tnmap.tn.gov/ – ArcGIS - http://opendata.arcgis.com/
  • 16. Loading Spatial Data • Shape2SQL – http://www.sharpgis.net/page/SQL-Server-2008-Spatial-Tools
  • 17. SQL Server Art using Spatial Data • http://www.purplefrogsystems.com/blog/2011/0 5/sql-server-art-using-spatial-data/ – Convert image to a bitmap – Convert bitmap to a vector (vectormagic.com) – Use Excel workbook for formatting – Paste in SQL • http://michaeljswart.com/2010/02/more- images-from-the-spatial-results-tab/
  • 18. Credits • Michael Rys, Milan Stojic – TechEd Europe 2012 DBI324 • Michael J Swart Blog • Alex Whittles – Purple Frog Consultancy Blog
  • 19. Head over to IDERA.com to download any of our product trials free for 14-days. Free Trials

Notas del editor

  1. Show Demo 1
  2. Demo 2 – Circular String
  3. Demo 4 – Circular Arcs
  4. Demo 5 – Complex Polygons
  5. Demo 6 – Shortest Line To & STLength / Demo 7 – STIntersection and STUnion
  6. Demo 8 – STContains and STIntersects
  7. Demo 9 - GeogCoding
  8. Demo – Shape2SQL