apibing-mapsvirtual-earthgeorss

VEMap and a GeoRSS feed(hosted separately)


The scenario is as follows:

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.


Solution

  • 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.