SQL Server 2008<br />Spatial  Geography <br />Implemented in ASP.net and Virtual Earth <br />Michael Stark<br />StarkNetwo...
Outline<br />Background<br />Overview Spatial in SQL 2008<br />Creating a spatial Query in SSMS<br />Spatial Query in List...
Overview<br />Tyler’s Article<br />SQL Server Magazine<br />SQLMAG.com <br />Instant Doc ID  100528<br />Tyler Chessman&ap...
Overview<br />What is Spatial Data?<br />Example of Spatial Data<br />SQL Server’s answer<br />Spatial data represents the...
GEOMETRYGEOGRAPHY	<br />CLR Data Types<br />No need to enable CLR<br />Many Methods<br />Open Geospatial Consortium<br />G...
OGC Methods	<br />OGC <br />Open Geospatial Consortium<br />SQL Server 2008 supports  the Open Geospatial Consortium (OGC)...
OGC Methods	<br />OGC <br />Open Geospatial Consortium<br />SQL Server 2008 supports  the Open Geospatial Consortium (OGC)...
OGC Methods	<br />OGC <br />Open Geospatial Consortium<br />SQL Server 2008 supports  the Open Geospatial Consortium (OGC)...
OGC Methods	<br />OGC <br />Open Geospatial Consortium<br />SQL Server 2008 supports  the Open Geospatial Consortium (OGC)...
OGC Methods	<br />OGC <br />Open Geospatial Consortium<br />SQL Server 2008 supports  the Open Geospatial Consortium (OGC)...
DEMONSTRATION	<br />List of functions to demonstrate<br />I will demonstrate <br />STGeomFromText<br />STDistance<br />AsG...
STDistance<br />STDistance( Point , SRID )<br />The STDistance function requires an argument of the SQLgeometrytype<br />C...
SQL Statement<br />Declare @CodeGEOG  geography = geography::STGeomFromText(&apos;Point(-95.3410 29.7070)&apos;,4326);<br ...
SSMS<br />A demonstration of running a spatial query<br />DEMO<br />
Into Action<br />A very quick run through<br />Wire-up Spatial Query to<br />List View Control<br />Virtual Earth<br />
List View Control<br />
Virtual Earth<br />
21 Ways<br />John O&apos;Brien of the GEOWebGuru.com has compiled a list of 20 ways to use VirtualEarth.  See it here http...
Conclusion<br />This session was …<br />a quick tour of  the spatial features of  SQL Server 2008.<br />This session was N...
An in-depth explanation of ListView Control
An in-depth explanation of Virtual Earth</li></ul>Background<br />Overview Spatial in SQL 2008<br />Creating a spatial Que...
Upcoming SlideShare
Loading in...5
×

Sql Saturday Spatial Data Ss2008 Michael Stark Copy

620

Published on

Spatial Data in SQL server 2008 and Bing Maps

