blankblank blank


Archive Page 69 of 106



Using The KML Time Embedder To Stamp Time Data Into A Google Earth File

Since Google Earth currently doesn’t let you add time data to a KML file, you have to use an alternate approach like manually editing the KML file, or using one of several different spreadsheet-oriented methods. I’ve put together a third option, a “simple” Windows utility called “KML Time Embedder” that will let you specify the time information in a GUI, and embed it automatically into a KML file. There are a few limitations on its use:

1. KML files only, not KMZ (but if you have a KMZ file, you can open it in Google Earth and then save it as a KML file)

2. Only simple unstyled feature tags will work, e.g. <Document> will work while the valid <Document id=”Yourstyle”> won’t; if this turns out to be a problem for a lot of people, I might fix it. But then again, if you’re adding style IDs to KML, you’re probably wouldn’t use this utility anyway.

3. Only the first feature tag will have time data embedded after it; if this is a problem, you can always save individual KML files for every separate feature using Google Earth. Feature tags are:

  • <Folder>
  • <Document>
  • <Placemark>
  • <GroundOverlay>
  • <ScreenOverlay>
  • <PhotoOverlay>
  • <NetworkLink>

4. If a document already has time data embedded in it, it will be rejected.

5. There is some error-checking, but I suspect it’s not complete, so I’ve added a “verify” function that lets you manually inspect the time information before embedding it into the file.

6. This version only embeds date time, not hour/minute/second time; if enough people ask, I might add that capability. Done! Visit this post for the details.

I’ve posted two zip files with the program. The first one is just the executable (21 kB zipped) and requires some VB6 files that are probably already installed on your computer (especially if you’re running Windows XP SP2). If it doesn’t work, or if you want the full bells-and-whistles installation with a Start Menu item, try the full install package (2 MB zipped).

When the program runs, you’ll get the following extra-fancy interface:

fullscreen

The functions are:

