I'm working with a large team to try and plot a series of events over time using Google Earth. We're trying to add timestamps to each event to enable us to filter the events we're viewing by time, but we can't get the time slider on Google Earth to open up and allow us to filter.
Right now, we're simply going in for every placemark and adding the timestamp under Placemark>Properties>View>Time/Date. We've successfully opened other KMLs with timestamped data and had the time slider show up, so we're not sure what we're doing wrong.
I've gone through the tutorial/instructions provided at https://developers.google.com/kml/documentation/time#gps
https://support.google.com/earth/answer/183758?hl=en
as well as did searches of the Google Earth help forums, but was unable to find any information that addressed our particular issue.
We're currently running Google Earth 7.1.1. Thanks for any help you can provide.
If you add time to a placemark in Google Earth using Placemark > Properties > View > Time/Date then you're actually setting the time by which historical imagery as the base map is viewed when the placemark is activated. This function in Google Earth adds a <gx:TimeStamp> or <gx:TimeSpan> to the placemark's view (LookAt or Camera) which doesn't define the time at which the placemark is visible. In other words, it sets the range of time slider not the placemark. The time slider controls historical imagery, sunlight, and visibility of time-stamped features.
The Google Earth and Google Earth Pro clients do not allow you to add times to your placemarks from which they become visible when the timer slider changes. This and other limitations of Google Earth with respect to editing KML is discussed in the KML Errata.
To add <TimeStamp> or <TimeSpan> elements to your KML you must edit the raw KML outside of Google Earth.
<Placemark>
<TimeStamp>
<when>2007-01-14T21:05:02Z</when>
</TimeStamp>
<Point>
<coordinates>-122.536226,37.86047</coordinates>
</Point>
</Placemark>
Related
In a kml is it possible to to have "region + networkLink + onRegion" type effect over timeSpan, i.e. load the time span only when desired (something like ''onTime'')? Currently my kml loads the entire time span on opening in GE. Since I have data spread over a large time period, it becomes very slow. Can somebody provide me some suggestions or alternatives to address this issue?
I found the solution to this query, and am posting the answer in case somebody needs it in future.
Using LookAt/ camera element in the base kml is the solution to avoid loading all times Steps together.
Something like:
<LookAt>
<latitude>0</latitude>
<longitude>20</longitude>
<altitude>50000</altitude>
<range>10000000</range>
<tilt>10</tilt>
<altitudeMode>relativeToGround</altitudeMode>
<TimeSpan>
<begin>2011-02-01T12:00:00Z</begin>
<end>2011-02-02T12:00:00Z</end>
</TimeSpan>
</LookAt>
I have an app that over time writes Placemarks to a kml file, slowly building up a route over time.
When I open the file in Google Earth, I can see the Placemarks already in the file, but any new ones added to the doc aren't shown on the map, until I reopen the document again.
Is there any way of getting the document to auto refresh in Google earth?
I've tried putting a NetworkLink into the document whose href points itself (the file) with a refreshMode of onChange, and that works, but the whole document is reloaded on each change and each point is displayed again, which is messy.
NOTE: I can't change the apps code, to generate single Placemark updates, which I believe is the proper way of using NetworkLinks.
The only way to perform incremental updates in KML is using the NetworkLinkControl element in conjunction with a NetworkLink.
NetworkLinkControl controls the behavior of files fetched by a <NetworkLink> in which you can change, add, or delete elements that you already fetched.
<NetworkLinkControl>
<cookie>cookie=sometext</cookie>
<linkName>link name</linkName>
<Update>
<targetHref>same-targethref-for-networklink</targetHref>
<Create>
<Document targetId="targetdoc">
<Placemark>
<name>Created place1</name>
</Placemark>
<Placemark>
<name>Created place2</name>
</Placemark>
</Document>
</Create>
...
</Update>
</NetworkLinkControl>
The NetworkLinkControl is tricky to get working such as the URLs in the NetworkLink and NetworkLinkControl must match exactly.
You can find a tutorial with an example to get started.
https://developers.google.com/kml/documentation/updates
So I guess you can't. I thought there might be some kind of structure within kml to achieve this, nut it would appear not.
Is it possible to create a KML file without coordinates in it? I have a list of addresses and I don't have the long/lat. I'd like to create a KML file and have Google Earth geocode and determine the long/lat for each placemark. Thanks in advance.
The geometry (e.g. Point, Polygon, etc.) in a KML Placemark is not required.
You can just have an address in your KML placemarks and Google Earth will automatically geodecode it for you if it can. Under the covers Google Earth will perform a lookup on that address and use the first match if any results are returned. Basically, the resolved address will be the same as if you entered an address via search panel in Google Earth or Google Maps.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Placemark>
<name>Google place</name>
<address>1600 Amphitheatre Parkway, Mountain View, CA</address>
</Placemark>
</kml>
After that if you save your KML then Google Earth will have inserted the coordinates for you into each Placemark.
<Point>
<coordinates>-122.083954,37.421998,0</coordinates>
</Point>
You can create KML file without coordinates when you have an address in your file. You can input the data from MS Excel for instance, if you are interested a batch operation. See the solution below:
http://www.mkrgeo-blog.com/input-a-multiple-address-list-in-google-maps-and-google-earth-the-quickest-way/
Then Google Earth will geocode your placemarks automatically when save it as a .kml file again.
It only works when you have no additional data in your excel column. If so, then you must import the Excel spreadsheet to the Google Earth directly, as per the explanation below:
https://gis.stackexchange.com/questions/298570/exporting-layer-from-google-my-maps-as-kml-has-no-geometries/332642#332642
Does Google Maps support KML regions like Google Earth does?
Google gives a nice description/tutorial of regions here:
https://developers.google.com/kml/documentation/regions
which mentions Google Earth specifically, but not Google Maps.
According to https://developers.google.com/kml/documentation/kmlelementsinmaps
Google Maps DOES support KML regions, but https://developers.google.com/kml/documentation/mapsSupport doesn't mention them explicitly.
Zoom levels in kml files on google maps
is also ambigious on the issue.
I created my own test KML file (stolen almost verbatim from google):
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>Flat Region</name>
<Region>
<LatLonAltBox>
<north>37.430419921875</north>
<south>37.41943359375</south>
<east>-122.080078125</east>
<west>-122.091064453125</west>
</LatLonAltBox>
<Lod>
<minLodPixels>128</minLodPixels>
</Lod>
</Region>
<GroundOverlay>
<name>Mountain View DOQQ</name>
<Icon>
<href>http://data.bcinfo3.barrycarter.info/graphpaper.gif</href>
</Icon>
<LatLonBox>
<north>37.430419921875</north>
<south>37.41943359375</south>
<east>-122.080078125</east>
<west>-122.091064453125</west>
</LatLonBox>
</GroundOverlay>
</Document>
</kml>
You can see it here:
http://test.bcinfo3.barrycarter.info/bc-image-overlay.pl?url=regiontest.kml¢er=37.425,-122.085&zoom=15
As you zoom out, the image remains visible (albeit as a
white square) even when it's only a few pixels on each side.
Does the "minLodPixels" setting of 128 in the KML file mean
it should stop being visible once it takes up fewer than 128
pixels?
If so, would this prove Google Maps does NOT support KML regions?
Or am I misunderstanding something?
I can't give you a completed solution but I tried to avoid overcrowding of my points using Regions in maps about a year ago (asked a similar question on SO) and it was my understanding that KmlLayer would not recognize regions and instead just load everything. The only reference I can find to this are forum posts though e.g.: http://code.google.com/p/gmaps-api-issues/issues/detail?id=3142
That said it was my understanding at the time that this could be achieved by using the API to add the overlays and regions in javascript - I just looked and I can not find a good example of this (or any example at all).
It does seem to me though that it should be pretty easy to write a custom Overlay and override the draw function to take account of the size of the overlay before showing / hiding as the map is zoomed: https://developers.google.com/maps/documentation/javascript/overlays#Drawing
Which is the path I intend on taking when we implement some of the features we need around it - but does not solve having this implemented directly from the KML. What is interesting is you link to the documentation indicating it is supported.
I am new to the KML format and try to figure out how to display a boat (a png), moving from a place to another along a path (a simple line drawn composed of several lines).
I can see how to display a Placemark, even with an icon, and a Path, separately.
What I would like to see when I click on the KML file is :
the boat appearing at the departure point;
the path drawing itself until the arrival;
the boat icon moving at a comfortable speed (bonus point it I can set a ration time / progress, extra bonus if I can click on start, pause or rewind) from departure to arrival along the path.
Is that even possible ? I know it is with Google Map, but you can program it with Javascript, which eases things a lot.
This is an old question, and there is now a better way to move a placemark (or even better a model) along a pre-determined linestring. Look into using this feature:
http://code.google.com/apis/kml/documentation/kmlreference.html#gxtrack
Sample code:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2"
xmlns:gx="http://www.google.com/kml/ext/2.2">
<Folder>
<Placemark>
<gx:Track>
<when>2010-05-28T02:02:09Z</when>
<when>2010-05-28T02:02:35Z</when>
<when>2010-05-28T02:02:44Z</when>
<when>2010-05-28T02:02:53Z</when>
<when>2010-05-28T02:02:54Z</when>
<when>2010-05-28T02:02:55Z</when>
<when>2010-05-28T02:02:56Z</when>
<gx:coord>-122.207881 37.371915 156.000000</gx:coord>
<gx:coord>-122.205712 37.373288 152.000000</gx:coord>
<gx:coord>-122.204678 37.373939 147.000000</gx:coord>
<gx:coord>-122.203572 37.374630 142.199997</gx:coord>
<gx:coord>-122.203451 37.374706 141.800003</gx:coord>
<gx:coord>-122.203329 37.374780 141.199997</gx:coord>
<gx:coord>-122.203207 37.374857 140.199997</gx:coord>
</gx:Track>
</Placemark>
</Folder>
</kml>
The only way I've been able to make this work in static KML is to interpolate between the start and stop points and add placemarks for each frame I want to animate. So, from t=0 to t=1, draw a placemark at the start point. From t=1 to t=2, draw a placemark at the next point, etc.
This gives you the temporal player bar in Google Earth and you can rewind or advance the animation. However it is a little annoying because you wind up with every interpolation point in your placemark tree. Putting the placemarks in their own folder keeps them out of the way, but there's no way to hide them from the user.
Take a look at http://code.google.com/apis/kml/documentation/time.html#animating
The whale shark example does more or less what you want for the placemark. (The URL for the marker icon is broken). Animating the progress along the track can be done using the same trick.
If you want to try something much more difficult, you can try serving dynamic KML. Have Google Earth load a network link to your initial data. Then load another network link with an that sends an update for your placemark at every time tick.
http://code.google.com/apis/kml/documentation/kmlreference.html#link
http://code.google.com/apis/kml/documentation/updates.html
This approach has some serious disadvantages because it requires an external program to drive Google Earth and it does not give the user access to the built-in Google Earth temporal player bar. It also requires that all the data be loaded over a network link -- KML data from a file cannot be updated. That means your driver program needs to act as a http server. Also, in this model it is very hard to know exactly when Google Earth has finished loading and drawing the update. Really I don't recommend doing this; you can make it work using the Google Earth COM API, but it will always be a fragile solution.
There's a browser plug-in that lets you embed Google Earth into a browser page. From there you can use JavaScript to animate your placemark, change your paths, etc. Check out the Google Earth API Developer's Guide.
If you are going to display a boat on Google Earth, a 3D model would be a better approach then an image, since the users can change the viewing angle.
You might want to look into tours: http://code.google.com/apis/kml/documentation/touring.html
I've seen something like this done using a combination of (a number of) <gx:AnimatedUpdate> tags to move a previously created placemark representing your boat and <gx:FlyTo> tags to move the view (I think) all within a <gx:Playlist>.
Hope this helps.
I'm presuming this functionality did not exist when originally answered, but you can achieve the effect using a tour. The following shows a placemark moving in this fashion.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2"
xmlns:gx="http://www.google.com/kml/ext/2.2">
<Document>
<Placemark id="boat">
<Point>
<coordinates>0,0</coordinates>
</Point>
</Placemark>
<gx:Tour>
<name>Play me!</name>
<gx:Playlist>
<gx:FlyTo>
<gx:duration>5.0</gx:duration>
<LookAt>
<longitude>0</longitude>
<latitude>0</latitude>
<altitude>0</altitude>
<heading>-95</heading>
<tilt>65</tilt>
<range>250000</range>
<altitudeMode>relativeToGround</altitudeMode>
</LookAt>
</gx:FlyTo>
<gx:AnimatedUpdate>
<gx:duration>5.0</gx:duration>
<Update>
<targetHref/>
<Change>
<Placemark targetId="boat">
<Point>
<coordinates>1,1</coordinates>
</Point>
</Placemark>
</Change>
</Update>
</gx:AnimatedUpdate>
<gx:Wait>
<gx:duration>6.0</gx:duration>
</gx:Wait>
</gx:Playlist>
</gx:Tour>
</Document>
</kml>
The path could be marked with points whose visibility is altered by the tour at the appropriate time.
I have following sample in Google site. Hope this help.
(details inside : https://sites.google.com/site/canadadennischen888/home/kml/auto-refresh-3d-tracking)
prepare a RestFul service to generate KML file from DB
(sample as in https://sites.google.com/site/canadadennischen888/home/kml/3d-tracking)
My other code will generate a KMZ file which has a link to my Restful service
(sample as in this page)
KMZ file has onInterval
Web page allow user to download KMZ file which has URL that link to my Restful service
When Google Earth open KMZ file, Google Earth will auto refresh to get new data from that Restful service
Just google for "kml time animation"
KML: Time and Animation
KML: Animation
Animation and Dynamic Updates with KML