SlideShare uma empresa Scribd logo
1 de 21
SQL Server 2008 Spatial  Geography  Implemented in ASP.net and Virtual Earth  Michael Stark StarkNetwork.com Michael@starknetwork.com blog.starknetwork.com
Outline Background Overview Spatial in SQL 2008 Creating a spatial Query in SSMS Spatial Query in ListView control Spatial Query wired up to Virtual Earth  21 Other ideas for mapping Implementation Issues This session is … a quick tour of  the spatial features of  SQL Server 2008. This session is NOT … An in-depth study of the spatial features of SQL Server 2008 An in-depth explanation of ListView Control An in-depth explanation of Virtual Earth
Overview Tyler’s Article SQL Server Magazine SQLMAG.com  Instant Doc ID  100528 Tyler Chessman's article in SQL Server Magazine's December 2008 issue is my primary source of information to implement my spatial solutions.  Visit sqlmag.com and search for instant doc ID 100528.  I have a link on my blog to the article.
Overview What is Spatial Data? Example of Spatial Data SQL Server’s answer Spatial data represents the shape and physical location of an object.   The object can be a house, business, sub-division, or a county.   SQL Server 2008 has two new data types GEOMETRY and GEOGRAPHY.   GEOMETRY works with flat objects.  GEOGRAPHY considers the shape of the earth.
GEOMETRYGEOGRAPHY	 CLR Data Types No need to enable CLR Many Methods Open Geospatial Consortium GEOGRAPHY and GEOMETRY are CLR data types.  You do not need to have CLR enabled on the SQL Server instance.   Microsoft has provided a long list of OGC methods.   These are methods that are part of the independent  Open Geospatial Consortium list of specifications.
OGC Methods	 OGC  Open Geospatial Consortium SQL Server 2008 supports  the Open Geospatial Consortium (OGC) methods on geometry instances.   These methods  make it very easy to perform  geospatial tasks that were once very difficult. STArea STAsText STBoundary STBuffer STCentroid STContains STConvexHull STCrosses STDifference
OGC Methods	 OGC  Open Geospatial Consortium SQL Server 2008 supports  the Open Geospatial Consortium (OGC) methods on geometry instances.   These methods  make it very easy to perform  geospatial tasks that were once very difficult. STDimension STDisJoint STDistance STEndPoint STEnvelope STEquals STExteriorRing STGeometryN STGeometryType
OGC Methods	 OGC  Open Geospatial Consortium SQL Server 2008 supports  the Open Geospatial Consortium (OGC) methods on geometry instances.   These methods  make it very easy to perform  geospatial tasks that were once very difficult. STInteriorRing STIntersection STIntersects STIsClosed STIsEmpty STIsRing STIsSimple STIsValid STLength
OGC Methods	 OGC  Open Geospatial Consortium SQL Server 2008 supports  the Open Geospatial Consortium (OGC) methods on geometry instances.   These methods  make it very easy to perform  geospatial tasks that were once very difficult. STNumGeometries STNumInteriorRing STNumPoints STOverlaps STPointN STPointOnSurface STIsSimple STRelate STSrid
OGC Methods	 OGC  Open Geospatial Consortium SQL Server 2008 supports  the Open Geospatial Consortium (OGC) methods on geometry instances.   These methods  make it very easy to perform  geospatial tasks that were once very difficult. STStartPoint STSymDifference STTouches STUnion STWithin STX STY
DEMONSTRATION	 List of functions to demonstrate I will demonstrate  STGeomFromText STDistance AsGML STasText STGeometryType STNumPoints.   The demonstration will return a list of stores within a provided distance of a given point.
STDistance STDistance( Point , SRID ) The STDistance function requires an argument of the SQLgeometrytype Convert the latitude and longitude to SQLgeometrytype.  Declare a variable of the geography type.   Set the variable togeography::STGeomFromText('point(lon lat)',4326). Notice that  the point is a string. Notice there is no comma between lat and lon 4326 is an SRID and is used to tell the function what method to use to calculate distance on a not-so-round planet.
SQL Statement Declare @CodeGEOG  geography = geography::STGeomFromText('Point(-95.3410 29.7070)',4326); Select top(5) addr.AddressID as id , addr.addressline1,addr.city, addr.SpatialLocation, -- Will show the raw data addr.SpatialLocation.AsGml() as SpationalGML, addr.SpatialLocation.STAsText() as SpatialText, addr.SpatialLocation.STGeometryType() as GeoType, addr.SpatialLocation.STNumPoints() as Points, addr.SpatialLocation.STDistance(@CodeGEOG) as distance_in_meters, addr.SpatialLocation.STDistance(@CodeGEOG)/1609.344 as distance_in_miles from dbo.Addressaddr Where addr.SpatialLocation.STDistance(@CodeGEOG)/1609.344 < 50   order by distance_in_miles
SSMS A demonstration of running a spatial query DEMO
Into Action A very quick run through Wire-up Spatial Query to List View Control Virtual Earth
List View Control
Virtual Earth
21 Ways John O'Brien of the GEOWebGuru.com has compiled a list of 20 ways to use VirtualEarth.  See it here http://www.geowebguru.com/articles/86-twenty-ways-to-use-the-virtual-earth-platform-as-a-developer-  Visit Weather.com to see this flash and VirtualEarth in actionhttp://www.weather.com/weather/map/interactive/33626?from=36hr_topnav_undeclared  O’Brien lists 20 ways http://maps.live.com http://dev.live.com/virtualearth http://blogs.msdn.com/VirtualEarth3D/ And more I add one more way –  ,[object Object],[object Object]
Conclusion This session was … a quick tour of  the spatial features of  SQL Server 2008. This session was NOT … ,[object Object]
An in-depth explanation of ListView Control
An in-depth explanation of Virtual EarthBackground Overview Spatial in SQL 2008 Creating a spatial Query in SSMS Spatial Query in ListView control Spatial Query wired up to Virtual Earth  21 Ways to implement VE Deployment Issues

Mais conteúdo relacionado

Destaque

Wireless Networking Final Exam Results
Wireless Networking Final Exam ResultsWireless Networking Final Exam Results
Wireless Networking Final Exam ResultsWalmart Super Center
 
Spatial Data in SQL Server
Spatial Data in SQL ServerSpatial Data in SQL Server
Spatial Data in SQL ServerEduardo Castro
 
SQL Server Query Processor
SQL Server Query ProcessorSQL Server Query Processor
SQL Server Query ProcessorEduardo Castro
 
Creating, Maintaining and Executing your Social Media Editorial Calendar
Creating, Maintaining and Executing your Social Media Editorial CalendarCreating, Maintaining and Executing your Social Media Editorial Calendar
Creating, Maintaining and Executing your Social Media Editorial CalendarTrivera Interactive
 
Vistazo a lo nuevo en SQL Server 2016
Vistazo a lo nuevo en SQL Server 2016Vistazo a lo nuevo en SQL Server 2016
Vistazo a lo nuevo en SQL Server 2016Eduardo Castro
 
Servicios cognitivos y su integración
Servicios cognitivos y su integraciónServicios cognitivos y su integración
Servicios cognitivos y su integraciónEduardo Castro
 

Destaque (6)

Wireless Networking Final Exam Results
Wireless Networking Final Exam ResultsWireless Networking Final Exam Results
Wireless Networking Final Exam Results
 
Spatial Data in SQL Server
Spatial Data in SQL ServerSpatial Data in SQL Server
Spatial Data in SQL Server
 
SQL Server Query Processor
SQL Server Query ProcessorSQL Server Query Processor
SQL Server Query Processor
 
Creating, Maintaining and Executing your Social Media Editorial Calendar
Creating, Maintaining and Executing your Social Media Editorial CalendarCreating, Maintaining and Executing your Social Media Editorial Calendar
Creating, Maintaining and Executing your Social Media Editorial Calendar
 
