FindNearRoute with Virtual Earth 6.1 and SQL Server 2008

Johannes Kebeck's Blog
05-01-2008, 09:50 AM
<p>Just last night we released a minor update to Virtual Earth. Besides the fact that we can now generate the tokens for the <a href="http://msdn.microsoft.com/en-us/library/bb924353.aspx">Customer Identification</a> and thus the transaction counting not only in the production- but also in the development environment we return now the complete <a href="http://msdn.microsoft.com/en-us/library/cc470011.aspx">route-geometry</a> when you calculate a route. This feature is considered to be a 'premium feature' and is only available to enterprise customers who use the <a href="http://msdn.microsoft.com/en-us/library/bb924353.aspx">customer identification</a>.* <p>Having access to the route-geometry allows us for instance to have multiple routes on a map... <p><a href="http://blufiles.storage.msn.com/y1pLfDzppuxashKauNSUqVkCsDs4jrhErQQ1I8da5T86hGTTy1 zwzV3QFtvnAmpriaWAGL-SPE7pUw?PARTNER=WRITER"><img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px" height=416 alt=image src="http://eayyzw.blu.livefilestore.com/y1psLOdC392akqF2dUWkwZxyxPN43xymrqzxZYP9pz-prehlXuQ_oAAea2JfWltgPcUP8lk_RoBUxFszu3cXARnQg?PAR TNER=WRITER" width=644 border=0></a> <p>...or together with a spatial-enabled database such as SQL Server 2008 to implement a feature which returns points of interest in a buffer around a route. Let's have a look at the latter. <h4>Introduction</h4> <p>While we do have a FindNearRoute-feature in MapPoint Web Service (MWS) there is no such thing in Virtual Earth (VE) yet. To use this feature in MWS all the Points of Interest (POI) have to uploaded to a so called Custom Data Store (CDS) and then the calculation is done directly within the Microsoft Data Centres. <p>Since SQL Server 2008 has many build-in spatial functions and since Virtual Earth version 6.1 exposes now the complete geometry of the route we can build such a feature ourselves. <p>In previous postings I have introduced SQL Server 2008 and its integration with Virtual Earth so I won't go into the details here. <ul> <li><a href="http://johanneskebeck.spaces.live.com/blog/cns!42E1F70205EC8A96!3529.entry">Virtual Earth & SQL Server 2008 - Part 1: Introduction (1/2)</a> <li><a href="http://johanneskebeck.spaces.live.com/blog/cns!42E1F70205EC8A96!3534.entry">Virtual Earth & SQL Server 2008 - Part 1: Introduction (2/2)</a> <li><a href="http://johanneskebeck.spaces.live.com/blog/cns!42E1F70205EC8A96!3541.entry">Virtual Earth & SQL Server 2008 - Part 2: Spatial Data Management in SQL Server 2008 (1/3)</a> <li><a href="http://johanneskebeck.spaces.live.com/blog/cns!42E1F70205EC8A96!3574.entry">Virtual Earth & SQL Server 2008 - Part 2: Spatial Data Management in SQL Server 2008 (2/3)</a> <li><a href="http://johanneskebeck.spaces.live.com/blog/cns!42E1F70205EC8A96!3589.entry">Virtual Earth & SQL Server 2008 - Part 2: Spatial Data Management in SQL Server 2008 (3/3)</a> <li><a href="http://johanneskebeck.spaces.live.com/blog/cns!42E1F70205EC8A96!3601.entry">Virtual Earth & SQL Server 2008 - Part 3: Getting Started with Virtual Earth</a> <li><a href="http://johanneskebeck.spaces.live.com/blog/cns!42E1F70205EC8A96!3615.entry">Virtual Earth & SQL Server 2008 - Part 4: Integrating SQL Server 2008 and Virtual Earth (1/6)</a> <li><a href="http://johanneskebeck.spaces.live.com/blog/cns!42E1F70205EC8A96!3626.entry">Virtual Earth & SQL Server 2008 - Part 4: Integrating SQL Server 2008 and Virtual Earth (2/6)</a> <li><a href="http://johanneskebeck.spaces.live.com/blog/cns!42E1F70205EC8A96!3631.entry">Virtual Earth & SQL Server 2008 - Part 4: Integrating SQL Server 2008 and Virtual Earth (3/6)</a> <li><a href="http://johanneskebeck.spaces.live.com/blog/cns!42E1F70205EC8A96!3642.entry">Virtual Earth & SQL Server 2008 - Part 4: Integrating SQL Server 2008 and Virtual Earth (4/6)</a> <li><a href="http://johanneskebeck.spaces.live.com/blog/cns!42E1F70205EC8A96!3692.entry">Virtual Earth & SQL Server 2008 - Part 4: Integrating SQL Server 2008 and Virtual Earth (5/6)</a> <li><a href="http://johanneskebeck.spaces.live.com/blog/cns!42E1F70205EC8A96!3704.entry">Virtual Earth & SQL Server 2008 - Part 4: Integrating SQL Server 2008 and Virtual Earth (6/6)</a> <li><a href="http://johanneskebeck.spaces.live.com/blog/cns!42E1F70205EC8A96!3705.entry">Virtual Earth & SQL Server 2008 - Part 5: Conclusion</a></ul> <h4>Concept</h4> <p>The idea is to calculate the route with the VEMap.GetDirections-method. The VERoute-object which is returned will have several properties. One of these is the ShapePoints, basically an array of latitudes and longitudes. We will process this array and convert it into Well Known Text (WKT) of type LINESTRING which can later be used for the spatial-relationship query within SQL Server 2008. The WKT is then send along with the size of the buffer via AJAX-call to a web handler. The web handler executes now a stored procedure which calculates a buffer around our route and thereafter determines all POI within this buffer. The result will be processed through a string builder and returned to the client as JavaScript.


Click here to view the complete article. (http://JohannesKebeck.spaces.live.com/Blog/cns!42E1F70205EC8A96!4504.entry)


<div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px">Technorati Tags: <a href="http://technorati.com/tags/Virtual Earth" rel=tag>Virtual Earth</a>,<a href="http://technorati.com/tags/SQL Server 2008" rel=tag>SQL Server 2008</a>,<a href="http://technorati.com/tags/FindNearRoute" rel=tag>FindNearRoute</a></div><img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=4819404664324524694&page=RSS%3a+FindNearRoute+with+Virtual+Earth+6.1+a nd+SQL+Server+2008&referrer=" width="1px" height="1px" border="0" alt=""><img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&NA=1149&PI=73329&RF=&DI=3919&PS=85545&TP=johanneskebeck.spaces.live.com&GT1=JohannesKebeck">

Click here to view the article. (http://JohannesKebeck.spaces.live.com/Blog/cns!42E1F70205EC8A96!4504.entry)

 
Web mp2kmag.com
mapforums.com