blankblank blank


Archive for the 'KML' Category Page 9 of 16



KML Screen Overlay Maker Utility, Concluded

Continuing on from yesterday’s post about my utility to create Google Earth screen overlays …

ScreenOverlay

Rotation: Sets the rotation angle and axis. The angle needs to be between -180 and +180, and counter-intuitively clockwise is negative, counterclockwise is positive. Default (and blank) is no rotation. The “x” and “y” sets the position of the rotation axis for the image relative to the lower-left-hand corner of the image. Leaving this blank sets the rotation axis in the center of the image. Units, selected by the dropdown, are:

  • fraction – The fraction across the image screen where you want the reference point, e.g. 0.5 is halfway across the image. Can be greater than 1 or negative, which sets the rotation axis outside of the image.
  • pixels – The pixel position for the origin measured from the lower left-hand corner of the screen. Can be larger than the image size, or negative, which sets the rotation axis outside of the image.
  • insetPixels – Similar to pixels, but measures from the upper-right-hand corner of the screen. Can be larger than the image size, or negative, which sets the rotation axis outside of the image.

Auto-Refresh: See the Save/Refresh section below for info on this

Overlay size: This sets the size of the overlay image on the Google Earth screen. The default, with the data blank, uses the native pixel size for the image. The top dropdown sets the units, either fraction of the Google Earth screen size or pixels. In the bottom dropdown, you can enter the desired fraction or pixel size, but you also have two dropdown choices:

  • Maintain native size: Keeps that dimension at its original size in pixels, regardless of the units set above;
  • Maintain aspect ratio: As you change the other dimension, this dimension will be scaled up to maintain the image’s aspect ratio. This will keep the image from getting grossly distorted in one direction as you increase or decrease its size in the other direction.

Set Transparency: Sets the overlay transparency from fully transparent (invisible) at the left slider position to fully opaque at the right.

Save As: Lets you select the screen overlay KML filename and save it; filename is displayed in the yellow box above the button. Once you’ve saved a file once, the next two buttons are enabled.

Create Network Link And Open In Google Earth: Clicking this button creates a network link to the KML screen overlay file, and loads it in Google Earth (if Google Earth is not installed in its default location, you’ll be prompted to specify where the Google Earth executable is located). This will display the last saved version of the overlay in Google Earth, and update that view every second. So if you change any of the parameters, and then click the Save/Refresh button, one second later the modified screen overlay will show up in Google Earth, letting you see the effects of the change immediately.

Save/Refresh: If you change any of the parameters and want to save them under the same filename, click this button. If you have created a network link using the above button, the screen overlay in Google Earth will also be refreshed/updated with this button. If you have the Auto-Refresh box checked, the overlay will be saved automatically under the current filename any time you change a parameter, and you won’t have to keep clicking the Save/Refresh button to update the overlay in Google Earth. This can be useful in the final stages of tweaking the results, but you might want to have this turned off in the early stages lest it drive you nuts.

New Program Window: If you want to put multiple graphic elements into Google Earth at once to see how they’ll look relative to each other, clicking this button will open up another program window so that you can create multiple screen overlays at the same time. Once you’ve created the individual screen overlay KML files, you can open them all and put them into a single Google Earth folder to keep them together.

Help: Brings you to the posts on this blog (the lazy programmer’s help page)

Exit: Guess …

Don’t forget that the KML screen overlay file you’ve created references the graphic to its location on your hard drive. If you want to create a portable screen overlay file that you can send to someone else, you should save it in KMZ format from Google Earth.

That’s it. Download the small executable file here, or the much larger full install file here. As usual, use at your own risk, and report bugs/quirks to me. The alpha testers didn’t indicate any serious problems, and the program doesn’t alter any of your original data, so problems should be minimal.

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.




The KML Screen Overlay Maker Utility

Yesterday’s post dealt with the basics of what a Google Earth screen overlay is, and some of its possible applications. But you can’t create or edit a screen overlay in Google Earth, so until now you’d have to create it in KML with a text editor or stand-alone KML editor. I’ve written a small utility for Google Earth that lets you create a screen overlay from a graphic file for Google Earth with a GUI, and also lets you modify the parameters and see the changes in the screen overlay immediately in Google Earth.

You can download the small executable file here, and it will probably work fine as is. If you get error messages about missing files, or if you want the full install with a Start Menu item, you can download the full install package. Here’s the program interface:

ScreenOverlay

The unusual aspect ratio (taller than it is wide) is so you can drag it to the left side over the Google Earth view, where it will block less of the globe and overlay view. This may help you better see the effects of modifying screen overlay parameters.

The various option sections, from top to bottom:

