ThinkGeo.com    |     Documentation    |     Premium Support

KmlFeatureLayer

I am looking to move away from my custom KML Layer solution to use the ones provided by ThinkGeo in the v8 and v9 release.  My KML is built in memory and I would like to avoid writing to the file system if possible.  I have tried to inject the stream, but I get a null object exception when I do.  Here is a code snippet.  Has anyone tried an operation like this?  I have found very little information on ThinkGeo’s KML solutions.



KmlFeatureSource incidentLayer = new KmlFeatureSource();
incidentLayer.StreamLoading += ((object sender, StreamLoadingEventArgs e) =>
{
    e.AlternateStream = s;
    e.AlternateStreamName = “test”;
 
});

Hi Thomas, 



It proved to be a bug which has been fixed in the latest version.  



Thanks, 

Peter

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

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

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

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

Hi Richard,

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

Regards,

Don