How to convert lat/lon to pixels

76 views
Skip to first unread message

newDeveloper

unread,
Jun 27, 2012, 10:45:00 AM6/27/12
to google-earth-...@googlegroups.com

Hi.

 

I'm using the Google earth plugin and I'm listening to the viewchangeend event.

My intent is that when the user finishes zooming / panning or whatnot, I should be able

to retrieve the getViewportGlobeBounds and with the bounds returned be able to solve the following problem:

I have a network link that has a KmlRegion with a LOD specified. How can I figure out whether the region is within the bounds and that the LOD was reached?  

Best would be if there was a function such as isRegionActive (or some similar name), where I can pass the KmlRegion, and the function returns true/false based on bounds and LOD. 

I know that with maps v2 you can use a function fromLatLngToDivPixel to convert lat/lon to pixels and from there you can figure out the LOD. What about in Google earth? Is there any function that converts lat/lon to pixels (and vice versa)? Alternatively, is there any built in function I can use that will take the bounds and automatically figure out the LOD? 

What trick does Google Earth themselves do to determine whether a region is active in order to display it on earth?

 

Thank you,

Reply all
Reply to author
Forward
0 new messages