Draggable Routes Demo – Bing Maps API – Windows Azure

Bing Maps API – Draggable Routes Demo

Bing Maps Draggable Route
Routes can now be made draggable

“Many people like the drag-able routes in the consumer facing implementation of Bing Maps. This feature basically allows you to mouse over a route-path and drag a point to a location that you want to drive past. “

Bing Maps Dragged Route
Dragged Route – Auto re-calculation of the route.

Multi-waypoint routing in Bing Maps. You can have up to 25 waypoints, 27 including start point, an endpoint and up to 25 points in between within a single route-calculation. When the route is dragged the API re-calculates the route and basically adds an additional waypoint into the route.

Draggable Routes Bing Maps Demo
http://talkingdonkey.cloudapp.net/BM-AJ-Drag-able-Route/Default.htm

Source with Code with thanks to Johannes Kebeck
http://johanneskebeck.spaces.live.com/blog/cns!42E1F70205EC8A96!12519.entry

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

Bing Maps REST Services now supports transit routes!

The Bing Maps REST Services has added a transit travel mode so you can get transit routes and even display a transit route on a static map in your application.  All you need to know is  where you want to go and what time of day and then the REST Services will return a transit route based on your request.  To get a transit route, use the existing URL for getting a route and specify the travel mode as Transit. Then set the new dateTime parameter to a time value and set the timeType parameter to  departure, arrival or lastAvailable and let the Bing Maps REST Services do the work. Transit route steps can include walking instructions as well as transit information.

To see how this works, check out these examples:

(Note: To use each of these URLs,  you must set the key parameter to a valid Bing Maps Key. For information about getting a Bing Maps Key, see Getting a Bing Maps Key.)

Example #1: Get transit route information

What if you’d like to take transit from the Space Needle in Seattle to the Bellevue Square Mall in Bellevue at 3 PM in the afternoon today. Here’s the URL that will tell you how.

http://dev.virtualearth.net/REST/V1/Routes/Transit?wp.0=Space%20Needle&wp.1=Bellevue Square Mall&timeType=Departure&dateTime=3:00:00 PM&output=xml&key=YourBingMapsKey

Example #2: See a transit route on a static map

You can also view the route on a static map and zoom in to see details at the start and end of the route.

http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/Routes/Transit?timeType=Departure&dateTime=3:00:00 PM &wp.0=Space Needle&wp.1=Bellevue  Square Mall&mapVersion=v1&key=YourBingMapsKey

Example #3: Walking to the bus stop from Seattle Center

Note that a walking segment is displayed as a dotted line.

http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/47.620495,-122.34931/15/Routes/Transit?timeType=Departure&dateTime=3:00:00 PM &wp.0=Space Needle&wp.1=Bellevue  Square Mall&mapVersion=v1&key=YourBingMapsKey

Example #4: Walking to Bellevue Square Mall from the bus stop

http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/47.615635,-122.20435/15/Routes/Transit?timeType=Departure&dateTime=3:00:00 PM &wp.0=Space Needle&wp.1=Bellevue Square Mall&mapVersion=v1&key=YourBingMapsKey

Details on MSDN

This new feature is part of the Bing Maps REST Services. For details about how to get transit route information and how to display a route on a static map see the Calculate a Route and Get a Static Map topics on MSDN.