More

Editing a KML File

Editing a KML File


I want to delete ALL popups on a (segmented) line in my KML file. I have opened the file in Open Office and need to do a "Find and Replace" for these instances.

Would it be deleting all and ?

And if so, what would be my "Find and Replace" search criteria?

I've found this online, [sS]*?, but it did not find any instances of that.

I have over 100 instances.


I tried with Libreoffice, the healthy successor to OpenOffice.org and I noticed that it doesn't support multiline regular expression matching. So if your description is in several lines in nicely formated KML, that regex would only match the ending tag itself.

But yours didn't match anything, so double check that you have the regular expression option ticked in the find&replace options (below the input fields).

Perhaps it would work to just delete the ending or starting tags, but it looks like you'll need a different tool for a proper solution (perl and similar come to mind).


Holy smokes!

That worked.

All I did was find/replace the unwanted tags to something that would likely not be a recognized tag, Google Earth ignored those foreign tags, and it worked!

Thank you Community.


Editing a KML File - Geographic Information Systems

While every effort has been made to make WFDSS a system that meets all of your geospatial needs, we recognize that, occasionally, you might need to analyze and view spatial information outside of WFDSS. You can download data in several formats:

KMZ files (Keyhole Markup Language Zip file is a file format that is used to display geographic information, such as KMZ files in GOOGLE Earth.)

You can download analysis results of FSPro, NTFB, and STFB if you are the incident owner, or have privileges to view or edit the analysis. Once the analysis is complete, any WFDSS user can download the KMZ file for a single analysis or multiple analysis by using the Filter List.

The Near Term Fire Behavior Results Downloads page has links to KMZs these KMZs, when opened in Google Earth, allow users To View NTFB KMZ Animations.

Note: If you have just received privileges to view an analysis, log out and log back in to WFDSS so the privileges in your account will update properly.


KML Editor

KML files, or Keyhole Markup Language, are used to display geographical data within Earth browsers like Google Maps and Google Earth. They are based on XML and uses a tab-based structure with nested elements and attributes.

KML Editor is an application that makes it not only possible but easy to work with KML files.

The application is built using the Java platform and displays a comprehensive interface. With it you are able to edit raw text, merge KML files, add timestamps and timespans.

A text editor is basically what KML Editor is and that should suit you just fine since you can obtain KML code simply by right clicking a feature in Google Earth and copying the text into the editor. The code is neatly displayed and is very easy to follow. The application even highlights a row of selected text. The application doesn't excel in text editing tools as it only offers you the use of simple functions such as copy, paste, cut and select all.

Using KML Editor you can add timestamps to placemarks and change the markers. A placemark is used to mark a position the earth&rsquos surface and can be customized with a name and various geometric elements.

KML files can easily be created from with this tool but that requires that you have some coding knowledge and experience. With your KML files in their final stages, you can use a ZIP application to create KMZ files. These contain the main KML file and supporting files which you can upload to a personal web server for sharing. This way, anyone that has Google Earth installed is able to to view your KML files.

KML Editor is indeed a practical tool if you take interest in how using KML code can be used for annotation and viewing of 2D and 3D maps.


Sustainability of Digital Formats: Planning for Library of Congress Collections

The Geography Markup Language (GML) is an encoding specification defined by the Open Geospatial Consortium (OGC) to express geographical features. GML serves as a modeling language for geographic systems as well as an open interchange format for geographic transactions on the Internet.

GML is an extensive XML based language designed to express any geographic concept in common usage. The GML specification defines (a) a language for expressing application schemas for feature types and (b) predefined properties and schemas commonly required to describe geographical features, such as polygons, curves, points, coordinate reference systems, units of measure, observations, coverages, etc. Profiles and application schemas are smaller subsets of the GML schema designed by specific information communities to tailor the more extensive GML for a smaller number of users and more targeted uses.

The ISO standard for GML states that "ISO 19136:2007 defines the XML Schema syntax, mechanisms and conventions that:

  • provide an open, vendor-neutral framework for the description of geospatial application schemas for the transport and storage of geographic information in XML
  • allow profiles that support proper subsets of GML framework descriptive capabilities
  • support the description of geospatial application schemas for specialized domains and information communities
  • enable the creation and maintenance of linked geographic application schemas and datasets
  • support the storage and transport of application schemas and data sets
  • increase the ability of organizations to share geographic application schemas and the information they describe."

