Tuesday, 29 June 2010

Azure SQL 2008 - Bing Maps - Near Route Demo

Azure SQL 2008 - Bing Maps - Near Route Demo

After the announcement http://bingmapswatch.blogspot.com/2010/03/bing-maps-sql-azure-support-april-2010.html that Azure SQL 2008 was implmenting Spatial Support (Geography and Geometry) this now enabled.

This is an example of combining, Windows Azuew, SQL Azure, Silverlight and Bing Maps to produce a find along a route example

Windows Azure SQL 2008 Bing Maps Find Near a Route
Finding Petrol (Gas) Stations along a route (Boston to Chicago) within 1km (1000m) of the route.

The code inside Azure SQL 2008 doing this is

@myGEOM is the lat and lng (x1,y2)+(x2,y2) start and end points for the route
@myBuffer is the buffer distance (1000m default)
@myRoute is the (xy,xy,xy,xy) of the enitre route creating a polyline
This polyline is then buffered creating a polygon (area) around the route.
SQL 2008 Azure then uses Geoproccessing 'Buffer' and 'Intersect' to pull-out
any points (gas stations in this example) and then displays the points as markers
on bing maps

code:
 CREATE PROCEDURE [FindNearRoute] @myGEOM nvarchar(MAX), @myBuffer int
AS
--Create the Buffer
DECLARE @myRoute geography;
SET @myRoute = @myGEOM;

DECLARE @SearchArea geography;
SET @SearchArea = @myRoute.STBuffer(@myBuffer);

--Return all POI in the search area
SELECT Lat, Lon, Name
FROM PetrolStations
WHERE (@SearchArea.STIntersects(GEOM)) = 1


Live Example (Silverlight required)
http://talkingdonkey.cloudapp.net/BM-SL-FindNearRoute/Default.htm

There is also a zip file (BM-FindNearRoute.zip) with all the source code required to create your own find near a route example.

Source
http://johanneskebeck.spaces.live.com/blog/cns!42E1F70205EC8A96!12533.entry

19 comments:

  1. Really appreciate this post. It’s hard to sort the good from the bad sometimes, but I think you’ve nailed it!
    area codes

    ReplyDelete
  2. Your blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing.
    Furniture Manufacturer in India

    ReplyDelete
  3. I can’t remember the last time I enjoyed an article as a lot as this one. You have gone beyond my expectations on this subject and I agree together with your points. You’ve done nicely with this…. mens breeches

    ReplyDelete
  4. It is remarkable, it is rather valuable phrase

    Buy Saree Online

    ReplyDelete
  5. Apple now has Rhapsody as an app, which is a great start, but it is currently hampered by the inability to store locally on your iPod, and has a dismal 64kbps bit rate. Indian Mens traditional sherwani

    ReplyDelete
  6. Really appreciate this post. It’s hard to sort the good from the bad sometimes. Each & every tips of your post are awesome.
    Hard Disk Data Recovery

    ReplyDelete
  7. I enjoyed an article as a lot as this one. You have gone beyond my expectations on this subject and I agree together with your points. You’ve done nicely with this

    ReplyDelete
  8. I enjoyed an article It’s hard to sort the good from the bad sometimes.I agree together with your points. You’ve done nicely with this…
    Toshiba Hard Drive Data Recovery

    ReplyDelete
  9. Excellent tips. Really useful stuff .Never had an idea about this, will look for more of such informative posts from your side.. Good job...Keep it up Furniture Stores

    ReplyDelete
  10. Hi, Thanks for your great post, there are much nice information that I am sure a huge number of guys and gals don’t know. Commodity Tips

    ReplyDelete
  11. I am very much pleased with the contents you have mentioned. I wanted to thank you for this great article. I enjoyed every little bit part of it and I will be waiting for the new updates. Stock Tips

    ReplyDelete
  12. Very nice and helpful information has been given in this article. I like the way you explain the things. Keep posting. Thanks.. intraday tips

    ReplyDelete
  13. Thank you for such a fantastic blog. Where else could anyone get that kind of info written in such a perfect way? I have a presentation that I am presently working on, and I have been on the lookout for such information. Forex tips

    ReplyDelete
  14. Excellent tips. Really useful stuff .Never had an idea about this, will look for more of such informative posts from your side.. Good job...Keep it up
    Safeguard your Important Data

    ReplyDelete
  15. I can’t remember the last time I enjoyed an article as a lot as this one. You have gone beyond my expectations on this subject and I agree together with your points. You’ve done nicely with this….
    data recovery software

    ReplyDelete
  16. Excellent tips. Really useful stuff .Never had an idea about this, will look for more of such informative posts from your side.. Good job...Keep it up
    The Process To Recover The Data From Crashed Hard Drive

    ReplyDelete
  17. Really appreciate this post. It’s hard to sort the good from the bad sometimes, but I think you’ve nailed it! Mens partywear suits

    ReplyDelete
  18. BigProfitbuzz is an Indian stock market advisory firm. BigProfitbuzz proven month after month that trading and investing in stock market can be profitable whether market is bull or bear. As said last time we made a buy position in NIFTY around 6100-6150 we booked the profit around 6400. All our paid clients made a very good profit. Now for the comingNSE, STOCK TIPS week we suggest all the traders to make a sell position in NIFTY around 6450-6500 with stoploss of 6600 for the target 6250-6100. We know these levels are high but we are very much sure that this is the very safe level to trade. So wait for the level to take your position in the market. Traders can also make sell position in NIFTY 50 stocks according to the level of NIFTY. If want good calls in the market then fill our trial form & get them. We believe in Low risk for sufficient profit.
    Regards
    BIGPROFITBUZZ TEAM

    ReplyDelete