Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm having no luck finding examples. I've found code like that below but this is for earlier versions.

shapeLayer = new VEShapeLayer();
shapeSpec = new VEShapeSourceSpecification(VEDataType.ImportXML, layer.url, shapeLayer);
veMap.ImportShapeLayerData(shapeSpec);
share|improve this question
    
I don't think this example represents kml. This looks like esri shapefile to my untrained eye. That said I am sure you could do a mashup between bing, and GE but read the license for restrictions. –  Brad Nesom Aug 19 '11 at 4:12
    
Nothing to do with ESRI shapefiles Brad. From the API doco - msdn.microsoft.com/en-us/library/bb412413.aspx VEShapeLayer Class Contains information about shape layers. Shape layers are a mechanism to create and manage arbitrary groups of shapes (pushpines, polylines, and polygons). Map shape layers can be created from GeoRSS XML files, custom map tiles, or from any public Bing Maps (maps.live.com) collection. –  Luke Aug 19 '11 at 5:10
add comment

4 Answers

up vote 2 down vote accepted

As mentioned above, GeoRSS and KML are not supported. However, someone has written a GeoRSS interpreter for Bing Maps v7. And since KML files and GeoRSS files are both XML, so you can easily convert between the two using XSL. Some hunting shows that many people have talked about it, but I can't find any actual XSL file that does it. I did, however, find one the did the opposite, converting GeoRSS to KML, which should give you a good idea of where to start if you wrote your own.

If you only need to do this once, you could use to following two website to convert KML to GeoRSS via CSV:

  1. A KML to CSV converter using XSL.
  2. A CSV to GeoRSS webapp

And a final option is simply to write your own KML interpreter, in the same way someone wrote their own GeoRSS interpreter, per @Derek.

share|improve this answer
    
I'm confused...how is GeoRSS supported with the bing maps API? It's quite a stretch to say writing your own parsing code counts as "supported". –  Derek Swingley Aug 19 '11 at 17:27
    
Sorry, it isn't supported, but the post I linked to has an interpreter for using GeoRSS in Bing v7 with jQuery. I'll rewrite to be more clear. –  Patrick Aug 19 '11 at 17:34
add comment

Looks like the answer is no. I'm saying this based on looking at their SDK docs and this thread: Looking for KML or GeoRSS Example in Bing Maps Ajax Control v7.

If KML support is crucial, you could use Esri's ArcGIS API for JavaScript as it has support for publicly accessible KML layers. Full disclosure: I work at Esri on the JavaScript API team.

share|improve this answer
    
Curious: I find the ESRI license for JSAPI difficult to read. Can anyone use the jsapi to publish maps? For example could I use the JSAPI to display bing maps and not be in violation of any ESRI licenses? Same for google, OSM, ESRI Public Tiles? Or is it necessary for the user to be an ArcGIS Server user? OL is open but is JSAPI? –  ca0v Feb 27 '12 at 16:30
1  
@user2023 We've been discussing JSAPI licensing internally and agree the story is not clear. We're working on improving this and plan to update several pages to reflect a simpler, easier to understand licensing story. Until we get the various pages updated, the story is this: use the JSAPI for internal, external, non-commercial and commercial sites/apps free of charge. You don't need to pay unless you start storing a large amount of data in arcgis.com and using the services (geometry, locator/geocoding and routing) on arcgis.com. –  Derek Swingley Feb 27 '12 at 18:26
add comment

Bing Maps 7.0 does not include a KML converter. But because it uses JavaScript objects to display data on the map (see Bing API), you can manually parse the kml and convert it to the respective objects.

In this code example, I use JavaScript to convert KML polygon data to new Microsoft.Maps.Polygon objects. I would then use the code below to add the polygons to my Bing map.

// Initialize the Map.
var map = new Microsoft.Maps.Map(document.getElementById("mapDiv"), {credentials:"Bing Maps Key"});

// Insert your own code to get your KML string here.

// Parse the kml into Microsoft.Maps.Polygon objects and add them to the map.
var polygons = bingKmlParser.parsePolygons(kmlString);
map.entities.push(polygons);
share|improve this answer
add comment

Use Openlayers!! You can load KML files, and set Bing as your base map layer. And best of all, is open source, totally stable, and a very active project.

http://dev.openlayers.org/sandbox/rdewit/kml/examples/kml_wmsc_ows5.html

http://openlayers.org/dev/examples/bing.html

share|improve this answer
    
Not really an answer to the problem but a good workaround. –  ca0v Aug 24 '11 at 20:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.