Local use

Sustainability factors

An open standard developed by the Open Geospatial Consortium (OGC), an international voluntary consensus standards organization whose members maintain the Geography Markup Language standard. GML was approved as ISO 19136 in 2007. The OGC coordinates with the technical committee ISO TC 211 to maintain consistency between OGC and ISO standards work. See http://www.opengeospatial.org/standards/gml.

Since its initial development, its subsequent adoption as an ISO standard and its approval as an Open Geospatial Consortial (OGC) standard, GML has seen increasing use by the geospatial community. Many application schemas and profiles (subsets of the full GML XML schema) have been developed ranging from aeronautics to climate science to digital weather to US Census TIGER data to GML in JPEG2000. A variety of existing and emerging GML application schemas and profiles can be found on the OGC Network page GML Application Schemas and Profiles(link via Internet Archive). GML has seen enough widespread use to be incorporated into GIS industry desktops via ESRI's Desktop Interoperability Extension which uses the GML Simple Features Profile. See An overview of GML support in ArcGIS for more information about ESRI's support of GML, and for further references on how to use GML within ESRI products. Use and understanding of GML has been furthered by the existence of training materials / tutorials such as that of Pennsylvania State's 2012 online tutorial: Lesson 6: Geographic Markup Language. Snowflake Software provides a GML Viewer and training courses.

A number of open source, commercial open source, and commercial products support the transformation of other formats (such as shapefiles, coverages, and grids) into GML encoding and vice versa. These include Safe Software's FME GML Converter and ogc2org - GDAL which uses the OGR Simple Features Library to provide read and sometimes write access to a variety of vector file formats. A partial list of products can be found on the OGC Network's GML to Shape, Shape to GML, etc.(link via Internet Archive) page.

Quality and functionality factors

File type signifiers and format identifiers

Notes

The concept of feature in GML is a very general one and includes not only conventional "vector" or discrete objects, but also coverages and sensor data. The ability to integrate all forms of geographic information is key to the utility of GML.

Whereas GML is a language to encode geographic content for any application, by describing a spectrum of application objects and their properties (e.g. bridges, roads, buoys, vehicles etc), KML is a language for the visualization of geographic information tailored for Google Earth and other map and globe browsers. KML can be used to carry GML content, and GML can be “styled” to KML for the purposes of presentation. KML instances may be transformed losslessly to GML however roughly 90% of GML's structures (such as, to name a few, metadata, coordinate reference systems, horizontal and vertical datums, etc.) cannot be transformed to KML. KML Version 2.2 was adopted as an OGC implementation standard in April 2008.

GML is based on work beginning in 1998. Version 1.0 was recommended by OGC in 2000, followed by version 2.0 in 2001, and version 3.0 in late 2002. Version 3.2.1 was submitted to ISO and adopted as ISO 19136 in 2007. An OGC public comment period on a draft of version 3.3 closed in August 2011. Among the enhancements are support for grids and 3D triangular meshes (TINs).


Background

Keyhole Markup Language(KML) was developed for use with Google Earth, which was originally named Keyhole Earth Viewer. It was created by Keyhole, Inc., which was acquired by Google in 2004. Google Earth was the first program able to view and graphically edit KML files. The name "Keyhole" pays homage to the KH reconnaissance satellites, the original eye-in-the-sky US military reconnaissance system first launched in 1976.

Google submitted KML to the OGC® to be evolved within the OGC® consensus process, andto assure its status as an open standard for all geobrowsers. In November 2007 a new KML 2.2 Standards Working Group was established within the OGC®, to formalize KML 2.2 as an OGC® standard. Comments were sought on the proposed standard until January 2008, and it became an official OGC® standard in April 2008. Future versions may be harmonized with relevant OGC® standards, which will encourage broader implementation and greater interoperability and sharing of earth browser content and context. The Mass Market Geo Working Group (MMWG) in the OGC® will establish such additional harmonization activities, with Geography Markup Language (GML), possibly Styled Layer Descriptor (SLD) and others. There are four objectives for this standards and harmonization work:

  • Creating one international standard language for expressing geographic annotation and visualization on existing or future web-based online and mobile maps (2D) and earth browsers (3D)
  • Aligning KML with international best practices and standards, thereby enabling greater uptake and interoperability of earth browser implementations
  • Using a collaborative approach will ensure that the KML implementer community is properly engaged in the process, and that the KML community is kept informed of progress and issues and
  • Applying the OGC® process to ensure proper life-cycle management of the KML standard, including such issues as backwards compatibility.

