Two New Data Modules for Bing Maps V7

 

By Ricky Brundritt, EMEA Bing Maps Technology Solution Professional

In September of 2011 we started the Bing Maps v7 Module CodePlex Project. The purpose of this project is to create a centralized location where developers could find and share useful modules that expand the functionality of the Bing Maps V7 API. Since the start of the project, we’ve had 15 modules submitted.

Today, I would like to highlight the two newest modules added to the project and provide a few updates to existing modules.

GeoJSON Module

Download here

This module was created by Brian Norman a Microsoft Bing Maps MVP from Earthware Ltd.

This module allows you to import GeoJSON files into Bing Maps. A GeoJSON feed will be downloaded and parsed into an EntityCollection which can then be added to the map. Additional properties are captured and stored in a Metadata tag on each shape making it easy to relate shapes to their metadata.

GeoJSON is a data format standard used for representing geospatial objects in JSON (JavaScript Object notation). JSON is much more compact than XML which makes it a great format for sharing spatial data online. In fact the AJAX Map DataConnector uses GeoJSON to send spatial data from SQL Server to Bing Maps.

Well Known Text Reader/Writer Module

Download here

I created this module because I wanted a simple tool for quickly visualizing Well Known Text on Bing Maps. This module allows you to easily read and write Well Know Text data from Bing Maps. When reading Well Known Text data it is parsed into Bing Maps shapes; MultiPoint, MultiLinstring, MultiPolygon and GeometryCollection are turned into an EntityCollection of shapes. To write Well Known Text simply pass in a Bing Maps shape and the Well Known Text equivalent will be returned.

clip_image004

Well Known Text (WKT) is an OGC (Open Geospatial Consortium) standard for representing Geospatial Data. In fact WKT is supported by the spatial types in Microsoft SQL Server 2008 and above as well as SQL Azure.

*Project Idea: Combine this module with the Shape Toolbox Module and make it easy for your users to draw on the map and upload the shape data into Microsoft SQL Server.

*Demo Tip: Use this module to quickly create demos that render complex spatial data. Simply store your Well Known Text in a JavaScript file as a string to save time setting up a web service to connect to your database. Note: this approach is not recommended for production applications as loading all the spatial data via a JavaScript file can make for slow loading of your application.

Other Data Related Modules

GeoRSS Module – GeoRSS is a common XML file format for sharing spatial data as a syndication feed. This module also supports GML, an OGC compliant XML format. This module has been updated to support Complex Polygons (polygons with holes).

GPX Module – GPX is a common XML data format that is used by GPS devices. Many GPS devices allow you to stave points, routes and tracks which can then be exported from the device in GPX format. This module makes it easy to view these files on Bing Maps.

Four New Bing Maps V7 Modules

In September of 2011 Bing started the Bing Maps v7 Module CodePlex Project. The purpose of this project is to create a single place where developers can find and share useful modules that expand the functionality of the Bing Maps V7 API. Currently, there have been 10 modules submitted to the project. With a number of new modules in development, it’s safe to say that this project is definitely worth looking into. Today I would like to highlight the four newest modules added to this project.

Point Based Clustering Module

Download here

Bing created this module based on feedback received around the Client Side Clustering Module that  created some time ago. The older client side clustering module uses a grid based algorithm which is fast, but requires re-clustering the data every time the map moved. This allows for 5000+ pushpins to be clustered in a fraction of a second but often results in pushpins jumping around the map as you pan. The point based algorithm prevents pushpins from overlapping and jumping around by only clustering the data when the zoom level changes. Additionally this module keeps track of clustered information for each zoom level, making the algorithm faster the more you use it. This improved UI experience does affect performance and as such this algorithm is recommended for 2000 or less pushpins. Interested in reading more about how this algorithm was created? Check out this blog post.

GPX Parser

Download here

Bing created this module due to a number of requests that had received for such a module. This module allows you to easily pass in a URL to a GPX file and have it parsed into an EntityCollection which you can then render on Bing Maps. GPX is a type of XML file that is commonly used by GPS devices. It can be used to describe waypoints, tracks, and routes. Majority of the XML tags for V1 and V1.1 of the GPX schema are supported and all data is stored in a Metadata property, which is added to each entity.

Route Optimization – RouteSavvy Module

Download here

This module was created by OnTerra Systems, a Bing Maps Partner.

In today’s economy, it is more important than ever that companies optimize and manage their supply chains more efficiently. Given today’s fuel costs, product delivery with high quality of service and short delay times is paramount. Distribution accounts for a large proportion of the overall operational costs of a producer. Hence, effective and efficient management of transportation and distribution of goods are becoming increasingly important.

One of the key problems in this process is the optimization of delivery routes to customers. This problem is known as the “Travelling Salesman Problem” (TSP). RouteSavvy is a web service that helps solve this problem.

RouteSavvy is a simple but powerful tool that can take anywhere from 3 or 4 locations to hundreds of locations. It reorders them based on whether you’d like to visit them in a “round-trip” OR as a one-way trip, with the last stop chosen either by you or by the software (whichever is preferred).

Web developers can now easily integrate the RouteSavvy API into their web application by adding the RouteSavvy Map Module. The map module uses Ajax to call the RouteSavvy web service to optimize a given set of locations.

Here is a screen shot of a set random location optimized for a round trip:

Mini-Map Module

Download here

This module was created by OnTerra Systems, a Bing Maps Partner.

The Bing Maps Ajax v7 control doesn’t include support for adding a Mini-Map. The Mini-Map module adds a small map at the right corner of the parent map that’s collapsible and shows the extents covered by the current map. This module adds a mini map at the top right corner of the screen. Mini-map view helps to give a zoomed out overview of your location. Here is a screen shot of the implemented Mini-Map module:

I hope you find these new modules useful!

Bing Maps: Module for v7 Adds Support for Long Routes

In the Bing Maps v7 control there is the Directions module which allows you to calculate a route with up to 15 waypoints and also generate a nice UI of the resulting directions. Before this module we would have to access the Bing Maps Routing REST service directly to calculate routes. For some this may be still may be the preferred method of requesting routes. The REST services allow you to calculate routes with up to 25 waypoints. In some situations support for routing between a larger number of waypoints may be required. This is where this module comes in. It wraps the Bing Maps Routing REST service and allows you to calculate a route with an unlimited number of waypoints. It accomplishes this by breaking the waypoints into batches and matching multiple routing requests. The results are then merged together into one route response.

This module is easy to use and has two public methods; GetRoute and IsProcessing. The GetRoute method takes in an array of waypoints, a Bing Maps key, a set of route options and a callback method. The IsProcessing method simply checks to see if the RouteServiceHelper class is processing a calculating a route.

This module, along with complete source code and an example implementation can be downloaded here. This module is part of the Bing Maps v7 Module community project on CodePlex, check this project out for other cool and useful Bing Maps v7 modules..

Below is an example of a route with 32 waypoints that was generated using this module.

Currently this module is limited to driving and walking directions, transit directions are not supported. User context information and route tolerances are also not supported. If this functionality is required outside of the Bing Maps V7 control the code in this module can easily be adopted to work on its own in other programming languages. This may be useful in cases where this functionality is needed in backend systems.

rbrundritt.wordpress.com