Compartilhar via


GeoRSS support for Bing Maps v7 AJAX control

The Bing Maps v7 AJAX control was recently released. It’s smaller and much faster. Unfortunately this improved performance has come at a price. Many of the built in features are no longer out of the box. This new control is designed in such a way that we can easily create modular tools to plug into our apps as needed. This is something I had considered doing on my own for a while as it means that you only download the tools your application needs. One functionality that is missing from the new map control that I’m sure many people are looking for is support for xml files. Particularly GeoRSS, GML, and KML. With this in mind I have put together an initial tool for importing GeoRSS files (RSS and ATOM feeds) into Bing Maps using jquery to help makes things a bit easier. One of the first things you will notice by building out your own modular component is that you have a lot more flexibility in how things are done. In this case I have created a class called GeoRSSLayer. When creating an instance of this class you can set the default options for pushpins, polylines and polygons, such that all created shapes in that layer will use those options. In addition I’ve added support for the “icon” tag so that custom pushpins will be rendered. There is partial support for GML tags, however the data needs to be in WGS84 decimal degree format. The following tags are currently supported:

  • geo:lat

  • geo:lon

  • geo:long

  • geo:point

  • georss:point

  • georss:line

  • georsspolygon

  • georss:where

  • georss:circle
    I’ve created some tools that generate a polygon in the shape of a circle to support this functionality.  For those who have not used this tag before you simple need to provide a latitude, longitude coordinate and a radius in meters. Here is an example:

     <georss:circle>42.943 -71.032 500</georss:circle>
    
  • gml:Point

  • gml:LineString

  • gml:Polygon

As an addition I have also added the ability to get the bounding coordinates of all the data in the GeoRSSLayer, thus making it easier to zoom into the layer. In the attached sample code I mainly use xml files that are hosted in the same domain as the application. In order to access xml files from an external location you will need to create a proxy handler. I’ve put together an example of this in the sample code as well. You can download the complete source code with examples here: https://cid-e7dba9a4bfd458c5.office.live.com/self.aspx/VE%20Sample%20code/BingMapsV7GeoRSS.zip

Feel free to notify me of any bugs. This is a work in progress so I’m planning to improve this over time.

Comments