SlideShare a Scribd company logo
1 of 28
Download to read offline
DEALING GEOGRAPHIC DATA 
David Dye
DEALING GEOGRAPHIC DATA•Introduction•Working With Addresses•ETL•Presenting
INTRODUCTION•David Dye•derekman1@msn.com•HTTP://WWW.SQLSAFETY.COM
WORKING WITH ADDRESSES
BACKGROUND•Within Public Safety many reports are geographically based and visual reports are helpful•Pin maps became the de facto standard of geographic maps•Looks kewl, but no so easy to automatw•Crime clusters•Burglaries within a xxradius•Focused patrol areas•Traffic crashes with injuries•YES we target problem areasNOT people•Traffic crashes without injuries•Granularity based on the reason for the first harmful event•Did He do that too??? •Locate similar crimes in the area where suspects are arrested•Car hoppers!!! •AKA job security!!
DEALING WITH LOCATION•What location information do you deal with? •Country•State/Providence•Zip code•City •Address•Block range•What do you need to report on•Granularity!!! •How does it have to be reported? •Aggregations•Non-map based•Visual representation
DEFINE REPORT FORMAT•Table, matrix, list•Visual
PRESENTING TO POLICE
DEMONSTRATIONTabular report (BasicAddressReport.rdl) Data set reviewSSRS report expressionMap control report (MapReport.rdl) Map Control Wizard
HOW IS LOCATION RECEIVED/STORED•How do you receive and store your date•Fully parsed address•Full address•Lon and Lat•SQL Spatial•The higher the level of receipt/storage the more analysis and cleansing•TAKE THE TIME TO DO EXHAUSTIVE EVALUATION•Look for the rules and then find the most common exceptions•Generally the more granular the storage/receipt the easier it is to validate and piece together
WHAT IS BEING REPORTED? •Review how the geographic data is being reported•Granularity•Zip•Block ranges •Latitude and longitude/Point•Strive to drill down to the lowest level•Does it require visualization (SSRS Map Component) •“14 Crashes in the 100 Block North Del Prado”
CREATE YOUR DIMENSION•Based on the reporting needs will drive the schema of the dimension tableCREATETABLE[dbo].[DimGeography]( [geoid][int]IDENTITY(1,1)NOTNULL, [commitedkey][int]NULL, [inci_id][varchar](14)NULL, [block][int]NULL………… •Review DDL Example
DEMONSTRATIONDDL statement (LocationQueries.sql) Discuss requirementsCrossrd(s) Block range critical!! geoxgeoy
ETL
EVALUATE DATA SOURCES•Where is geographic data being stored•SQL•Excel (SORRY BRO!!) •ESRI•CSV•Fox Pro (REALLY!! Why not Aramaic?) •Can separate sources be maintained•Based on the ability to present as a whole and consistency and accuracy•Is location parsed? •If not evaluate the need/ability to parse during the transformation•Eases presenting and cleansing
IMPORTING•If possible parse the data to its most granular segments•Street number•Street•Street prefix•Street Suffix•City•Zip•State•Clean it up!! •Find most common inconsistencies•Str, S, or Street should all be “St” •Del Prdo, D.P., Dele Prado should all be “Del Prado” •REVIEW DEMO T-SQL CODE
TRANSFORMATIONS•Based on the source data not all data sets may be present•Block range•VIEW DEMO CODE•Longitude/Latitude•Cross street(s) •Address accuracy is critical at this point!! •Accurate and consistent!
HOW DO I GET LAT/LON? •You can manually enter each address•http://itouchmap.com/latlong.html•http://stevemorse.org/jcal/latlon.php•C’MonMan!! Really?!?! •Automate!! •Google Maps API•https://developers.google.com/maps/documentation/geocoding/#geocoding•Limits usage•Free 2,500 within 24 hours•Business 100,000 within 24 hours•Will also begin to throttle based on requests submitted within a minute threshold•MelissaData•Native SSIS transformation•Provides extensible transformation•US and International•DEMO
DEMONSTRATIONSQL Cleansing (LocationQueries.sql) Discuss requirementsCrossrd(s) Block range critical!! geoxgeoy
KEWL, BUT NOW WHAT?!? •I got latand lon!! Now what?!?! •Power Pivot/ Power Map Demo•Address only •THIS IS WHY WE NEED LAT LON•Latlonin Power Map•We can do better!! •SQL Server spatial data type supports•Native functions•SSRS map control•Provides dynamic visualization of geographic data
DEMONSTRATIONPower Map using addressOUCH!! Power Map using Lat/LonGetting there!
SQL SPATIAL PRIMER•Introduced in SQL 2008•Based on CLR user defined type•System provided•Does not require enabling CLR•Geography •Supports methods•Open Geospatial Consortium (OGC) standard•Set of Microsoft extensions to that standard•Geometry•Supports methods•Open Geospatial Consortium (OGC) standard•Set of Microsoft extensions to that standard
DEMONSTRATIONGeometry (LocationQueries.sql) Geography(LocationQueries.sql)
WHY USE SQL SPATIAL•It’s KEWL•Chicks dig it
WHY USE SPATIAL•Provides the ability create SSRS reports using the Map Control•Better than address and latitude and longitude•More exact•Spatial functions can be applied•All points within the radius of a point•Once longitude and latitude is obtained we can convert this to geography data type•Geography column can be set using an UPDATE statement•DEMO
DEMONSTRATIONUpdate spatial columnSpatial methodsSTDistance
SSRS MAP COMPONENT•Wizards ROCK!! •Report builder 3.0 Map Report•SSDT•More control!
DEMONSTRATIONMap BuilderWizardSSDTBasicRadiusParameterized

More Related Content

Similar to Working with and Presenting Geographic Data in SQL

CTOs Perspective on Adding Geospatial and Location-based Information
CTOs Perspective on Adding Geospatial and Location-based InformationCTOs Perspective on Adding Geospatial and Location-based Information
CTOs Perspective on Adding Geospatial and Location-based InformationBradley Brown
 
Spatial Data in SQL Server
Spatial Data in SQL ServerSpatial Data in SQL Server
Spatial Data in SQL ServerEduardo Castro
 
GEOALBERTA 2013 - I Spy With My Little Eye - St Albert
GEOALBERTA 2013 - I Spy With My Little Eye - St AlbertGEOALBERTA 2013 - I Spy With My Little Eye - St Albert
GEOALBERTA 2013 - I Spy With My Little Eye - St AlbertTammy Kobliuk
 
Survey of the Microsoft Azure Data Landscape
Survey of the Microsoft Azure Data LandscapeSurvey of the Microsoft Azure Data Landscape
Survey of the Microsoft Azure Data LandscapeIke Ellis
 
Cassandra Summit 2014: Fuzzy Entity Matching at Scale
Cassandra Summit 2014: Fuzzy Entity Matching at ScaleCassandra Summit 2014: Fuzzy Entity Matching at Scale
Cassandra Summit 2014: Fuzzy Entity Matching at ScaleDataStax Academy
 
Harpster, J. - Open data on buildings with satellite imagery processing
Harpster, J. - Open data on buildings with satellite imagery processingHarpster, J. - Open data on buildings with satellite imagery processing
Harpster, J. - Open data on buildings with satellite imagery processingOECDregions
 
Spatial Data in SQL Server
Spatial Data in SQL ServerSpatial Data in SQL Server
Spatial Data in SQL ServerEduardo Castro
 
Ioannis Doxaras on GIS and Gmaps at 1st GTUG meetup Greece
Ioannis Doxaras on GIS and Gmaps at 1st GTUG meetup Greece Ioannis Doxaras on GIS and Gmaps at 1st GTUG meetup Greece
Ioannis Doxaras on GIS and Gmaps at 1st GTUG meetup Greece CoLab Athens
 
PostGIS and Spatial SQL
PostGIS and Spatial SQLPostGIS and Spatial SQL
PostGIS and Spatial SQLTodd Barr
 
LocationTech Tour 2016 - Vectortiles
LocationTech Tour 2016 - Vectortiles LocationTech Tour 2016 - Vectortiles
LocationTech Tour 2016 - Vectortiles Morgan Thompson
 
Presentation sql server to oracle a database migration roadmap
Presentation    sql server to oracle a database migration roadmapPresentation    sql server to oracle a database migration roadmap
Presentation sql server to oracle a database migration roadmapxKinAnx
 
GeoMesa: Scalable Geospatial Analytics
GeoMesa:  Scalable Geospatial AnalyticsGeoMesa:  Scalable Geospatial Analytics
GeoMesa: Scalable Geospatial AnalyticsVisionGEOMATIQUE2014
 
Cloud conf-varna-2014-mihail mateev-spatial-data-and-microsoft-azure-sql-data...
Cloud conf-varna-2014-mihail mateev-spatial-data-and-microsoft-azure-sql-data...Cloud conf-varna-2014-mihail mateev-spatial-data-and-microsoft-azure-sql-data...
Cloud conf-varna-2014-mihail mateev-spatial-data-and-microsoft-azure-sql-data...Mihail Mateev
 
Building a Spatial Database in PostgreSQL
Building a Spatial Database in PostgreSQLBuilding a Spatial Database in PostgreSQL
Building a Spatial Database in PostgreSQLSohail Akbar Goheer
 
Game Design 2 (2010): Lecture 7 - Micro and Macro Design
Game Design 2 (2010): Lecture 7 - Micro and Macro DesignGame Design 2 (2010): Lecture 7 - Micro and Macro Design
Game Design 2 (2010): Lecture 7 - Micro and Macro DesignDavid Farrell
 
What is spatial sql
What is spatial sqlWhat is spatial sql
What is spatial sqlshawty_ds
 
Lucene solr 4 spatial extended deep dive
Lucene solr 4 spatial   extended deep diveLucene solr 4 spatial   extended deep dive
Lucene solr 4 spatial extended deep divelucenerevolution
 
Practical Scanning Uses for Construction Applications by Tim Schubert
Practical Scanning Uses for Construction Applications by Tim SchubertPractical Scanning Uses for Construction Applications by Tim Schubert
Practical Scanning Uses for Construction Applications by Tim SchubertMelissa Tiffany
 
Accumulo design
Accumulo designAccumulo design
Accumulo designscsorensen
 

Similar to Working with and Presenting Geographic Data in SQL (20)

CTOs Perspective on Adding Geospatial and Location-based Information
CTOs Perspective on Adding Geospatial and Location-based InformationCTOs Perspective on Adding Geospatial and Location-based Information
CTOs Perspective on Adding Geospatial and Location-based Information
 
Spatial Data in SQL Server
Spatial Data in SQL ServerSpatial Data in SQL Server
Spatial Data in SQL Server
 
GEOALBERTA 2013 - I Spy With My Little Eye - St Albert
GEOALBERTA 2013 - I Spy With My Little Eye - St AlbertGEOALBERTA 2013 - I Spy With My Little Eye - St Albert
GEOALBERTA 2013 - I Spy With My Little Eye - St Albert
 
Survey of the Microsoft Azure Data Landscape
Survey of the Microsoft Azure Data LandscapeSurvey of the Microsoft Azure Data Landscape
Survey of the Microsoft Azure Data Landscape
 
Cassandra Summit 2014: Fuzzy Entity Matching at Scale
Cassandra Summit 2014: Fuzzy Entity Matching at ScaleCassandra Summit 2014: Fuzzy Entity Matching at Scale
Cassandra Summit 2014: Fuzzy Entity Matching at Scale
 
Harpster, J. - Open data on buildings with satellite imagery processing
Harpster, J. - Open data on buildings with satellite imagery processingHarpster, J. - Open data on buildings with satellite imagery processing
Harpster, J. - Open data on buildings with satellite imagery processing
 
Spatial Data in SQL Server
Spatial Data in SQL ServerSpatial Data in SQL Server
Spatial Data in SQL Server
 
Ioannis Doxaras on GIS and Gmaps at 1st GTUG meetup Greece
Ioannis Doxaras on GIS and Gmaps at 1st GTUG meetup Greece Ioannis Doxaras on GIS and Gmaps at 1st GTUG meetup Greece
Ioannis Doxaras on GIS and Gmaps at 1st GTUG meetup Greece
 
PostGIS and Spatial SQL
PostGIS and Spatial SQLPostGIS and Spatial SQL
PostGIS and Spatial SQL
 
LocationTech Tour 2016 - Vectortiles
LocationTech Tour 2016 - Vectortiles LocationTech Tour 2016 - Vectortiles
LocationTech Tour 2016 - Vectortiles
 
Hays from sensor to solution
Hays from sensor to solutionHays from sensor to solution
Hays from sensor to solution
 
Presentation sql server to oracle a database migration roadmap
Presentation    sql server to oracle a database migration roadmapPresentation    sql server to oracle a database migration roadmap
Presentation sql server to oracle a database migration roadmap
 
GeoMesa: Scalable Geospatial Analytics
GeoMesa:  Scalable Geospatial AnalyticsGeoMesa:  Scalable Geospatial Analytics
GeoMesa: Scalable Geospatial Analytics
 
Cloud conf-varna-2014-mihail mateev-spatial-data-and-microsoft-azure-sql-data...
Cloud conf-varna-2014-mihail mateev-spatial-data-and-microsoft-azure-sql-data...Cloud conf-varna-2014-mihail mateev-spatial-data-and-microsoft-azure-sql-data...
Cloud conf-varna-2014-mihail mateev-spatial-data-and-microsoft-azure-sql-data...
 
Building a Spatial Database in PostgreSQL
Building a Spatial Database in PostgreSQLBuilding a Spatial Database in PostgreSQL
Building a Spatial Database in PostgreSQL
 
Game Design 2 (2010): Lecture 7 - Micro and Macro Design
Game Design 2 (2010): Lecture 7 - Micro and Macro DesignGame Design 2 (2010): Lecture 7 - Micro and Macro Design
Game Design 2 (2010): Lecture 7 - Micro and Macro Design
 
What is spatial sql
What is spatial sqlWhat is spatial sql
What is spatial sql
 
Lucene solr 4 spatial extended deep dive
Lucene solr 4 spatial   extended deep diveLucene solr 4 spatial   extended deep dive
Lucene solr 4 spatial extended deep dive
 
Practical Scanning Uses for Construction Applications by Tim Schubert
Practical Scanning Uses for Construction Applications by Tim SchubertPractical Scanning Uses for Construction Applications by Tim Schubert
Practical Scanning Uses for Construction Applications by Tim Schubert
 
Accumulo design
Accumulo designAccumulo design
Accumulo design
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 

Recently uploaded (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 

Working with and Presenting Geographic Data in SQL

  • 2. DEALING GEOGRAPHIC DATA•Introduction•Working With Addresses•ETL•Presenting
  • 5. BACKGROUND•Within Public Safety many reports are geographically based and visual reports are helpful•Pin maps became the de facto standard of geographic maps•Looks kewl, but no so easy to automatw•Crime clusters•Burglaries within a xxradius•Focused patrol areas•Traffic crashes with injuries•YES we target problem areasNOT people•Traffic crashes without injuries•Granularity based on the reason for the first harmful event•Did He do that too??? •Locate similar crimes in the area where suspects are arrested•Car hoppers!!! •AKA job security!!
  • 6. DEALING WITH LOCATION•What location information do you deal with? •Country•State/Providence•Zip code•City •Address•Block range•What do you need to report on•Granularity!!! •How does it have to be reported? •Aggregations•Non-map based•Visual representation
  • 7. DEFINE REPORT FORMAT•Table, matrix, list•Visual
  • 9. DEMONSTRATIONTabular report (BasicAddressReport.rdl) Data set reviewSSRS report expressionMap control report (MapReport.rdl) Map Control Wizard
  • 10. HOW IS LOCATION RECEIVED/STORED•How do you receive and store your date•Fully parsed address•Full address•Lon and Lat•SQL Spatial•The higher the level of receipt/storage the more analysis and cleansing•TAKE THE TIME TO DO EXHAUSTIVE EVALUATION•Look for the rules and then find the most common exceptions•Generally the more granular the storage/receipt the easier it is to validate and piece together
  • 11. WHAT IS BEING REPORTED? •Review how the geographic data is being reported•Granularity•Zip•Block ranges •Latitude and longitude/Point•Strive to drill down to the lowest level•Does it require visualization (SSRS Map Component) •“14 Crashes in the 100 Block North Del Prado”
  • 12. CREATE YOUR DIMENSION•Based on the reporting needs will drive the schema of the dimension tableCREATETABLE[dbo].[DimGeography]( [geoid][int]IDENTITY(1,1)NOTNULL, [commitedkey][int]NULL, [inci_id][varchar](14)NULL, [block][int]NULL………… •Review DDL Example
  • 13. DEMONSTRATIONDDL statement (LocationQueries.sql) Discuss requirementsCrossrd(s) Block range critical!! geoxgeoy
  • 14. ETL
  • 15. EVALUATE DATA SOURCES•Where is geographic data being stored•SQL•Excel (SORRY BRO!!) •ESRI•CSV•Fox Pro (REALLY!! Why not Aramaic?) •Can separate sources be maintained•Based on the ability to present as a whole and consistency and accuracy•Is location parsed? •If not evaluate the need/ability to parse during the transformation•Eases presenting and cleansing
  • 16. IMPORTING•If possible parse the data to its most granular segments•Street number•Street•Street prefix•Street Suffix•City•Zip•State•Clean it up!! •Find most common inconsistencies•Str, S, or Street should all be “St” •Del Prdo, D.P., Dele Prado should all be “Del Prado” •REVIEW DEMO T-SQL CODE
  • 17. TRANSFORMATIONS•Based on the source data not all data sets may be present•Block range•VIEW DEMO CODE•Longitude/Latitude•Cross street(s) •Address accuracy is critical at this point!! •Accurate and consistent!
  • 18. HOW DO I GET LAT/LON? •You can manually enter each address•http://itouchmap.com/latlong.html•http://stevemorse.org/jcal/latlon.php•C’MonMan!! Really?!?! •Automate!! •Google Maps API•https://developers.google.com/maps/documentation/geocoding/#geocoding•Limits usage•Free 2,500 within 24 hours•Business 100,000 within 24 hours•Will also begin to throttle based on requests submitted within a minute threshold•MelissaData•Native SSIS transformation•Provides extensible transformation•US and International•DEMO
  • 19. DEMONSTRATIONSQL Cleansing (LocationQueries.sql) Discuss requirementsCrossrd(s) Block range critical!! geoxgeoy
  • 20. KEWL, BUT NOW WHAT?!? •I got latand lon!! Now what?!?! •Power Pivot/ Power Map Demo•Address only •THIS IS WHY WE NEED LAT LON•Latlonin Power Map•We can do better!! •SQL Server spatial data type supports•Native functions•SSRS map control•Provides dynamic visualization of geographic data
  • 21. DEMONSTRATIONPower Map using addressOUCH!! Power Map using Lat/LonGetting there!
  • 22. SQL SPATIAL PRIMER•Introduced in SQL 2008•Based on CLR user defined type•System provided•Does not require enabling CLR•Geography •Supports methods•Open Geospatial Consortium (OGC) standard•Set of Microsoft extensions to that standard•Geometry•Supports methods•Open Geospatial Consortium (OGC) standard•Set of Microsoft extensions to that standard
  • 24. WHY USE SQL SPATIAL•It’s KEWL•Chicks dig it
  • 25. WHY USE SPATIAL•Provides the ability create SSRS reports using the Map Control•Better than address and latitude and longitude•More exact•Spatial functions can be applied•All points within the radius of a point•Once longitude and latitude is obtained we can convert this to geography data type•Geography column can be set using an UPDATE statement•DEMO
  • 27. SSRS MAP COMPONENT•Wizards ROCK!! •Report builder 3.0 Map Report•SSDT•More control!