MapPoint Forums

MapForums

Community of MapPoint and Bing Maps Users and Developers




Virtual Earth API: Adding KML or GeoRSS Layers to the Map

This is a discussion on Virtual Earth API: Adding KML or GeoRSS Layers to the Map within the Bing Maps Blogs & Tweets forums, part of the Blogs category; One of the new features of the Virtual Earth v6 Map Control API is the ability to import KML layers ...


Go Back   MapPoint Forums > Blogs > Bing Maps Blogs & Tweets

Today's Posts Twitter Feed Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-04-2008
Member
Green Belt
 
Join Date: Jan 2008
Posts: 54
Virtual Earth API: Adding KML or GeoRSS Layers to the Map

One of the new features of the Virtual Earth v6 Map Control API is the ability to import KML layers on the map.  Previous versions of the API allowed you to import GeoRSS using client-side XML parsing.  However, one of the restrictions was that the GeoRSS file had to be on the same domain as the application or the browser would bring up a security warning unless the feed was from a trusted site in the client browser. 


For v6, we have improved this by added a new VEDataType.ImportXML option to the ImportShapeLayerData call on VEMap.  This new call uses the same service from Live Search Maps which allows users to import KML, GeoRSS, or GPX into user collections. In the Virtual Earth API, it will import the XML into a shape layer in your application.  It also allows you to load these data files from different domains without causing a browser security warning.


Here are the steps for importing a KML, GeoRSS, or GPX file into your Virtual Earth application:



  1. Create a shape layer


var shapeLayer = new VEShapeLayer();


   2. Create a shape source specification with type VEDataType.ImportXML, the url to the XML file, and a reference to the shape layer:



var shapeSpec = new VEShapeSourceSpecification(VEDataType.ImportXML,"http://dsc.discovery.com/utilities/googleearth/nationalparks/nationalparks.kml", shapeLayer);


   3. Import the data into shape layer by calling ImportShapeLayerData on the map with the specification:



map.ImportShapeLayerData(shapeSpec);


Here's a link to a simple example which imports a KML file from the Discovery Channel that shows different national parks around the United States:



Virtual Earth API - Import XML Sample



Note: you can also import XML files directly into Live Search Maps by opening a collection and then clicking on Import and entering the url.  You can also, use the following url syntax directly:



http://maps.live.com/?mapurl=[insert url here]


For example:



http://maps.live.com/?mapurl=http://dsc.discovery.com/utilities/googleearth/nationalparks/nationalparks.kml




More...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
adding, api, georss, kml, layers, map, virtual earth


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
BRIGHTi GeoFeeder for converting Geodata to GeoRSS VE Team Bing Maps Blogs & Tweets 1 08-19-2008 02:07 PM
Mashing KML and GeoRSS in 3D on the Web VE Team Bing Maps Blogs & Tweets 0 10-26-2007 01:13 PM
Virtual Earth News from GEOINT 2007: Virtual Earth Appliance VE For Government Bing Maps Blogs & Tweets 0 10-24-2007 12:10 PM
GeoFeeder: Convert Your Vector Data to GeoRSS and Import into Virtual Earth VE For Government Bing Maps Blogs & Tweets 0 10-17-2007 09:41 AM
Adding other layers to mappoint street maps Anonymous Bing Maps and MapPoint Web Service 0 05-12-2005 07:42 PM


All times are GMT -5. The time now is 05:18 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
MP2K Magazine
Visitor Map



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67