KML Files

KML is an XML grammar used to encode and transport representations of geographic data for display in an earth browser. Put simply: KML encodes what to show in an earth browser, and how to show it. Like HTML, KML uses a tag-based structure with nested elements, names and attributes used for specific display purposes. KML can be used to:

  • Annotate the Earth
  • Specify icons and labels to identify locations on the surface of the Earth
  • Create different camera positions to define unique views for KML features
  • Define image overlays to attach to the ground or screen
  • Define styles to specify KML feature appearance
  • Write HTML descriptions of KML features, including hyperlinks and embedded images
  • Organize KML features into hierarchies
  • Locate and update retrieved KML documents from local or remote network locations
  • Define the location and orientation of textured 3D objects

A KML file specifies a set of features (placemarks, images, polygons, 3D models, textual descriptions, etc.) for display in any 3D Earth browser (geobrowser) implementing the KML encoding. Each place always has a longitude and latitude. Other data can make the view more specific, such as tilt, heading, altitude, which together define a "camera view". KML shares some of the same structural grammar as GML.


Editing a KML File - Geographic Information Systems

Inventory of Dams - New York State (NYSDEC) - KML/KMZ File Format KML/KMZ

New York State Department of Environmental Conservation

To provide a digital representation of the locations of dams in the New York State Inventory of Dams that can be viewed in a virtual globe program, like Google Earth.

(1.) While we try to maintain an accurate inventory, this data should not be relied upon for emergency response decision-making. We recommend that critical data, including dam location and hazard classification, be verified in the field. The presence or absence of a dam in this inventory does not indicate its regulatory status. Any corrections should be submitted to the Dam Safety Section with supporting information. (2.) This file was developed in adherence with OGC KML standards and can be viewed in any software that recognizes KML. Users should note, however, that some software does not yet recognize some KML code. Google Earth is recommended for viewing this file. (3.) This file is derived from data exported from the Dam Safety Section's database on 1/13/2017. Contact the Division of Water, Dam Safety Section for the most up-to-date information. 20200401 publication date

Geographic Names Information System <http://geonames.usgs.gov/pls/gnispublic>

New York State Department of Environmental Conservation Division of Water, Dam Safety Section mailing and physical 625 Broadway 4th Floor Albany NY

US (518) 402-8185 [email protected]

None Unclassified None None None

A shapefile is created from data extracted from the Divison of Water's Dam Safety Section database. Latitude/Longitude in decimal degrees is calculated from the latitude/longitude degrees, minutes, seconds fields extracted from the database. Points were plotted and project to the GCS_WGS_1984 coordinate system.

The shapefile was converted to KML file format using the "Export to KML" ArcSript. The KML file was edited using Google Earth and text editing tools. The file was compressed into KMZ format to recuce overall file size.

Updated shapefile with newest data set from Dam Safety, including the LAST_MODIF field (date of data update).


Custom Map Layers

Building KML Files

KML (Keyhole Markup Language) is a common file type used for displaying geographic information. If you want to create your own custom map layers, rather than using pre-built files found online, you will need to build them yourself. There are many programs that allow you to build and export custom map layers as KML files, one of the simplest being Google’s “My Maps” program. After creating a new map, follow the instructions here to download the map as a KML file.

Supported Data Types

The full KML standard supports a very large variety of different data types, allowing you to specify things like simple geometries, time-dependent feature, camera perspectives, and even guided tours. A full list of data types supported by KML can be found at the top of Google’s KML developer reference page.

