# KmlFeatureLayer

**URL:** <https://community.thinkgeo.com/t/kmlfeaturelayer/4362>\
**Category:** MVC\
**Created:** [February 11, 2016, 6:14am UTC](https://community.thinkgeo.com/t/kmlfeaturelayer/4362 "2016-02-11T06:14:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/t/5f9b8f/32.png) [@Thomas1](https://community.thinkgeo.com/u/Thomas1)\
**Post date:** [February 11, 2016, 6:14am UTC](https://community.thinkgeo.com/t/kmlfeaturelayer/4362/1 "2016-02-11T06:14:50Z")

</div>

I&nbsp;am&nbsp;looking&nbsp;to&nbsp;move&nbsp;away&nbsp;from&nbsp;my&nbsp;custom&nbsp;KML&nbsp;Layer&nbsp;solution&nbsp;to&nbsp;use&nbsp;the&nbsp;ones&nbsp;provided&nbsp;by&nbsp;ThinkGeo&nbsp;in&nbsp;the&nbsp;v8&nbsp;and&nbsp;v9&nbsp;release.&nbsp;&nbsp;My&nbsp;KML&nbsp;is&nbsp;built&nbsp;in&nbsp;memory&nbsp;and&nbsp;I&nbsp;would&nbsp;like&nbsp;to&nbsp;avoid&nbsp;writing&nbsp;to&nbsp;the&nbsp;file&nbsp;system&nbsp;if&nbsp;possible.&nbsp;&nbsp;I&nbsp;have&nbsp;tried&nbsp;to&nbsp;inject&nbsp;the&nbsp;stream,&nbsp;but&nbsp;I&nbsp;get&nbsp;a&nbsp;null&nbsp;object&nbsp;exception&nbsp;when&nbsp;I&nbsp;do.&nbsp;&nbsp;Here&nbsp;is&nbsp;a&nbsp;code&nbsp;snippet.&nbsp;&nbsp;Has&nbsp;anyone&nbsp;tried&nbsp;an&nbsp;operation&nbsp;like&nbsp;this?&nbsp;&nbsp;I&nbsp;have&nbsp;found&nbsp;very&nbsp;little&nbsp;information&nbsp;on&nbsp;ThinkGeo’s&nbsp;KML&nbsp;solutions.  
  
  
  
KmlFeatureSource&nbsp;incidentLayer&nbsp;=&nbsp;new&nbsp;KmlFeatureSource();  
incidentLayer.StreamLoading&nbsp;+=&nbsp;((object&nbsp;sender,&nbsp;StreamLoadingEventArgs&nbsp;e)&nbsp;=\>  
{  
&nbsp;&nbsp;&nbsp;&nbsp;e.AlternateStream&nbsp;=&nbsp;s;  
&nbsp;&nbsp;&nbsp;&nbsp;e.AlternateStreamName&nbsp;=&nbsp;“test”;  
&nbsp;  
});

---

<div class="post-metadata">

**Author:** ![Peter](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/peter/32/19042_2.png) [@Peter](https://community.thinkgeo.com/u/Peter)\
**Post date:** [February 12, 2016, 1:18am UTC](https://community.thinkgeo.com/t/kmlfeaturelayer/4362/2 "2016-02-12T01:18:49Z")

</div>

Hi&nbsp;Thomas,&nbsp;  
  
  
  
It&nbsp;proved&nbsp;to&nbsp;be&nbsp;a&nbsp;bug&nbsp;which&nbsp;has&nbsp;been&nbsp;fixed&nbsp;in&nbsp;the&nbsp;latest&nbsp;version.&nbsp;&nbsp;  
  
  
  
Thanks,&nbsp;  
  
Peter

---

<div class="post-metadata">

**Author:** ![Richard\_Styer](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/r/858c86/32.png) [@Richard\_Styer](https://community.thinkgeo.com/u/Richard_Styer)\
**Post date:** [February 21, 2017, 5:59pm UTC](https://community.thinkgeo.com/t/kmlfeaturelayer/4362/3 "2017-02-21T17:59:48Z")

</div>

Thomas

I believe we have encountered a similar problem with KMLFeatureLayer. When our application instantiates a layer using “KMLFeatureLayer” and attempts to open a kml file, an exception is thrown the outer exception is "The type initializer for “xRM=.OxY” threw an exception. The inner exception is “Object Reference not set to an instance of an object.”. StackTrace is showing

"at xRM=.OxY=.PhY= (String nodeLocalName)\r\n at ThinkGeo.MapSuite.Core.KmlFile.ReadStyles()\r\n at ThinkGeo.MapSuite.Core.KmlFile.Open()\r\n at ThinkGeo.MapSuite.Core.KmlFeatureSource.OpenCore()\r\n at ThinkGeo.MapSuite.Core.FeatureSource.OpenCorec()\r\n at ThinkGeo.MapSuite.FeatureLayer.OpenCore()\r\n …

We were using MapSuite Desktop Edition 9.0.0.90 but when I read the post above I decided to try the latest build for Desktop Edition (which also is the same date as the latest build for Services Edition) which is 9.0.0.541. I am still getting the same exception with the 9.0.0.541. Is this the build that contains the fix that was mentioned in this topic? How do I get the fix if it is not in the Desktop Edition?

Thanks for your help in advance.

Richard Styer

---

<div class="post-metadata">

**Author:** ![Richard\_Styer](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/r/858c86/32.png) [@Richard\_Styer](https://community.thinkgeo.com/u/Richard_Styer)\
**Post date:** [February 21, 2017, 7:29pm UTC](https://community.thinkgeo.com/t/kmlfeaturelayer/4362/4 "2017-02-21T19:29:50Z")

</div>

Thomas

One more question. We had problems last week getting GeoTiff to display using GdiPlusRasterLayer. We finally got the Map Suite Unmanaged Dependencies for 9.0.569.0 as an msi installer and got the GeoTiff layers to display again. Would this problem with displaying a KML file be related to the Unmanaged Dependencies in any way? From my past experience with KMLFeatureLayer it appears that the KML file code is part of MapSuiteCore.dll but I wanted to make sure there isn’t some dependency in either the Unmanaged Dependencies or the FDOExtensions that might be causing our exception.

Thanks for your help

Richard Styer

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [February 22, 2017, 8:03am UTC](https://community.thinkgeo.com/t/kmlfeaturelayer/4362/5 "2017-02-22T08:03:51Z")

</div>

Hi Richard,

The KML is not related with unmanaged dlls.

I am not sure whether your exception can be solved by the latest version but please try latest 9.0.x.0 but not 9.0.0.x.

If the exception is still be thrown, please sent us a test kml file, and make sure it’s standard format and let us know it’s version.

Regards,

Don

---

<div class="post-metadata">

**Author:** ![Richard\_Styer](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/r/858c86/32.png) [@Richard\_Styer](https://community.thinkgeo.com/u/Richard_Styer)\
**Post date:** [February 22, 2017, 1:08pm UTC](https://community.thinkgeo.com/t/kmlfeaturelayer/4362/6 "2017-02-22T13:08:07Z")

</div>

Don

Thanks for the quick response.

I have opened a support ticket for this problem and attached the KML file and our error log showing the exception and the stacktrace. I am not sure what version number you are looking for but I think our file follows the KML 2.2 standard. I am also not sure about the definition for standard format but I know the file is KML that will parse with other tools such as Google Earth and ArcGIS Earth. It also parsed and displayed okay with MapSuite Desktop Edition 8.0 in our application before we upgraded to MapSuite Desktop Edition 9.0. I had already tried the latest build of MapSuite Desktop Edition 9.0.0.541 yesterday before I posted the message above. I don’t know where to find or download anything more recent than that.

Thanks again. I will wait for answers on the support ticket.

Richard Styer

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [February 23, 2017, 2:24am UTC](https://community.thinkgeo.com/t/kmlfeaturelayer/4362/7 "2017-02-23T02:24:01Z")

</div>

Hi Richard,

Thanks for your detail information, we will reply you in the ticket.

Regards,

Don
