How to use data in KML file.

Oct 26, 2009 at 2:06 PM

Hi all,

Could you please help me with my problem about using KML file data in our WPF application. I have a .KML file with coordinates and some other info in it and I want to show that points on my map in our application. I tried hard but could not do that yet. Also, I cannot use the sources in the internet since almost all of them uses Javascript codes. For example, I could not use VEShapeLayer class ,that I saw in an application and Bing map API, in your sample application(or library) .

Coordinator
Oct 26, 2009 at 2:24 PM

You can use any of the Bing Maps API, including VEShapeLayer.  You just need to reference the assembly in your project and get a reference to the Globe Control, which is available through VEMap.GlobeControl.  Any samples you've seen that use the Bing Maps 3D client API will probably need that reference.  Most things in javascript (for the 3-D version at least) can be done in the client API, though the specific syntax may be different.

As always, you can reference the Bing Maps 3D documentation:

http://blogs.msdn.com/virtualearth3d/archive/2009/01/25/documentation.aspx

 

Oct 26, 2009 at 2:57 PM
joshb wrote:

You can use any of the Bing Maps API, including VEShapeLayer.  You just need to reference the assembly in your project and get a reference to the Globe Control, which is available through VEMap.GlobeControl.  Any samples you've seen that use the Bing Maps 3D client API will probably need that reference.  Most things in javascript (for the 3-D version at least) can be done in the client API, though the specific syntax may be different.

As always, you can reference the Bing Maps 3D documentation:

http://blogs.msdn.com/virtualearth3d/archive/2009/01/25/documentation.aspx

 

Josh, could you be more descriptive please? I could not get what you mean by referencing the assembly and how to do it and how can I use VEMap.GlobeControl? I wrote VEMap.GlobeControl in the editor but it did not turn out anything or I am missing something(most probably :)).

Coordinator
Oct 26, 2009 at 3:05 PM

You need to use your named instance.  Suppose you have:

<VEMap x:Name="mymap" />

in you XAML file.  In your CS file, you can say mymap.GlobeControl to get the reference, and explore it using intellisense.

If you open the InfoStrat.VE source code projects, you can expand the project and expand the References area.  There are some references to Microsoft.MapPoint.* dlls that you may need to add to your own project as well.

Oct 26, 2009 at 3:23 PM
joshb wrote:

You need to use your named instance.  Suppose you have:

<VEMap x:Name="mymap" />

in you XAML file.  In your CS file, you can say mymap.GlobeControl to get the reference, and explore it using intellisense.

If you open the InfoStrat.VE source code projects, you can expand the project and expand the References area.  There are some references to Microsoft.MapPoint.* dlls that you may need to add to your own project as well.

Hi josh,

I guess there are some improvement but still not enough. When I write map.GlobeControl intellisense suggests 8 methods (DoMouseUp, DoMouseDown, DoMouseDoubleClick,...). I cannot initialize a VEShapeLayer object or similar things :( What's wrong with me?

P.S: By the way I did not create a new project I modify the source code that I downloaded from this project side.

 

Coordinator
Oct 26, 2009 at 3:31 PM

I assume that you used one of the sample applications as your starting point.  Those projects don't have the MapPoint references.  You need to add them like the InfoStrat.VE project has, and then you should be able to see more in intellisense and create VEShareLayer objects. 

Note: The VEMap.GlobeControl is of type InfoStrat.VE.PublicEventsGlobeControl, which derives from the MapPoint GlobeControl.  That's is likely why you only see part of the methods, since you only have an assembly reference to InfoStrat.VE, but not the rest of the MapPoint dlls.

Dec 10, 2009 at 1:44 PM
joshb wrote:

I assume that you used one of the sample applications as your starting point.  Those projects don't have the MapPoint references.  You need to add them like the InfoStrat.VE project has, and then you should be able to see more in intellisense and create VEShareLayer objects. 

Note: The VEMap.GlobeControl is of type InfoStrat.VE.PublicEventsGlobeControl, which derives from the MapPoint GlobeControl.  That's is likely why you only see part of the methods, since you only have an assembly reference to InfoStrat.VE, but not the rest of the MapPoint dlls.

Hi Josh.

First of all, thank you for this great InfostratVE component.

Like Bilen, i tried to import kml file, but i didn't succed: i add to references all MapPoint.*.dll, i explore all of them, and didn't find any VEShapeLayer Class. Could you give the right namespace to find the class?
I have access to GlobeControl, with all its members, but i didn't find the way to import kml.  If i could found VEShapeLayer, VEShapeSourceSpecification, and a way to find map.ImportShapeLayerData() method, as explain in this link(http://blogs.msdn.com/keithkin/archive/2007/11/20/virtual-earth-api-adding-kml-or-georss-layers-to-the-map.aspx), i could go on with classical bing maps API.

Nevertheless, i maybe forgot a specific DLL, even if i tried them all. Thanks for your help!