This project has moved and is read-only. For the latest updates, please go here.

KmlFeature.CalculateLookAt().Range is always 1000?

Sep 22, 2011 at 7:52 PM

I have a kmlFeature and I want to get an instance of its LookAt object so that I can obtain the value of LookAt.Range.  I am using the KmlFeature.CalculateLookAt() function.

The Range property in the returned LookAt object is always 1000, but my KML document has different ranges specified for the features.  I have also tried explicitly casting my kmlFeature to a kmlPlacemark, and I get the same result.

Is there any other way for me to acquire the LookAt.Range value for my kmlFeature?

Thanks for your help.

 

By the way, we have been using SharpKml in our application for almost a year now and it is rock solid.  Thanks for the great library!

Sep 22, 2011 at 8:32 PM

Good to hear the library's been of use - must admit I've not used all the features of it yet so am always interested in how other people are using it.

The CalculateLookAt method is an extension method on a Feature that calculates a LookAt object based on the bounds of the Feature; it doesn't look to see if the Feature already has one associated with it. The value returned is clamped to 1000 meters to avoid zooming in too far.

If the Feature has a view associated with it in the KML then you can try casting the Feature.Viewpoint property to a LookAt, as it inherits from AbstractView.

Sep 22, 2011 at 8:56 PM
samcragg wrote:

If the Feature has a view associated with it in the KML then you can try casting the Feature.Viewpoint property to a LookAt, as it inherits from AbstractView.

 

Works like a charm!

Thanks for the quick response!