Vistazo a lo nuevo en SQL Server 2016
Vistazo a lo nuevo en SQL Server 2016Vistazo a lo nuevo en SQL Server 2016
Vistazo a lo nuevo en SQL Server 2016
 
Servicios cognitivos y su integración
Servicios cognitivos y su integraciónServicios cognitivos y su integración
Servicios cognitivos y su integración
 

Semelhante a SQL Server 2008 Spatial Geography with VE

Intro To PostGIS
Intro To PostGISIntro To PostGIS
Intro To PostGISmleslie
 
Introduction to Oracle Spatial
Introduction to Oracle SpatialIntroduction to Oracle Spatial
Introduction to Oracle SpatialEhsan Hamzei
 
GeoMesa on Apache Spark SQL with Anthony Fox
GeoMesa on Apache Spark SQL with Anthony FoxGeoMesa on Apache Spark SQL with Anthony Fox
GeoMesa on Apache Spark SQL with Anthony FoxDatabricks
 
Representing and Querying Geospatial Information in the Semantic Web
Representing and Querying Geospatial Information in the Semantic WebRepresenting and Querying Geospatial Information in the Semantic Web
Representing and Querying Geospatial Information in the Semantic WebKostis Kyzirakos
 
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
 
Introduction To PostGIS
Introduction To PostGISIntroduction To PostGIS
Introduction To PostGISmleslie
 
ST-Toolkit, a Framework for Trajectory Data Warehousing
ST-Toolkit, a Framework for Trajectory Data WarehousingST-Toolkit, a Framework for Trajectory Data Warehousing
ST-Toolkit, a Framework for Trajectory Data WarehousingSimone Campora
 
LocationTech Projects
LocationTech ProjectsLocationTech Projects
LocationTech ProjectsJody Garnett
 
Building Scalable Semantic Geospatial RDF Stores
Building Scalable Semantic Geospatial RDF StoresBuilding Scalable Semantic Geospatial RDF Stores
Building Scalable Semantic Geospatial RDF StoresKostis Kyzirakos
 
Postgres Vision 2018: PostGIS and Spatial Extensions
Postgres Vision 2018: PostGIS and Spatial ExtensionsPostgres Vision 2018: PostGIS and Spatial Extensions
Postgres Vision 2018: PostGIS and Spatial ExtensionsEDB
 
Compass Framework
Compass FrameworkCompass Framework
Compass FrameworkLukas Vlcek
 
Collaborate 2009 - Migrating a Data Warehouse from Microsoft SQL Server to Or...
Collaborate 2009 - Migrating a Data Warehouse from Microsoft SQL Server to Or...Collaborate 2009 - Migrating a Data Warehouse from Microsoft SQL Server to Or...
Collaborate 2009 - Migrating a Data Warehouse from Microsoft SQL Server to Or...djkucera
 
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
 

Semelhante a SQL Server 2008 Spatial Geography with VE (20)

Intro To PostGIS
Intro To PostGISIntro To PostGIS
Intro To PostGIS
 
Introduction to Oracle Spatial
Introduction to Oracle SpatialIntroduction to Oracle Spatial
Introduction to Oracle Spatial
 
GeoMesa on Apache Spark SQL with Anthony Fox
GeoMesa on Apache Spark SQL with Anthony FoxGeoMesa on Apache Spark SQL with Anthony Fox
GeoMesa on Apache Spark SQL with Anthony Fox
 
GeoMesa on Spark SQL: Extracting Location Intelligence from Data
GeoMesa on Spark SQL: Extracting Location Intelligence from DataGeoMesa on Spark SQL: Extracting Location Intelligence from Data
GeoMesa on Spark SQL: Extracting Location Intelligence from Data
 
Spatial
SpatialSpatial
Spatial
 