ForeFlight’s Custom Map Layers feature supports only a small subset of these data types, contained primarily in the Geometry, StyleSelector, and SubStyle groupings (using the organization defined on the reference page). This is sufficient for creating simple or complex arrangements of shapes, lines, and points with support for labels and icon styles.

Below is the full list of data types that ForeFlight supports. If you import a file that includes elements not listed here, the unsupported elements should be simply ignored by ForeFlight and the rest of the file will display correctly.

  • Point
  • LineString
  • LinearRing
  • Polygon
  • MultiGeometry
  • Style
  • StyleMap (only the "normal" style is supported)
  • LineStyle
  • PolyStyle
  • IconStyle
  • gx:LabelVisibility (only Google extension namespace currently supported)

Sample Files

The following files provide some examples of the flexibility of Custom Map Layers. You can view the contents of each file by opening them in a plain text editor like TextEdit. Click on a filename to download it through your browser, or opening it directly in ForeFlight using the instruction for importing via hyperlinks above.

UserMapShapesSample.kml (65 KB) - Demonstrates the supported icon styles and examples of lines, polygons, and circles.
US_Crude_Oil_Pipelines.kml (134 KB) - Basic map showing the network of crude oil pipelines in the US.
US_HGL_Pipelines.kml (71 KB) - Basic map showing the network of HGL pipelines in the US.
Texas_Counties.kml (1.5 MB) - Shows all county borders in the state of Texas.
Alaskan_Coast.kml (3 MB) - Detailed map outlining the state of Alaska. As with other large KML files, there will be a delay of up to a few seconds between tapping on the layer and it appearing on the map as the app works to render the file.


KML Examples from the Google Earth Community Forums

An effective means of learning about KML is to open existing KML files in Google Earth to find out how they function, and then to examine the content of these files in a text editor to investigate how that functionality was implemented. Follow this up with some experimentation by editing the file in the text editor, saving it, and reloading it again into Google Earth.

A good place to learn more about KML and KMZ files is KML Tutorial. Another place to become more expert with Google Earth is Google Earth Outreach's Learn Site.

To edit a KMZ file, you can open it in Google Earth, right-click it in the Places Pane, choose Copy from the menu, and paste the contents into a text editor. In some cases, though, if the KMZ archive contains images or other locally-referenced files, this method will adjust some of the code based on the configuration of the local client machine. To guarantee that the original KML will remain intact, download the KMZ file and change the filename extension from kmz to zip. Then extract all the files and look for the KML in the doc.kml file. Following is a discussion of some examples of KML from the Google Earth Community Forums. The displayed KML code does not include the complete contents of the example files. To view the examples in Google Earth, use the attachments to the actual posts in the Forums.

2020 Update: the following links to files do not work because the original Google Earth Community Forums have been discontinued but the information about working with KML files is still helpful.

Lighthouses on Novaya Zemlya? by diane9247 - Simple Placemarks

This post with its attachment initiated an interesting discussion about lighthouses that a member of the Google Earth Community noticed on the imagery for remote Novaya Zemlya.

Below is the KML for the Placemark for Light F

The Placemark element contains the following elements:

  • name - This serves as a label for the Placemark in the 3D Viewer and in the Places Pane. It also appears at the top of the information balloon for the Placemark.
  • description - This appears in the information balloon for the Placemark.
  • LookAt - This determines the initial view of the Placemark when it is double-clicked in the Places Pane of the 3D Viewer.
  • styleUrl - This refers to the StyleMap defined in the Document element that contains the Folders and Placemarks in this file. The StyleMap specifies what Style elements apply to the Placemark in normal and highlight modes.
  • Point - This is the geographic location of the placermark icon.

Names of elements in KML are case sensitive. Elements that can contain other elements are called complex elements, and their names begin with uppercase letters. Simple elements are ones that cannot contain other elements, and their names begin with lowercase letters.

San Andreas Fault Tour, 88 Places by rocdoc7 - Placemarks in a Folder for a Tour

The KMZ file attachment to this post is designed to offer a tour of the San Andreas Fault. With the file open in Google Earth, highlight the Folder that contains the Placemarks. Then click the Start Tour button. Note that the tour visits the Placemarks in order from south to north with an oblique view of each.

Following is some of the KML from the file, showing only the first three and last Placemarks. They are listed in order from south to north.

