简体   繁体   English

我们可以使用Google Earth插件API中的KML对象ID缩放到KML地标对象吗?

[英]Can we zoom to a KML placemark object using the KML object ID in google earth plugin API?

Can we zoom to a KML placemark object's (polygon/line/point) extent using the object ID in google earth plugin API? 我们可以使用Google Earth插件API中的对象ID缩放到KML地标对象的范围(多边形/线/点)吗? We can change the style of the KML object using it's ID, in the same way is it possible to zoom to that KML object's extent? 我们可以使用ID来更改KML对象的样式,是否有可能将其缩放到KML对象的范围?

Regards, Shiva 问候,湿婆

Sure, there are quite a few ways to do this. 当然,有很多方法可以做到这一点。

Really the best way would depend on a few things, such as your current set up, how you have defined your objects (in Kml or via the API), etc. 实际上,最好的方法取决于几件事,例如您当前的设置,如何定义对象(使用Kml或通过API)等等。

In general possibly your best bet would be to use something like the GEarthExtensions utility library . 通常,最好的选择是使用类似GEarthExtensions实用程序库的工具 The Util class contains the flyToObject method which... Util类包含flyToObject方法,该方法...

Flies to an object; 飞到一个物体; if the object is a feature and has an explicitly defined abstract view, that view is used. 如果对象是功能部件并具有明确定义的抽象视图,则使用该视图。 Otherwise, attempts to calculate a bounds view of the object and flies to that (assuming options.boundsFallback is true). 否则,尝试计算对象的边界视图并飞向该对象(假定options.boundsFallback为true)。

The main feature here being that the bounds calculations for the various types of geometry in the API are there for you. 这里的主要功能是为您提供API中各种几何类型的边界计算。

If you wanted to roll your own then you should definitely take a look at the code in the extension library as well as at the accessors in the API. 如果你想推出自己那么你一定要看看在扩展库中的代码,以及在访问器中的API中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM