Hi!
Today I’m tyring to export my map to Google Earth using KML. I searched the forum and found this topic KML Output. But the sample code in there does not work, I have the impression that it was created for an older version of ThinkGeo. By looking at the classes in the Core library, I found the KmlGeoCanvas, which I believe should have everything I need.
I’m trying to find an example that exports a winformsMap to KML. Can you guide me in the right direction?
Thanks!
Export map as KML
Hi Juan,
I think our KmlGeoCanvas in core still be only work for import KML but not for export KML. Ben’s project can work for export because it build a custom KMLGeoCanvas.
Could you please let me know what’s the problem you met for the sample?
Regards,
Don
Hi Don,
The problem with the sample is that it just doesn’t work. It creates an empty kml file. Here’s the result:
<kml xmlns=“opengis.net/kml/2.2”></kml>
<document></document>
<?
xml
version
=
“1.0”
encoding
=
“UTF-8”
?>
<
kml
xmlns
=
"<a href="opengis.net/kml/2.2">opengis.net/kml/2.2</a>"
>
<
Document
>
</
Document
></
kml
>
I’m attaching the code and the shapefiles I’ve used to test it. You’re going to have to change the first line in the main method to point to wherever you’re saving the shapefiles.
Any help would be greatly appreciated.
Juan
KML_Demo_VS2013.zip (179 KB)
Hi Juan,
Your test shape file is Multipolygon, you should want to set the style like this:
austinRoadLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
After set area style, you can get the KML file.
Regards,
Don
That worked, thanks a lot Don, you saved my day.
Hi Juan,
I am glad to hear that works!
Regards,
Don