SQL Windowing
SQL WindowingSQL Windowing
SQL Windowing
 
Representing and Querying Geospatial Information in the Semantic Web
Representing and Querying Geospatial Information in the Semantic WebRepresenting and Querying Geospatial Information in the Semantic Web
Representing and Querying Geospatial Information in the Semantic Web
 
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
 
Introduction To PostGIS
Introduction To PostGISIntroduction To PostGIS
Introduction To PostGIS
 
ST-Toolkit, a Framework for Trajectory Data Warehousing
ST-Toolkit, a Framework for Trajectory Data WarehousingST-Toolkit, a Framework for Trajectory Data Warehousing
ST-Toolkit, a Framework for Trajectory Data Warehousing
 
LocationTech Projects
LocationTech ProjectsLocationTech Projects
LocationTech Projects
 
Building Scalable Semantic Geospatial RDF Stores
Building Scalable Semantic Geospatial RDF StoresBuilding Scalable Semantic Geospatial RDF Stores
Building Scalable Semantic Geospatial RDF Stores
 
Postgres Vision 2018: PostGIS and Spatial Extensions
Postgres Vision 2018: PostGIS and Spatial ExtensionsPostgres Vision 2018: PostGIS and Spatial Extensions
Postgres Vision 2018: PostGIS and Spatial Extensions
 
JDBC – Java Database Connectivity
JDBC – Java Database ConnectivityJDBC – Java Database Connectivity
JDBC – Java Database Connectivity
 
Coding Ajax
Coding AjaxCoding Ajax
Coding Ajax
 
Compass Framework
Compass FrameworkCompass Framework
Compass Framework
 
Spatial SQL
Spatial SQLSpatial SQL
Spatial SQL
 
Collaborate 2009 - Migrating a Data Warehouse from Microsoft SQL Server to Or...
Collaborate 2009 - Migrating a Data Warehouse from Microsoft SQL Server to Or...Collaborate 2009 - Migrating a Data Warehouse from Microsoft SQL Server to Or...
Collaborate 2009 - Migrating a Data Warehouse from Microsoft SQL Server to Or...
 
Oracle Spatial
Oracle SpatialOracle Spatial
Oracle 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
 

Último

Unveiling the Soundscape Music for Psychedelic Experiences
Unveiling the Soundscape Music for Psychedelic ExperiencesUnveiling the Soundscape Music for Psychedelic Experiences
Unveiling the Soundscape Music for Psychedelic ExperiencesDoe Paoro
 
Pitch Deck Teardown: Xpanceo's $40M Seed deck
Pitch Deck Teardown: Xpanceo's $40M Seed deckPitch Deck Teardown: Xpanceo's $40M Seed deck
Pitch Deck Teardown: Xpanceo's $40M Seed deckHajeJanKamps
 
NAB Show Exhibitor List 2024 - Exhibitors Data
NAB Show Exhibitor List 2024 - Exhibitors DataNAB Show Exhibitor List 2024 - Exhibitors Data
NAB Show Exhibitor List 2024 - Exhibitors DataExhibitors Data
 
Cyber Security Training in Office Environment
Cyber Security Training in Office EnvironmentCyber Security Training in Office Environment
Cyber Security Training in Office Environmentelijahj01012
 
business environment micro environment macro environment.pptx
business environment micro environment macro environment.pptxbusiness environment micro environment macro environment.pptx
business environment micro environment macro environment.pptxShruti Mittal
 
Jewish Resources in the Family Resource Centre
Jewish Resources in the Family Resource CentreJewish Resources in the Family Resource Centre
Jewish Resources in the Family Resource CentreNZSG
 
20220816-EthicsGrade_Scorecard-JP_Morgan_Chase-Q2-63_57.pdf
20220816-EthicsGrade_Scorecard-JP_Morgan_Chase-Q2-63_57.pdf20220816-EthicsGrade_Scorecard-JP_Morgan_Chase-Q2-63_57.pdf
20220816-EthicsGrade_Scorecard-JP_Morgan_Chase-Q2-63_57.pdfChris Skinner
 