Note that each Placemark element contains a LookAt element. This controls the characteristics of the User's initial viewPoint of the location during the tour. The longitude and latitude do not always match the ones in the coordinates element but are generally close. In these Placemarks, the tilt is oblique. A 90 degree tilt would be straight down, but the oblique view affords a better look along the length of the fault.

Moore in America by SandyRichard - Placemarks with Custom Icons and Flickr Photos

This post focuses on the Moore in America outdoor exhibition at the New York Botanical Garden. Two portions of the KML code are shown below.

In the first portion of the KML code, one StyleMap and two Style elements are defined. The StyleMap Pairs the two styles together in preparation for one style to apply to the Placemark icons on the map while they are not highlighted and the other style to apply when one is highlighted by a mouseover. Within each portion of the Pair, these roles are specified by the key element.

This Placemark contains a styleUrl element that applies the StyleMap shown above to the Placemark. Within the description element, a url for an image of a sculpture is specified, surrounded by a hyperlink to its photo page on Flickr.

Positively 4th Street by JavaGAR - Paths

This post has a KMZ attachment that displays Points and Paths on the map to represent several streets. The KML for the Path that represents Bleecker Street is shown below.

The Path for Bleecker Street is implemented as a Placemark with LineString element. Within the LineString element are a tesselate and a coordinates element. With the value of the tessellate element set to 1, the Path will be fit to the curvature of the Earth, so that parts of it do not become hidden below ground. The coordinates element specifies the vertices of the Path, with each vertex represented by a set of three comma-delimited values, called a tuple. These values are longitude, latitude, and altitude respectively. As is the default, the latitude, which is zero in all these tuples, is given relative to ground level.

Long Island Pine Barrens by JavaGAR - Polygons

On this map, conservation zones within the Long Island Pine Barrens are bounded by Polygons. Part of the KML for one of the Polygons is shown below.

This Polygon has a hole in it, so it has both an outer boundary and an inner boundary. The outerBoundaryIs and innerBoundaryIs elements each contain LinearRing elements, which in turn contain coordinates elements that list the vertices of the respective boundaries. In each of these lists of coordinates, the first and last tuple match so that the shape is closed.

World Oil Consumption by giasen - Extruded Polygons

The KMZ attachment to this post represents each country of the world with a three-dimensional prism. These prisms are actually elevated Polygon elements that are extended down to the ground. The height of the prism is proportional to the total oil consumption for that country represented as foot height per barrel per day divided by 10 to keep it from shooting off the screen according to CIA Factbook. The replies to the post include commentary on the effectiveness of this strategy for representing oil consumption. Several other possible methods are suggested among these comments.

The part of the KML for one Polygon that is shown here outlines the 48 contiguous states of the United States. The value of its extrude element is 1, meaning that it will be extended to the ground, making it into a prism. The altitudeMode is set to relativeToGround, meaning that all altitudes, which are given in meters, will be added to the elevations of the Points at which they are given to determine the absolute altitude of that vertex of the prism. The value of the coordinates element is a set of tuples that represent longitude, latitude, and altitude. Each tuple is separated from its neighbors by a whitespace. Only the first, second, and last tuples are shown here. Note that the last one is identical to the first one, which neatly closes the Polygon. For this Polygon, the altitudes are set to 6318504.078090191, which is the elevation of the upper surface of the prism representing the oil consumption of the United States.

Sumatra-Andaman Earthquake+Tsunami overlays by Georggpd - Image Overlay

The KMZ file attached to this post contains overlays pertaining to the Boxing Day Tsunami, which occurred in the Indian Ocean on December 26, 2004. The KML below is for the overlay of aerial imagery of Banda Aceh prior to the event.

The LatLonBox element specifies the bounds of the overlay and the counterclockwise rotation in degrees needed to align it properly.

RUSSIA TOWER, 3D model, Norman Foster Proposal. by pivnice - 3D Model

The KMZ file attached to this post represents a 3D model composed of numerous parts. The content is divided into Folders. The first Folder can be double-clicked to provide a view of the model. Following is the KML:

The model itself contains many Polygon and LineString elements within MultiGeometry elements. A portion of one of the MultiGeometry elements follows:

Education Tools. Assembling. by Valery35 - Network Link

The KMZ attachment to this post is a collection of network links to popular collections of data from the Education forums of the Google Earth Community. A network link references data that is not downloaded until the user makes the network link visible by activating its checkbox in the Places Pane. The KML below is for a network link in the attachment that references data from a Google Earth Community Forums post on Marine Biomes. The href element specifies where the data resides that is downloaded when the network link is activated, and in this case it links to the attachment on the Marine Biomes post.

Mt. St. Helens - Web Cam Time-lapse by pmaxfield2 - TimeStamp

This example uses TimeStamp elements within ScreenOverlay elements to display a sequence of photographs of a minor eruption of Mount Saint Helens that occurred in 2004. The time slider controls the visibility of the photographs provided that their visibility checkboxes are checked in the Places Pane. Each ScreenOverlay represents one photograph. ScreenOverlays are connected to a fixed location on the screen even when the map view changes. Below is shown the KML for two of the overlays. The KMZ file attached to the Google Earth Community post contains a doc.kml file and a files Folder. The image files are contained in the files Folder. These images are referenced in the href elements.

UFO Sightings - Time Animation by Frank4

This is an interesting example of the use of the Google Earth time slider that maps UFO reports through time. TimeStamp elements from three of the PlaceMarks are shown below. Note that the time can be a date without a time of day. In fact, it can consist of only a year or a year and a month.


You can view them online with GPS Visualizer. You load them directly with Viking GPS Analyser.

You can also convert them to GPX files using Viking or GPSBabel. Both are available from the Ubuntu repos. See Viking GPS Documentation for details.

If you're having problems with Google Earth in Ubuntu then you could try using Google Maps to view your .kml files.

To view a KML or KMZ file on Maps, just go to Google Maps, and instead of searching for a geographical address like 1600 Amphitheatre Parkway, 94043, search for a complete Web address (including the "http://" part) of your KMZ file, like http://kml.lover.googlepages.com/cropcircles.kmz. Need your own web space to upload some files? Try Google Page Creator.

Google Page Creator has been shut down and Google now encourages to use Google Sites instead.

GPSPrune claims to support KML for read, view, edit and saving. It is java application and available for linux:

GpsPrune is a free, open source, cross-platform program to view and edit coordinate data like GPS tracks.

Viewing data with a map view using OSM maps

Editing data (delete individual points or sections, variable compression, combine and rearrange data, create and edit individual points)

GpsPrune can read files in the following formats: kml, including zipped and gzipped kml files and kmz files

GpsPrune can also save data to files in the following formats: kml and kmz files (kmz files can include photo thumbnails)


Editing a KML File - Geographic Information Systems

The objective of the Java API for KML is to provide Java interfaces for easy access to KML (Keyhole Markup Language) data.

The main goal of the Java API for KML (JAK) is to provide automatically generated full reference implementation of the KML object model defined by OGC’s KML standard and Google’s GX extensions. It is an object orientated API that enables the convenient and easy use of KML in existing Java environments.

KML is an XML-based language schema that describes and visualizes geographic data. The language is often used in 2D web based maps and 3D virtual globes. Originally developed for Google Earth as a means of maintaining and exchanging geographical data, the language was defined by the Open Geospatial Consortium (OGC) as a standard in April 2008. So far, many virtual globes, like for example NASA’s Earth Wind and Microsoft’s Virtual Earth, have adopted the KML language as their data format of choice.

In order to ensure convenient and easy use of KML in existing Java-systems, an object oriented API is necessary. APIs for XML dialects are implemented using two layers. The current official XML schema of KML in conjunction with the JAXB technology is used to generate Java class representations automatically. KML’s schema is a document describing the correct syntax of KML files and can, therefore, be used for validating the corresponding KML files. The semantic application layer, which is found on top of the JAXB layer, is abstracted from the raw generated classes and defines a well-shaped API.

This API provides easy out-of-the-box access to KML for the user (resp. the developer). This project created, a Java API for KML (short: JAK) in order to enable this.


Watch the video: Web Cartography: Creating and Editing a KML File Using Google Maps Online