Open Input KML File: Selects the KML file you want to embed time data into. If it finds time data already present, it will reject the file (see #4 above). If it can’t find an acceptable “feature” tag, it gets rejected as well (see #2 above).

Enter Output KML File: Select the name of the output file. It will check to make sure you’re not specifying the input filename as the output file, and also prompt you if you select an existing filename to make sure you want to overwrite it.

Auto Output File: After you’ve enter the time data, pressing this button will create an output filename by appending the time data to the end of the input filename.

KML Time Info Mode: Specifies the type of time data to be embedded.

– TimeSpan is for data that is associated with a starting and ending time. If the time runs from a start time to the present, just leave the end TimeSpan blank.

– TimeStamp is for data associated with a single specific time; selecting this disables the “end TimeSpan” input.

Enter beginning/end of TimeSpan, or TimeStamp data: After you select the input file, you can enter the beginning time and/or end time if appropriate, or just a TimeStamp (in TimeStamp mode, only one set of input boxes will be visible). Type the year directly into the box, and use negative numbers for BC. The program will check for valid numbers, and will reject the year 0 as invalid (because it *is* invalid; there is no year zero in the Western BC/AD year system). If you want the TimeSpan to run from a time in the past to the indefinite present, or are doing a TimeStamp, just leave the end TimeSpan section blank. Conversely, if you want the TimeSpan to run from the indefinite past and end at a specific date, leave the beginning TimeSpan section blank.

Verify Dates: Once you’ve entered your beginning date (and end date if desired), clicking on Verify Dates will display the time data at the bottom, and do a basic check to make sure that the beginning date is before the end date. If you specify month or day for one time, but not the other, that will be brought to your attention; while it’s probably best to make sure that both dates have the same sets of data entered (year-month-day), it doesn’t appear to be mandatory in KML. There are probably bugs in my validation routines, so you should make sure the dates are correct; if you find a case where the program says the dates are valid, and they’re not, please let me know.

Concluded tomorrow ….

Other free utilities can be found on the Utilities page. If you find this or any of my other utilities particularly useful and would like to show your appreciation, donations of any amount are gratefully accepted via PayPal.




Putting Time Data Into A KML File

Last year, Google added the capability to embed time data into a KML file, allowing you to create animated time-based data displays and animations (like the examples on this blog on sea level rise animation, or converting animated GIF files into Google Earth animated images). Oddly enough, almost a year later you still can’t add time data to a KML file in Google Earth itself, but have to add it manually using a text editor, or in some limited ways when creating the file. But it’s not a particularly-complicated process, involving adding a few lines of KML code after Feature element tags; examples of Features are:

  • <Folder>
  • <Document>
  • <Placemark>
  • <GroundOverlay>
  • <ScreenOverlay>
  • <PhotoOverlay>
  • <NetworkLink>

The two time-related KML elements are TimeSpan and TimeStamp.

TimeSpan: For a set of data that encompasses a specific interval between two times, you would use the <TimeSpan> KML tag. For example, for a period spanning from August 1, 2000 to September 1, 2003, associating the time data with a <Document> tag would look like this:

<Document>

<TimeSpan>

<begin>2000-08-01</begin>

<end>2003-09-01></end>

</TimeSpan>

The rest of your Document data, followed by the </Document> tag to close it …

For a time period running from a specific start time to the present, you’d just need the <begin>…</begin> part, and leave out the <end>…</end> section; similarly, for a time period running from the indefinite past to a specific time, keep the <end>…</end> section and leave out the <begin>…</begin>.

TimeStamp: For a set of data associated with a specific time, you would use the <TimeStamp> KML tag. If the data in your KML folder is valid for June 6, 1944 at 6 AM:

<Folder>

<TimeStamp>

<when>1944-06-06T06:00:00></when>

</TimeStamp>

The rest of your Folder data, followed by the </Folder> tag to close it …

All of the details for these two time-related KML tags can be found at Google’s KML 2.2 Reference Page, including the proper formatting for date, time, and timezones.

Time data is easy enough to add to a KML file, I suppose, but it would be nice to be able to assign them to a feature directly in Google Earth, for those who don’t want to deal with editing KML files. I suspect that will be added to Google Earth sometime in the future, especially now that ArcGIS Explorer has come out with superior time-handling features, but until then I’ve created another option. In upcoming posts, I’ll describe a simple utility I’ve written that lets you add time data to a Google Earth KML file without having to know any KML.




Convert TIGER Polygons To KML Files

Bruce Ralston, author of the free TIGER to shapefile conversion utility tgr2shp, has a new program called tgr2kml that converts US Census TIGER file polygons (but not points or lines) into KML files. It works on TIGER files from 1994 to 2006 Second Edition (future TIGER data will be issued directly in shapefile and web formats).

First select the TIGER files you want to process (they can be in zipped format):

Continue reading ‘Convert TIGER Polygons To KML Files’




Demographic Data For Your Zipcode

Enter a zip code, and ZIPSkinny gives you a summary of census data for that zipcode, including:

  • Education
  • Marital Status
  • Economic Indicators
  • Demographics
  • A comparison with neighboring zipcodes
  • The location of that zipcode in Google Maps
  • The top 100 zip codes for selectable categories
  • The ability to enter and compare data from up to 20 zip codes

Via Explananda.




Google Maps Mapplets From Zonums Software

Zonums Software has just released several Google Maps mapplets; click on a link to add it to your Google Maps MyMaps applets list:

UTMFlyer: Enter a UTM coordinate, and Google Maps will display that location. Zonums also has a Google Earth equivalent function, also called UTMFlyer.

Pointer: Click on a Google Maps point, and get the coordinates in latitude/longitude or UTM.

Digitizer: Click on points in the map window, and create a list of their coordinates (UTM or lat/long) for export to another application.

The last two functions are also available at Zonums in the stand-alone Google Maps app Digipoint 2, which offers additional features like data export in multiple formats (KML, GPX, shapefile, etc.).




Free ArcGIS Extensions For Municipal GIS Applications

In addition to their commercial products, MainStreetGIS has several free ArcGIS extensions available. The examples are oriented around municipal applications, but you can probably find other uses for some of them as well.

MainStreetAbutters: Choose a vector layer (point, line or polygon), a buffer distance for that layer, and a target layer. The extension will select features in the target layer within buffer distance of the buffer layer, and export them to another layer and/or a table or document file like an *.doc Word format file (the latter for use in merging with other documents like mailing labels, letters, etc.).

MainStreetSpatial: Selection of features in one layer based on their spatial relationship within another layer (intersection, lying within, etc.).

MainStreetVisibility: Stores a visibility setting (layer checkbox settings) for a project. Create multiple visibility settings forĀ  single project to turn multiple layers on and off.

MainStreetParcelSearch: Load a list of parcel IDs from a Parcel shapefile layer, select one, and have the map zoom to that parcel.

MainStreetStreetSearch: Load a list of street names from a Street shapefile field, select one, and have the map zoom to that street.

MainStreetAddressSearch: Loads a list of street names and street address numbers from a Parcel shapefile layer, then zooms to a selected street address on the map.

All extensions at the above links are for ArcGIS 9.x, but versions for 8.x are available on request from MainStreetGIS.




Sources For Free Garmin .img GPS Map Files

As mentioned in the previous post, you can use MapSet Toolkit to add any .img Garmin map file to MapSource. If you want to try out the process on some free .img files, here are some sources for .img files, as well as some data in executable files that install it automatically in MapSource without the need for MapSet Toolkit:

  • Mkgmap wiki: .img files for the UK, South Africa, and Africa
  • OpenStreetMap wiki: Files for Germany/Netherlands and the entire world (read the caution for the latter, though; it might crash MapSource if you install it there)
  • GPS Vector Map Morocco has Garmin maps for Morocco and Western Sahara.
  • Yunnan Explorer has some topographic maps for areas of Yunnan Province in China.
  • cgpsMapper MapCenter (and MapCenter2): Maps from around the world, browsable by country and type. Coverage is hit-and-miss, but for some countries it’s very good. For example, the New Zealand Open GPS Project is creating road maps for the entire country as a complete set with an installer that puts them automatically into MapSource.
  • Tracks4Australia has installable map tiles for all of Australia.
  • The GPS Maps site has downloadable maps for Garmin mapping GPS units. Levels of detail included are mixed, but the maps can include topographic contours, land details, and road maps in various levels of detail (either VMAP0 or VMAP1). Areas covered:
    • The Caribbean (including Cuba and parts of South Florida, Central and South America)
    • Bermuda
    • Japan
    • Antarctica
  • Greece GPS Maps has … maps of Greece.
  • And one of these days, I’ll get around to posting on some of the free options for creating your own .img files …




Adding Garmin .img Map Files To MapSource

8/29/09: Some have reported issues with the latest versions of both cgpsmapper (0098c) and MapSet Toolkit (1.62). If you have a problem with these, try using older versions of both programs, available at this link. Also, if you have problems with installing a mapset, try right-clicking on the program and choosing “Run As Administrator”; Windows crappy security system sometimes blocks programs from modifying the Windows registry, which MapSet Toolkit needs to do to install a mapset.

In the last post, OpenStreetMap data was converted to a Garmin .img map file, which can be directly uploaded to a Garmin GPS unit using SendMap or MapUpload software. But it’s more convenient to use the MapSource software that comes with most Garmin GPS units to do this, since you can preview the map data in that program, and create/upload multiple maps and mapsets easily. The best program I’ve found to do this is MapSet Toolkit; you’ll also need the map compiling program cgpsmapper, free for creating basic maps for personal use.

Using the process in the previous post, I downloaded some street data for London, and converted it to a Garmin .img file. I then used the following steps to add the .img file to MapSource:

1. Created a subdirectory in my C:\Garmin directory called “London”, and copied my “63240001.img” file there. Note: MapSet Toolkit will only recognize .img files with a numerical filename. If you rename the file with a non-numerical name, it won’t show up.

2. In Mapset Toolkit, chose that file with “Select IMG files”.

3. Highlighted that file, and “Add”ed it to the selected IMG files. You can add multiple .img files as part of a single set of files.

4.Chose the same directory that contained the .img file as the “Mapset directory” to be used

5. Assigned a name to the mapset, “London”

6. Chose a 4-digit “Product Code” number (“8765” in this example); the only limitation is that it not conflict with any other product codes (which are displayed in the “Uninstall Mapset” box at the right).

7. You can enter copyright info if appropriate, but it’s not required here

8. At lower left, chose the directory where cgpsmapper.exe is located (usually the C:\Program Files\cGPSmapper directory), and selected the cgpsmapper.exe file

9. The “Convert (Product>Families)” section was left blank; more information about Family ID and TYP files is available in the cgpsmapper manual.

10. Checked the box marked “Install in MapSource”. Checking “Blank overview maps” will eliminate the map preview in MapSource. I’ve found that for some mapsets, leaving this box unchecked will result in a crash of cgpsmapper, and a failure of the installation; in that case, check the box and try again.

11. Clicked “Start”, and shortly thereafter got a message box saying “Convert termined” (sic).

12. In the “Uninstall Mapset” section, there’s now a new listing for the added map.

The program screen after all these operations looks like this:

Mapset Toolkit

If I now open Mapsource, the dropdown at the upper left has a selection for “London”; selecting it brings up the OpenStreetMap data:

Londonmap

I can now select this dataset along with any others I might want, and upload it to my Garmin.

You can also use the “Uninstall Mapset” section to remove mapsets from MapSource as well. Occasionally, installing a mapset will cause problems with MapSource starting up; usually, uninstalling the mapset with MapSet Toolkit will fix that problem. You may have to run the program in “Administrator” mode to get this to work (see the comments below).

There’s more complete documentation available in PDF format at the MapSet Toolkit website. And a more complete, technical tutorial on doing this is available at the GPSFileDepot.

Addendum: There are two other programs floating around that can also add .img files to MapSource. M3 is available at MalsingMaps.com, where you can also find free Garmin maps for Borneo, Malaysia and Singapore; free registration required. However, I’ve found that if you install a MapSet using M3, other mapsets installed by either MapSet Toolkit or with the Garmin installer can disappear off of the dropdown menu (they come back after you uninstall the offending mapset). GPS Map Manager is better than M3, but MapSet Toolkit has a better interface and more capabilities.