Check this out.
The KML file being loaded by GE can look like this: (btw it works, the
file being ref'ed exists.)
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="
http://earth.google.com/kml/2.1">
<NetworkLink>
<name>Dig hole</name>
<Url>
<href>
http://www.koflair.at/earth/dighole.asp?id=500&</href>
<viewRefreshMode>onStop</viewRefreshMode>
<viewRefreshTime>1</viewRefreshTime>
</Url>
</NetworkLink>
</kml>
In this definition, a Network link is defined that will be reloaded 1
sec after a viewchange in GE stops. GE will automatically add the
parameter BBOX.
When the dighole.asp is called by GE, the following URL will be called
(example):
http://www.koflair.at/earth/dighole.asp?id=500&BBOX=36.55432,14.32324,35.564645,14.268768
The answering file, dighole.asp, may look like this:
<%
Response.ContentType = "application/vnd.google-earth.kml+xml"
s = request.QueryString("BBOX")
bbox = split(s, ",")
west = cdbl(replace(bbox(0),".", ","))
south = cdbl(replace(bbox(1),".", ","))
east = cdbl(replace(bbox(2),".", ","))
north = cdbl(replace(bbox(3),".", ","))
eastwest = ((east - west) / 2) + west
center_lng = formatnumber(eastwest, 8,,,0)
center_lat = formatnumber(((north - south) / 2) + south,8,,,0)
if eastwest > 0 then
eastwest = eastwest - 180
else
eastwest = eastwest + 180
end if
center_lngo = formatnumber(eastwest, 8,,,0)
center_lato = formatnumber(-(((north - south) / 2) + south),8,,,0)
Response.Write "<?xml version='1.0' encoding='UTF-8'?>"
Response.Write "<kml xmlns='
http://earth.google.com/kml/2.1'>"
Response.Write _
"<Placemark>" & _
"<name>Dig here (" & replace(center_lng, ",", ".") & "," &
replace(center_lat, ",", ".") & ")</name>" & _
"<description>Ending up at " & replace(center_lngo, ",", ".") & "," &
replace(center_lato, ",", ".") & "</description>" & _
"<Point> <coordinates> " & replace(cdbl(center_lng), ",", ".") & "," &
replace(cdbl(center_lat), ",", ".") & ",5000</coordinates> </Point>" &
_
"<LookAt><longitude>" & replace(cdbl(center_lngo), ",", ".") & "</
longitude><latitude>" & replace(cdbl(center_lato), ",", ".") & "</
latitude></LookAt>" & _
"</Placemark>"
Response.Write "</kml>"
%>
In this example, the id=500 parameter is ignored.
See how the BBOX is split into strings and converted to numbers. Mind
that this script runs on a server with german language, so the decimal
delimiter is ',' instead of '.' so if you run an english server you
may delete the replace functions in those lines like
> west = cdbl(replace(bbox(0),".", ","))
I hope this will help you for the first steps ;-)