Published in: Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
620
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
12
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Sql Saturday Spatial Data Ss2008 Michael Stark Copy

  1. 1. SQL Server 2008<br />Spatial Geography <br />Implemented in ASP.net and Virtual Earth <br />Michael Stark<br />StarkNetwork.com<br />Michael@starknetwork.com<br />blog.starknetwork.com<br />
  2. 2. Outline<br />Background<br />Overview Spatial in SQL 2008<br />Creating a spatial Query in SSMS<br />Spatial Query in ListView control<br />Spatial Query wired up to Virtual Earth <br />21 Other ideas for mapping<br />Implementation Issues<br />This session is …<br />a quick tour of the spatial features of SQL Server 2008.<br />This session is NOT …<br />An in-depth study of the spatial features of SQL Server 2008<br />An in-depth explanation of ListView Control<br />An in-depth explanation of Virtual Earth<br />
  3. 3. Overview<br />Tyler’s Article<br />SQL Server Magazine<br />SQLMAG.com <br />Instant Doc ID 100528<br />Tyler Chessman&apos;s article in SQL Server Magazine&apos;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.<br />
  4. 4. Overview<br />What is Spatial Data?<br />Example of Spatial Data<br />SQL Server’s answer<br />Spatial data represents the shape and physical location of an object. <br />The object can be a house, business, sub-division, or a county. <br />SQL Server 2008 has two new data types GEOMETRY and GEOGRAPHY. <br />GEOMETRY works with flat objects. <br />GEOGRAPHY considers the shape of the earth.<br />
  5. 5. GEOMETRYGEOGRAPHY <br />CLR Data Types<br />No need to enable CLR<br />Many Methods<br />Open Geospatial Consortium<br />GEOGRAPHY and GEOMETRY are CLR data types. <br />You do not need to have CLR enabled on the SQL Server instance. <br />Microsoft has provided a long list of OGC methods. <br />These are methods that are part of the independent Open Geospatial Consortium list of specifications.<br />
  6. 6. OGC Methods <br />OGC <br />Open Geospatial Consortium<br />SQL Server 2008 supports the Open Geospatial Consortium (OGC) methods on geometry instances. <br />These methods make it very easy to perform geospatial tasks that were once very difficult.<br />STArea<br />STAsText<br />STBoundary<br />STBuffer<br />STCentroid<br />STContains<br />STConvexHull<br />STCrosses<br />STDifference<br />
  7. 7. OGC Methods <br />OGC <br />Open Geospatial Consortium<br />SQL Server 2008 supports the Open Geospatial Consortium (OGC) methods on geometry instances. <br />These methods make it very easy to perform geospatial tasks that were once very difficult.<br />STDimension<br />STDisJoint<br />STDistance<br />STEndPoint<br />STEnvelope<br />STEquals<br />STExteriorRing<br />STGeometryN<br />STGeometryType<br />
  8. 8. OGC Methods <br />OGC <br />Open Geospatial Consortium<br />SQL Server 2008 supports the Open Geospatial Consortium (OGC) methods on geometry instances. <br />These methods make it very easy to perform geospatial tasks that were once very difficult.<br />STInteriorRing<br />STIntersection<br />STIntersects<br />STIsClosed<br />STIsEmpty<br />STIsRing<br />STIsSimple<br />STIsValid<br />STLength<br />
  9. 9. OGC Methods <br />OGC <br />Open Geospatial Consortium<br />SQL Server 2008 supports the Open Geospatial Consortium (OGC) methods on geometry instances. <br />These methods make it very easy to perform geospatial tasks that were once very difficult.<br />STNumGeometries<br />STNumInteriorRing<br />STNumPoints<br />STOverlaps<br />STPointN<br />STPointOnSurface<br />STIsSimple<br />STRelate<br />STSrid<br />
  10. 10. OGC Methods <br />OGC <br />Open Geospatial Consortium<br />SQL Server 2008 supports the Open Geospatial Consortium (OGC) methods on geometry instances. <br />These methods make it very easy to perform geospatial tasks that were once very difficult.<br />STStartPoint<br />STSymDifference<br />STTouches<br />STUnion<br />STWithin<br />STX<br />STY<br />
  11. 11. DEMONSTRATION <br />List of functions to demonstrate<br />I will demonstrate <br />STGeomFromText<br />STDistance<br />AsGML<br />STasText<br />STGeometryType<br />STNumPoints. <br />The demonstration will return a list of stores within a provided distance of a given point.<br />
  12. 12. STDistance<br />STDistance( Point , SRID )<br />The STDistance function requires an argument of the SQLgeometrytype<br />Convert the latitude and longitude to SQLgeometrytype.<br /> Declare a variable of the geography type. <br />Set the variable togeography::STGeomFromText(&apos;point(lon lat)&apos;,4326).<br />Notice that the point is a string.<br />Notice there is no comma between lat and lon<br />4326 is an SRID and is used to tell the function what method to use to calculate distance on a not-so-round planet.<br />
  13. 13. SQL Statement<br />Declare @CodeGEOG geography = geography::STGeomFromText(&apos;Point(-95.3410 29.7070)&apos;,4326);<br />Select top(5) addr.AddressID as id ,<br />addr.addressline1,addr.city,<br />addr.SpatialLocation, -- Will show the raw data<br />addr.SpatialLocation.AsGml() as SpationalGML,<br />addr.SpatialLocation.STAsText() as SpatialText,<br />addr.SpatialLocation.STGeometryType() as GeoType,<br />addr.SpatialLocation.STNumPoints() as Points,<br />addr.SpatialLocation.STDistance(@CodeGEOG) as distance_in_meters,<br />addr.SpatialLocation.STDistance(@CodeGEOG)/1609.344 as distance_in_miles<br />from dbo.Addressaddr<br />Where<br />addr.SpatialLocation.STDistance(@CodeGEOG)/1609.344 &lt; 50 <br />order by distance_in_miles<br />
  14. 14. SSMS<br />A demonstration of running a spatial query<br />DEMO<br />
  15. 15. Into Action<br />A very quick run through<br />Wire-up Spatial Query to<br />List View Control<br />Virtual Earth<br />
  16. 16. List View Control<br />
  17. 17. Virtual Earth<br />
  18. 18. 21 Ways<br />John O&apos;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- <br />Visit Weather.com to see this flash and VirtualEarth in actionhttp://www.weather.com/weather/map/interactive/33626?from=36hr_topnav_undeclared <br />O’Brien lists 20 ways<br />http://maps.live.com<br />http://dev.live.com/virtualearth<br />http://blogs.msdn.com/VirtualEarth3D/<br />And more<br />I add one more way – <br /><ul><li>Weather .com</li></li></ul><li>ImplementationIssues<br />You will find that the VE and Handler implementation returns a File Not Found Error when deployed to a web server.<br />In IIS6 you right click on your App, go to properties, click Virtual Directory Tab, Configuration, Mapping Tab, Add, point the Executable to c:windowsmicrosoft.netframeworkv2.0.50727aspnet_isapi.dll and add the appropriate Extension (&quot;georss&quot;) . <br />VE Implementation works fine in development<br />Returns File Not Found when deployed to IIS<br />
  19. 19. Conclusion<br />This session was …<br />a quick tour of the spatial features of SQL Server 2008.<br />This session was NOT …<br /><ul><li>An in-depth study of the spatial features of SQL Server 2008
  20. 20. An in-depth explanation of ListView Control
  21. 21. An in-depth explanation of Virtual Earth</li></ul>Background<br />Overview Spatial in SQL 2008<br />Creating a spatial Query in SSMS<br />Spatial Query in ListView control<br />Spatial Query wired up to Virtual Earth <br />21 Ways to implement VE<br />Deployment Issues<br />
  22. 22. SQL Server 2008<br />Spatial Geography <br />Implemented in ASP.net and Virtual Earth <br />Michael Stark<br />StarkNetwork.com<br />Michael@starknetwork.com<br />http://blog.starknetwork.com <br />
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×