Memorándum de Entendimiento (MoU) entre Codelco y SQM
Memorándum de Entendimiento (MoU) entre Codelco y SQMMemorándum de Entendimiento (MoU) entre Codelco y SQM
Memorándum de Entendimiento (MoU) entre Codelco y SQMVoces Mineras
 
Go for Rakhi Bazaar and Pick the Latest Bhaiya Bhabhi Rakhi.pptx
Go for Rakhi Bazaar and Pick the Latest Bhaiya Bhabhi Rakhi.pptxGo for Rakhi Bazaar and Pick the Latest Bhaiya Bhabhi Rakhi.pptx
Go for Rakhi Bazaar and Pick the Latest Bhaiya Bhabhi Rakhi.pptxRakhi Bazaar
 
Excvation Safety for safety officers reference
Excvation Safety for safety officers referenceExcvation Safety for safety officers reference
Excvation Safety for safety officers referencessuser2c065e
 
GUIDELINES ON USEFUL FORMS IN FREIGHT FORWARDING (F) Danny Diep Toh MBA.pdf
GUIDELINES ON USEFUL FORMS IN FREIGHT FORWARDING (F) Danny Diep Toh MBA.pdfGUIDELINES ON USEFUL FORMS IN FREIGHT FORWARDING (F) Danny Diep Toh MBA.pdf
GUIDELINES ON USEFUL FORMS IN FREIGHT FORWARDING (F) Danny Diep Toh MBA.pdfDanny Diep To
 
Fordham -How effective decision-making is within the IT department - Analysis...
Fordham -How effective decision-making is within the IT department - Analysis...Fordham -How effective decision-making is within the IT department - Analysis...
Fordham -How effective decision-making is within the IT department - Analysis...Peter Ward
 
Supercharge Your eCommerce Stores-acowebs
Supercharge Your eCommerce Stores-acowebsSupercharge Your eCommerce Stores-acowebs
Supercharge Your eCommerce Stores-acowebsGOKUL JS
 
The-Ethical-issues-ghhhhhhhhjof-Byjus.pptx
The-Ethical-issues-ghhhhhhhhjof-Byjus.pptxThe-Ethical-issues-ghhhhhhhhjof-Byjus.pptx
The-Ethical-issues-ghhhhhhhhjof-Byjus.pptxmbikashkanyari
 
Darshan Hiranandani [News About Next CEO].pdf
Darshan Hiranandani [News About Next CEO].pdfDarshan Hiranandani [News About Next CEO].pdf
Darshan Hiranandani [News About Next CEO].pdfShashank Mehta
 
How Generative AI Is Transforming Your Business | Byond Growth Insights | Apr...
How Generative AI Is Transforming Your Business | Byond Growth Insights | Apr...How Generative AI Is Transforming Your Business | Byond Growth Insights | Apr...
How Generative AI Is Transforming Your Business | Byond Growth Insights | Apr...Hector Del Castillo, CPM, CPMM
 
Horngren’s Financial & Managerial Accounting, 7th edition by Miller-Nobles so...
Horngren’s Financial & Managerial Accounting, 7th edition by Miller-Nobles so...Horngren’s Financial & Managerial Accounting, 7th edition by Miller-Nobles so...
Horngren’s Financial & Managerial Accounting, 7th edition by Miller-Nobles so...ssuserf63bd7
 
Entrepreneurship lessons in Philippines
Entrepreneurship lessons in  PhilippinesEntrepreneurship lessons in  Philippines
Entrepreneurship lessons in PhilippinesDavidSamuel525586
 
The McKinsey 7S Framework: A Holistic Approach to Harmonizing All Parts of th...
The McKinsey 7S Framework: A Holistic Approach to Harmonizing All Parts of th...The McKinsey 7S Framework: A Holistic Approach to Harmonizing All Parts of th...
The McKinsey 7S Framework: A Holistic Approach to Harmonizing All Parts of th...Operational Excellence Consulting
 