Select graphic overlay file: Click on the button to choose the single graphic file to use as an overlay (if you want multiple graphic images in your Google Earth screen, you can create multiple screen overlay files and load them all into Google Earth). Supported graphic formats are TIF, BMP, JPG, GIF, PNG, TGA, PGM, DDS and PPM; transparency is supported for GIF and PNG files. As soon as you select a graphic file, the “Save As” button will be enabled; saving the screen overlay without changing any of the parameters will place the graphic image in the center of the Google Earth screen at its original pixel dimensions. The full filename (with path) will be displayed in the yellow box.

Overlay title: This is the title that will be associated with the overlay in the Google Earth Places pane at left.

Preset positions: Enters preset parameters to position the graphic image at the specified location on the screen, at its original pixel size.

Overlay dimensions (for reference only): When positioning the graphic and setting some of the parameters, it can be useful to know the native pixel dimensions of the overlay image. You don’t need them for creating an overlay, so they’re there just there for reference. When you open GIF, JPG and BMP images, the pixel dimensions will be entered automatically; for other image types, you can enter those manually after determining them some other ways (like right-clicking on a graphic file and choosing Properties).

Screen Parameters: Sets the “point relative to the screen origin that the overlay image is mapped to”, where the screen origin (x=0, y=0) is in the lower left corner. There are three options for units, set by the dropdown:

  • fraction – The fraction across the image screen where you want the reference point, e.g. 0.5 is halfway across the screen. I’d recommend using the fraction unit option instead of the next two pixel-based options because the overlay will behave better across a wider range of screen resolutions. Can be greater than 1 or negative, but for some screen parameters this can position the overlay out of sight.
  • pixels – The pixel position for the origin measured from the lower left-hand corner of the screen. Can be larger than the screen size, or negative, but this may also position overlay out of sight.
  • insetPixels – Similar to pixels, but measures from the upper-right-hand corner of the screen.

Default value is fraction; if you don’t enter values below the units, the default is the center of the screen.

Overlay Parameters: Similar to Screen Parameters, sets the reference point for the overlay image. Same units (and caveats as above).

For example, if you set the units and parameters for both the screen and overlay to fraction (0.5,0.5), you’ll position the image directly in the middle of the screen for all screen resolutions and sizes. Change the screen to (0,1), and the overlay will be positioned in the upper left corner with only the lower-right-quadrant visible; change overlay to (0,1) as well, and the entire overlay will be visible in that corner.

Draw Order: An integer that sets the draw order if you have multiple overlays; overlays with higher draw order numbers will go on top of ones with lower numbers. For example, an overlay with a draw number of 3 will be drawn on top of an overlay with draw number 1. If this is blank, the default is 0.

The rest 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.




Screen Overlays In Google Earth

Many people are familiar with ground overlays in Google Earth, which drapes a graphic image (like a map) over the terrain in Google Earth. I’d guess that fewer people are familiar with screen overlays, since unlike ground overlays you can’t create and edit them directly in Google Earth, but have to create and edit them in the KML file. A screen overlay is a graphic that’s “embedded” in the viewing screen, so that it doesn’t change as you move around the globe, or change the viewing angle. If I display a screen overlay at one viewing angle and height:

Continue reading ‘Screen Overlays In Google Earth’




KML Time Code Utility

Frank at Google Earth Blog links to a new Google article on the nuts-and-bolts of KML time coding, which goes into far greater detail than my own simple post. Not too long ago, I created a simple utility for embedding time data into a KML file after the first feature tag, and which doesn’t require you to fiddle with the KML code. It has the limitation that it only embeds basic time data after the first KML feature tag; if you have multiple feature tags in a KML file, and want to embed separate time data for each of them, my utility won’t help. And if you read the Google article and want to get more creative with time coding, you’ll have to manually write the KML time code yourself and put it into the KML file within the corresponding feature section.

I’ve created a stripped-down version of that KML time utility called “KML Time Code Creator” that lets you set the TimeSpan or TimeStamp with a GUI, and then creates the properly formatted KML time code to copy and paste into your own KML file. Download the executable file here; if you get error message about missing files, download and install the full version of the KML Time Embedder Utility, which installs the required files.

KMLTimeCode

Setting time parameters is done the same as in my KML Time Embedder utility, so I’ll refer you to those posts for details. Once you’ve set and verified the time parameters, click on the “Create KML Time Code” button at upper left, and the KML time code will be generated and displayed in the white text box. You can copy the text in this box to the clipboard with the appropriate button at left, and then paste it into your own KML file. Nothing fancy, but it does the job.

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.




KML Random Placemark Generator

