views:

225

answers:

1

The scenario is as follows:

  • A WCF web service exists that outputs a valid GeoRSS feed. This lives in its own domain as a number of different applications have access to it.

  • A web page(on a different site) has been created with an instance of a VEMap(Bing/Virtual Earth map object).

Now, VEMap can accept an input feed in this format via the following:

var layer = new VEShapeLayer();
var veLayerSpec = new VEShapeSourceSpecification(VEDataType.GeoRSS, "someurl", layer);

map.ImportShapeLayerData(veLayerSpec, onComplete, true);

onComplete is a callback function I'm using to replace the default pin graphic with something custom.

The question is in regards to "someurl", which is a path to a local xml file containing the geographic information(georss simple format). I've realized this feed and the map must be hosted in the same domain, so I've created a generic handler that reads the remote feed and returns it in the same format.

var veLayerSpec = new VEShapeSourceSpecification(VEDataType.GeoRSS, "/somelocalhandler.ashx", layer);

When I do this, I get the VEMap error("z is null"). This is the same error one would receive when trying to access a remote feed. When I copy the feed into a local xml file(ie, "feed.xml") there is no error.

The order of operations is currently: remote feed -> local handler -> VEMap import

If I'm over complicating this procedure, let me know! I'm a bit new to the Bing Maps API and might have missed something. Any assistance is appreciated.

A: 

The format I have above is actually very close to what I needed. A similar solution was found by Mike McDougall. Although I was passing the RSS feed directly through the handler(writing the read stream directly), I just needed to specify the following from within the handler:

context.Response.ContentType = "text/xml";
context.Response.ContentEncoding = System.Text.Encoding.UTF8;

With the above fix, I'm able to have a remote GeoRSS feed successfully load a separately hosted Virtual Earth map instance.

Alexis Abril