VEMap 和 GeoRSS feed(单独托管)
该场景如下:
存在输出有效 GeoRSS 源的 WCF Web 服务。它存在于其自己的域中,因为许多不同的应用程序都可以访问它。
已使用 VEMap(Bing/虚拟地球地图对象)的实例创建了网页(在不同的站点上)。
已使用 VEMap(Bing/虚拟地球地图对象)的实例
现在,VEMap 可以通过以下方式接受这种格式的输入源:
var layer = new VEShapeLayer();
var veLayerSpec = new VEShapeSourceSpecification(VEDataType.GeoRSS, "someurl", layer);
map.ImportShapeLayerData(veLayerSpec, onComplete, true);
onComplete 是一个回调函数,我用它来用自定义的东西替换默认的 pin 图形。
问题是关于“someurl” ,这是包含地理信息(georss 简单格式)的本地 xml 文件的路径。我意识到此提要和地图必须托管在同一域中,因此我创建了一个通用处理程序,用于读取远程提要并以相同的格式返回它。
var veLayerSpec = new VEShapeSourceSpecification(VEDataType.GeoRSS, "/somelocalhandler.ashx", layer);
当我这样做时,我收到 VEMap 错误(“z 为空”)。这与尝试访问远程源时收到的错误相同。当我将 feed 复制到本地 xml 文件(即“feed.xml”)时,没有错误。
目前操作顺序为:远程投稿->远程投稿。本地处理程序 -> VEMap 导入
如果我使此过程过于复杂,请告诉我!我对 Bing 地图 API 有点陌生,可能错过了一些东西。如有任何帮助,我们将不胜感激。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我上面的格式实际上非常接近我需要的格式。 Mike McDougall 找到了类似的解决方案。尽管我传递的是 RSS feed直接通过处理程序(直接写入读取流),我只需要在处理程序中指定以下内容:
通过上述修复,我能够让远程 GeoRSS 源成功加载单独托管的虚拟地球地图实例。
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:
With the above fix, I'm able to have a remote GeoRSS feed successfully load a separately hosted Virtual Earth map instance.