To go along with its new KML grid creator, Zonums Software also has a new web app that generates a randomly-distributed set of placemarks in KML for use in Google Earth and other compatible apps. Enter latitude/longitude limits for the area along with the number of points and other parameters in the web form:

randomKMLform

Click on “Generate Points”, and get a Google Maps view of the random points:

randomGoogleMaps PM

Click on “Download KML File”, and the KML code is generated and displayed in the browser. Save the page as a KML file, and you can open it in Google Earth:

randompointsGE

Randomly-distributed points are often used for statistical sampling purposes. While KML may not be the ideal format for that application, this is at least a convenient way to generate them. If you need them in a more conventional GIS format (like a shapefile), you can use Zonum’s kml2shp application to convert the random KML points into a random point shapefile.




Google Earth PhotoOverlay Tool

Brand-spanking new from the UCL Centre for Advanced Spatial Analysis (CASA) comes the Google Earth Photo Overlay Creator, a free program to aid in creating PhotoOverlays, photographic images you can embed into Google Earth to correspond to the actual view. While you can do this to a limited degree from Google Earth, and can also do it directly in KML, the GE Photo Overlay Creator simplifies the job tremendously. It also lets you “tile” a large image, similar to tiled Ground Overlays, so that it loads in only the image information necessary for that particular view. This reduces both the bandwidth and computational requirements, particularly for large images.

The program is Java, and will run in Windows, Macintosh and Linux (check the readme.txt file for info; see this Digital Urban post for a full instructional tutorial). Full support of all image formats requires that you have Java Advanced Imaging installed.

Via Digital Urban blog.

Added 11/6/07: The Google Earth Blog links to another tutorial on this tool at GELessons.




Grid Creation And Path/Polygon Measurements: Two New Online KML Tools

KML-GRID: Creates a point, line or filled polygon grid in KML. Set the desired parameters:

KMLGrid1

Clicking on “Data Fill Example” enters sample data into the boxes. For Grid Origin, it’s decimal latitude/longitude. For Increment/Decrement, it’s currently also decimal degrees, as the “Length Units” drop-down at top is currently limited to those units (wouldn’t surprise me if additional unit options were added soon). Click on “Create GRID”, and a view of the grid is shown in Google Maps (lines in this case):

10-24-2007-2.20.39 PM

Click on the “Download KML File” button, and the KML code will appear in your browser; either choose “Save As” from the File menu, or copy and paste it into a text editor and save it as a KML file there. Open it in Google Earth, and there’s your grid:

kmlgrid

A useful complement to GE-Path for creating KML grids.
KML – Area & Length: I’ve covered some other utilities that will calculate path lengths from KML code, filling in a gap in Google Earth. This new utility calculates not just path lengths, but areas as well. Paste the KML code into the text box:

kmllengtharea

For KML files that have both paths and polygons, you can calculate just the path lengths, just the areas, or both; set the units and the delimiters at top. When you click on “Process data”, you’ll get back a text window with the IDs and lengths/areas of the features in the KML file, separated on each line by the chosen delimiter. e.g. for the grid file above:

kmllengthresults




KML Time Embedder Improved With Hour-Minute-Second Ability

I posted a while back about a small utility I wrote called KML Time Embedder, which lets you embed TimeSpan or TimeStamp data into a KML file for use in Google Earth time animations. That version only allowed year-month-day times, but I said that if enough people asked, I’d add the ability to stamp with hour-minute-second in addition to year-month-day. Thanks to popular demand (two people), I’ve modified the program to include that capability.

If you haven’t already read posts one and two on this utility, the following won’t make much sense.

In the upper-right, above the checkbox to enable timezones, is a new one to enable setting the time of day for each date:

enabletimeset

Check that box, and setting the timezone is automatically enabled (and can’t be turned off). Set your local time zone relative to UTC (Greenwich Mean Time) using the dropdown at right.

With that box checked, timeset boxes will appear to the right of the date set inputs:

timeinputs

These will only become enabled for input after you’ve selected a day, and are set for 24-hour time (e.g. 2:17 PM is 14:17:00). As before, if you’re in TimeSpan mode and want it to run from the beginning time to the present, just leave the end of the timespan section blank. Click on Verify Dates to make sure they’re what you want. The program does check to see if the dates and times are valid, but I’m not 100% sure I’ve made that foolproof, so you should check them manually:

sampledatetime

If they’re what you want, click on the “Embed Time Information” button, and the output file will be written with both date and hour of day information.

If you’ve already downloaded and installed the KML Time Embedder, you can just download this small executable file (about 20 KB) and unzip it into the program directory. For that matter, the executable by itself should work fine for most people. If it doesn’t, you can download the full install program (2 MB) which now contains the updated executable.

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.