Using KML to scale to altitude

165 views
Skip to first unread message

Mallin2

unread,
Oct 3, 2005, 11:36:16 AM10/3/05
to KML Discussions
What would be the process for scaling icons in a *.kmz file to altitude?

HookEmHorns

unread,
Oct 3, 2005, 3:03:30 PM10/3/05
to KML Discussions
Quote:

What would be the process for scaling icons in a *.kmz file to altitude?



I don't quite understand the question fully.

If you just want the icons associated with a placemark to appear as if they are at a particular altitude, you change the third coordinate of their location to be the altitude in meters, but you also have to add the <altitudeMode> tag.

For an example of the syntax, Edit a placemark in GE, then on the Advanced tab give it a nonzero altitude and save to KML. Then open up the KML in a text editor.

Again, I don't know if this is what you are really asking about though.

Mallin2

unread,
Oct 4, 2005, 9:54:07 AM10/4/05
to KML Discussions
I'm sorry about any confusion and thank you very much for the reply. The question was poorly stated: we are looking for a way to scale the icon on each individual point so that when we zoom in past a certain distance the icons grow steadily larger rather than staying the exact same size. The reasoning behind this desire is that when we zoom in on our finished *.kmz file to a very low altitude (ie-zoomed in to look at a very specific address) the icon becomes so small as to be barely noticeable. This icon size is good when we are dealing with the entire lower 48 states but as we zoom in the icon size becomes too small to adequately highlight the facilities for which we want users to be able to click on and get information about. I know fully about scaling icon for a *.kmz layer to alter its size, but we are looking to scale the icon based upon the altitude from which the user is viewing. Example- I was hoping to set the icon to scale at 1.0 when viewing from over an altitude of 500 feet and a icon scale of 2.0 when viewing of an altitude less than 500 feet.

Any responses are greatly appreciated.
Thanks, have a great day.
Andy

HookEmHorns

unread,
Oct 4, 2005, 11:53:39 AM10/4/05
to KML Discussions
The KML tag for scaling the size of the icon is just <style>. For example:

<Placemark>
<name>Placemark of Scale 2</name>
<LookAt>
<longitude>-110</longitude>
<latitude>35</latitude>
<range>3500</range>
<tilt>-2</tilt>
<heading>6.2e-010</heading>
</LookAt>
<styleUrl>root://styleMaps#default+nicon=0x307+hicon=0x317</styleUrl>
<Style>
<IconStyle>
<scale>2</scale>
</IconStyle>
</Style>
<Point>
<coordinates>-117.1643564990565,32.71581383773918,0</coordinates>
</Point>
</Placemark>

You see the <scale>2</scale> portion of the code. That is your scale factor of 2. Furthermore, you can find out what altitude the camera is at now (supposedly), but since it is a new feature of the latest KML (see this reference ), there are no real examples out there and the documentation won't be out for another 1 - 3 weeks from what I hear.

I don't think there is a simple way to do this though (if there is, someone please speak up!), even though the peices of the puzzle (ie, scale factor tags and camera altitude info) are there. All I can think of right now is to use a very high resolution image overlay instead of a placemark and then make it a dynamic data layer that refreshes based on the new KML camera altitude parameters (hopefully docs on this and examples will be out soon). The server serving this stuff up would rescale the image based on lat/lon coordinates. It's a bit of a hack, I know.

If anyone knows a more elegant/simple way, speak up! While I know how to do some interesting things with GE, I'm by no means an expert.

Mallin2

unread,
Oct 6, 2005, 5:15:15 PM10/6/05
to KML Discussions
So is there any way to make an icon not appear past a certain altitude? We were thinking that it would be best if our icons didn't appear at all past a viewing altitude of 2,000 miles but then appeared once the user zoomed in past altitude=2,000.

jrohlf

unread,
Oct 6, 2005, 7:55:01 PM10/6/05
to KML Discussions
What you want is to specify the LOD (level-of-detail) behavior of placemarks. This is not currently directly possible in kml but is on our todo list.

With current kml, you could use a VBR (view-based-refresh) NetworkLink and set up a server which would return differing geometries based on the camera position.

The <viewFormat> tag of <Url> (and <Icon> for overlays) specifies the parameters to be sent back to your server. The available parameters are:

[bboxNorth] [bboxSouth] [bboxEast] [bboxWest]
[lookatLon] [lookatLat] [lookatRange] [lookatTilt] [lookatHeading]
[horizFov] [vertFov]

Example:

<viewFormat>VIEW=[lookatLon],[lookatLat],[lookatRange],[lookatTilt]</viewFormat>

The server will have to use the lookat parameters to derive the eye position but that's just simple trigonometry.
Reply all
Reply to author
Forward
0 new messages