Planetary and Vedic Yagyas Bring Positive Impacts in Life
Planetary and Vedic Yagyas Bring Positive Impacts in LifePlanetary and Vedic Yagyas Bring Positive Impacts in Life
Planetary and Vedic Yagyas Bring Positive Impacts in LifeBhavana Pujan Kendra
 

Último (20)

Unveiling the Soundscape Music for Psychedelic Experiences
Unveiling the Soundscape Music for Psychedelic ExperiencesUnveiling the Soundscape Music for Psychedelic Experiences
Unveiling the Soundscape Music for Psychedelic Experiences
 
Pitch Deck Teardown: Xpanceo's $40M Seed deck
Pitch Deck Teardown: Xpanceo's $40M Seed deckPitch Deck Teardown: Xpanceo's $40M Seed deck
Pitch Deck Teardown: Xpanceo's $40M Seed deck
 
NAB Show Exhibitor List 2024 - Exhibitors Data
NAB Show Exhibitor List 2024 - Exhibitors DataNAB Show Exhibitor List 2024 - Exhibitors Data
NAB Show Exhibitor List 2024 - Exhibitors Data
 
Cyber Security Training in Office Environment
Cyber Security Training in Office EnvironmentCyber Security Training in Office Environment
Cyber Security Training in Office Environment
 
business environment micro environment macro environment.pptx
business environment micro environment macro environment.pptxbusiness environment micro environment macro environment.pptx
business environment micro environment macro environment.pptx
 
Jewish Resources in the Family Resource Centre
Jewish Resources in the Family Resource CentreJewish Resources in the Family Resource Centre
Jewish Resources in the Family Resource Centre
 
20220816-EthicsGrade_Scorecard-JP_Morgan_Chase-Q2-63_57.pdf
20220816-EthicsGrade_Scorecard-JP_Morgan_Chase-Q2-63_57.pdf20220816-EthicsGrade_Scorecard-JP_Morgan_Chase-Q2-63_57.pdf
20220816-EthicsGrade_Scorecard-JP_Morgan_Chase-Q2-63_57.pdf
 
Memorándum de Entendimiento (MoU) entre Codelco y SQM
Memorándum de Entendimiento (MoU) entre Codelco y SQMMemorándum de Entendimiento (MoU) entre Codelco y SQM
Memorándum de Entendimiento (MoU) entre Codelco y SQM
 
Go for Rakhi Bazaar and Pick the Latest Bhaiya Bhabhi Rakhi.pptx
Go for Rakhi Bazaar and Pick the Latest Bhaiya Bhabhi Rakhi.pptxGo for Rakhi Bazaar and Pick the Latest Bhaiya Bhabhi Rakhi.pptx
Go for Rakhi Bazaar and Pick the Latest Bhaiya Bhabhi Rakhi.pptx
 
Excvation Safety for safety officers reference
Excvation Safety for safety officers referenceExcvation Safety for safety officers reference
Excvation Safety for safety officers reference
 
GUIDELINES ON USEFUL FORMS IN FREIGHT FORWARDING (F) Danny Diep Toh MBA.pdf
GUIDELINES ON USEFUL FORMS IN FREIGHT FORWARDING (F) Danny Diep Toh MBA.pdfGUIDELINES ON USEFUL FORMS IN FREIGHT FORWARDING (F) Danny Diep Toh MBA.pdf
GUIDELINES ON USEFUL FORMS IN FREIGHT FORWARDING (F) Danny Diep Toh MBA.pdf
 
Fordham -How effective decision-making is within the IT department - Analysis...
Fordham -How effective decision-making is within the IT department - Analysis...Fordham -How effective decision-making is within the IT department - Analysis...
Fordham -How effective decision-making is within the IT department - Analysis...
 
Supercharge Your eCommerce Stores-acowebs
Supercharge Your eCommerce Stores-acowebsSupercharge Your eCommerce Stores-acowebs
Supercharge Your eCommerce Stores-acowebs
 
The-Ethical-issues-ghhhhhhhhjof-Byjus.pptx
The-Ethical-issues-ghhhhhhhhjof-Byjus.pptxThe-Ethical-issues-ghhhhhhhhjof-Byjus.pptx
The-Ethical-issues-ghhhhhhhhjof-Byjus.pptx
 
Darshan Hiranandani [News About Next CEO].pdf
Darshan Hiranandani [News About Next CEO].pdfDarshan Hiranandani [News About Next CEO].pdf
Darshan Hiranandani [News About Next CEO].pdf
 
How Generative AI Is Transforming Your Business | Byond Growth Insights | Apr...
How Generative AI Is Transforming Your Business | Byond Growth Insights | Apr...How Generative AI Is Transforming Your Business | Byond Growth Insights | Apr...
How Generative AI Is Transforming Your Business | Byond Growth Insights | Apr...
 
Horngren’s Financial & Managerial Accounting, 7th edition by Miller-Nobles so...
Horngren’s Financial & Managerial Accounting, 7th edition by Miller-Nobles so...Horngren’s Financial & Managerial Accounting, 7th edition by Miller-Nobles so...
Horngren’s Financial & Managerial Accounting, 7th edition by Miller-Nobles so...
 
Entrepreneurship lessons in Philippines
Entrepreneurship lessons in  PhilippinesEntrepreneurship lessons in  Philippines
Entrepreneurship lessons in Philippines
 
The McKinsey 7S Framework: A Holistic Approach to Harmonizing All Parts of th...
The McKinsey 7S Framework: A Holistic Approach to Harmonizing All Parts of th...The McKinsey 7S Framework: A Holistic Approach to Harmonizing All Parts of th...
The McKinsey 7S Framework: A Holistic Approach to Harmonizing All Parts of th...
 
Planetary and Vedic Yagyas Bring Positive Impacts in Life
Planetary and Vedic Yagyas Bring Positive Impacts in LifePlanetary and Vedic Yagyas Bring Positive Impacts in Life
Planetary and Vedic Yagyas Bring Positive Impacts in Life
 

