
Your server scripts can now obtain information about the viewing location in order to calculate altitude, heading, and tilt angle, amongst several other useful items of data.
There's a lot of useful things you can do with this information, not least is correctly calculate which placemarks are within the view even when its got tilt and roll applied.
Tags
Url and
Icon both support the undocumented
viewFormat tag, which can provide your server with not just the Bounding Box (
BBOX) but also the current
LookAt (longitude, latitude, range, tilt and heading). It can also provide the current horizontal and vertical
field-of-view.
This tag allows you to specify the format of the
Query-String used in the HTTP GET request that the
NetworkLink/Url/href and
Icon/href tags use when requesting data from the server.
viewFormat recognises several very useful replaceable parameters, so as a developer you can now specify the format and content of the information sent to your server.
Heres a complete example using all parameters :
Code:
<NetworkLink>
<Url>
<viewFormat>hello=tj&BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]
&LOOKAT=[lookatLon],[lookatLat],[lookatRange],[lookatTilt],[lookatHeading]
&HFOV=[horizFov]&VFOV=[vertFov]</viewFormat>
<href>http://lan.tjworld.net/play/status.php</href>
</Url>
</NetworkLink>
Might give:
Code:
status.php?hello=tj&BBOX=-0.522681,-0.636614,0.522681,0.636614
&LOOKAT=7.23334e-15,0,100000,0,-1.38161e-14
&HFOV=60&VFOV=70.2327
The possible parameters are (all self-explanatory):
[bboxWest]
[bboxSouth]
[bboxEast]
[bboxNorth]
[lookatLon]
[lookatLat]
[lookatRange]
[lookatTilt]
[lookatHeading]
[horizFov]
[vertFov]
You can specify them in any order
and wrap them over multiple lines in the KML (helps readability). You
do not have to send all the parameters - its up to you to choose which ones and what key-names to assign them to.
viewFormat will send
ONLY what you specify

You
must hard-code the QueryString
key-names and properly escape
XML entities such as the ampersand as
&. Don't forget the equals (=) sign between key-names and values.
If you are sending multiple values in one key, then use a suitable separator such as the comma (,) as shown in the example above.
The example above could be re-written like this (shows how flexible it is).
Code:
<NetworkLink>
<Url>
<viewFormat>hello=tj&west=[bboxWest]&south=[bboxSouth]
&east=[bboxEast]&north=[bboxNorth]
&laLon=[lookatLon]&laLat=[lookatLat]
&laRan=[lookatRange]&laTilt=[lookatTilt]&laHead=[lookatHeading]
&HFOV=[horizFov]&VFOV=[vertFov]</viewFormat>
<href>http://lan.tjworld.net/play/status.php</href>
</Url>
</NetworkLink>
which would send the GET request:
Code:
status.php?hello=tj&west=-0.522681&south=-0.636614
&east=0.522681&north=0.636614
&laLon=7.23334e-15&laLat=0
&laRange=100000&laTilt=0&laHead=-1.38161e-14
&HFOV=60&VFOV=70.2327
Happy coding!