SQL Server 2008 Spatial Geography with VE

  • 1. SQL Server 2008 Spatial Geography Implemented in ASP.net and Virtual Earth Michael Stark StarkNetwork.com Michael@starknetwork.com blog.starknetwork.com
  • 2. Outline Background Overview Spatial in SQL 2008 Creating a spatial Query in SSMS Spatial Query in ListView control Spatial Query wired up to Virtual Earth 21 Other ideas for mapping Implementation Issues This session is … a quick tour of the spatial features of SQL Server 2008. This session is NOT … An in-depth study of the spatial features of SQL Server 2008 An in-depth explanation of ListView Control An in-depth explanation of Virtual Earth
  • 3. Overview Tyler’s Article SQL Server Magazine SQLMAG.com Instant Doc ID 100528 Tyler Chessman's article in SQL Server Magazine's December 2008 issue is my primary source of information to implement my spatial solutions. Visit sqlmag.com and search for instant doc ID 100528. I have a link on my blog to the article.
  • 4. Overview What is Spatial Data? Example of Spatial Data SQL Server’s answer Spatial data represents the shape and physical location of an object. The object can be a house, business, sub-division, or a county. SQL Server 2008 has two new data types GEOMETRY and GEOGRAPHY. GEOMETRY works with flat objects. GEOGRAPHY considers the shape of the earth.
  • 5. GEOMETRYGEOGRAPHY CLR Data Types No need to enable CLR Many Methods Open Geospatial Consortium GEOGRAPHY and GEOMETRY are CLR data types. You do not need to have CLR enabled on the SQL Server instance. Microsoft has provided a long list of OGC methods. These are methods that are part of the independent Open Geospatial Consortium list of specifications.
  • 6. OGC Methods OGC Open Geospatial Consortium SQL Server 2008 supports the Open Geospatial Consortium (OGC) methods on geometry instances. These methods make it very easy to perform geospatial tasks that were once very difficult. STArea STAsText STBoundary STBuffer STCentroid STContains STConvexHull STCrosses STDifference
  • 7. OGC Methods OGC Open Geospatial Consortium SQL Server 2008 supports the Open Geospatial Consortium (OGC) methods on geometry instances. These methods make it very easy to perform geospatial tasks that were once very difficult. STDimension STDisJoint STDistance STEndPoint STEnvelope STEquals STExteriorRing STGeometryN STGeometryType
  • 8. OGC Methods OGC Open Geospatial Consortium SQL Server 2008 supports the Open Geospatial Consortium (OGC) methods on geometry instances. These methods make it very easy to perform geospatial tasks that were once very difficult. STInteriorRing STIntersection STIntersects STIsClosed STIsEmpty STIsRing STIsSimple STIsValid STLength
  • 9. OGC Methods OGC Open Geospatial Consortium SQL Server 2008 supports the Open Geospatial Consortium (OGC) methods on geometry instances. These methods make it very easy to perform geospatial tasks that were once very difficult. STNumGeometries STNumInteriorRing STNumPoints STOverlaps STPointN STPointOnSurface STIsSimple STRelate STSrid
  • 10. OGC Methods OGC Open Geospatial Consortium SQL Server 2008 supports the Open Geospatial Consortium (OGC) methods on geometry instances. These methods make it very easy to perform geospatial tasks that were once very difficult. STStartPoint STSymDifference STTouches STUnion STWithin STX STY
  • 11. DEMONSTRATION List of functions to demonstrate I will demonstrate STGeomFromText STDistance AsGML STasText STGeometryType STNumPoints. The demonstration will return a list of stores within a provided distance of a given point.
  • 12. STDistance STDistance( Point , SRID ) The STDistance function requires an argument of the SQLgeometrytype Convert the latitude and longitude to SQLgeometrytype. Declare a variable of the geography type. Set the variable togeography::STGeomFromText('point(lon lat)',4326). Notice that the point is a string. Notice there is no comma between lat and lon 4326 is an SRID and is used to tell the function what method to use to calculate distance on a not-so-round planet.
  • 13. SQL Statement Declare @CodeGEOG geography = geography::STGeomFromText('Point(-95.3410 29.7070)',4326); Select top(5) addr.AddressID as id , addr.addressline1,addr.city, addr.SpatialLocation, -- Will show the raw data addr.SpatialLocation.AsGml() as SpationalGML, addr.SpatialLocation.STAsText() as SpatialText, addr.SpatialLocation.STGeometryType() as GeoType, addr.SpatialLocation.STNumPoints() as Points, addr.SpatialLocation.STDistance(@CodeGEOG) as distance_in_meters, addr.SpatialLocation.STDistance(@CodeGEOG)/1609.344 as distance_in_miles from dbo.Addressaddr Where addr.SpatialLocation.STDistance(@CodeGEOG)/1609.344 < 50 order by distance_in_miles
  • 14. SSMS A demonstration of running a spatial query DEMO
  • 15. Into Action A very quick run through Wire-up Spatial Query to List View Control Virtual Earth
  • 18.
  • 19.
  • 20. An in-depth explanation of ListView Control
  • 21. An in-depth explanation of Virtual EarthBackground Overview Spatial in SQL 2008 Creating a spatial Query in SSMS Spatial Query in ListView control Spatial Query wired up to Virtual Earth 21 Ways to implement VE Deployment Issues
  • 22. SQL Server 2008 Spatial Geography Implemented in ASP.net and Virtual Earth Michael Stark StarkNetwork.com Michael@starknetwork.com http://blog.starknetwork.com