Downloading, Creating, and Uploading KML's

 

Introduction

What is a KML?  KML is keyhole markup language, a scripting language used to display geospatial information in multiple platforms such as Google Earth. If you want to view NHD Data in Google Earth or Google Maps, you will need to download it as a KML or convert an NHD Feature Class or Shapefile to KML.

 

Why use a KML? KMLs allow users who are not familiar with GIS to observe geospatial layers in Google Earth or to add their own data to The National Map without having to use a GIS. By uploading a KML to the NHD Viewer, a user can send a url with the information by email to anyone, absolutely free. The user will then be able to view any geospatial data with The National Map data themes and basemaps.

 

When you download the NHD as a KML from the NHD Viewer, you will receive the nationwide extent. If you only want a portion of the NHD, a Subbasin for example, you will need to first download the data as a personal or file geodatabase, and use ArcMap to convert the data to KML.

 

You will need Google Earth installed on your computer in order to complete this tutorial. You can download Google Earth for free here.

 

What is a KMZ? A KMZ is a group of multiple KML's zipped into one file. This allows for storing or sending data in one file.

 

When you download the entire extent of NHD as a KML, Google Earth will run extremely slow. It is recommended that you download only the area that you need, then convert it to KML in ArcMap (Step 3).

 

After completing this tutorial, you will be able to:

 

Obtain the NHD as a KML through the NHD Viewer.

Render the .kml from the REST services endpoint.

Use ArcMap to convert NHD to KML.

Upload a KML to the NHD Viewer.

 

Obtain the NHD as a KML from the Viewer

 

Goal: Use the NHD Viewer overlay panel to download the NHD as a KML from the Viewer and REST services endpoint.

 

Step 1 Use the NHD Viewer to obtain a KML.

 

Go to the NHD Viewer.

 

In the overlay tab on the panel on the left side of the screen, click the arrow in the drop down menu next to the Hydrography (NHD) overlay.

 

 

Click View in and Choose Google Earth.

 

A window will appear asking if you want to open or save the file. Choose "Open with" and the default on the drop down menu should be Google Earth. Click OK. Some browsers, such as Google Chrome may not popup a window but will automatically download the file. This will show up at the bottom of the browser window.

 

 

 

The KMZ file will open and Google Earth will automatically launch.

 

Step 2 Render the .kml from the REST services endpoint.

 

Go to the NHD REST services endpoint at  http://services.nationalmap.gov/ArcGIS/rest/services/nhd/MapServer

 

What is a REST service endpoint?

 

Choose the option to View in: Google Earth.

 

You will be prompted to open or save the file.

Choose the option to Open in Google Earth.

 

 

 

Notice that the viewer symbology is maintained in Google Earth.

 

Convert NHDFlowline Feature Class to a KML

 

Goal: Use the ArcMap KML Conversion tool to convert an NHD Feature Class to a KMZ while maintaining symbology.

 

Step 3 Convert NHDFlowline to KML.

 

The Layer to KML tool in ArcMap is an easy way to convert a feature class to a KML while preserving symbology settings from ArcMap. Save the geodatabase found here: ftp://nhdftp.usgs.gov/DataSets/Staged/NHD_Tutorials/NHD17050108.mdb to a local directory on your computer.

 

Add the flowline feature class to a new ArcMap session.  

 

Symbolize the Flowlines appropriately.

Open ArcToolBox  

 

Click on the search box and type "kml"

 

Choose the option for the conversion tool "Layer to KML"

 

 

 

The tool dialogue box will open.

 

Choose NHDFlowline as the layer to be converted.

 

Call your output "Flowlines". Notice the file extension is .kmz.

 

In the layer output scale type "24000".

 

 

 

Click Ok.

 

The tool will execute.

 

 

 

Navigate to the KMZ and double-click on flowlines.kmz

 

Google Earth will automatically open and display the flowlines. Notice that the symbology has been maintained from ArcMap to Google Earth.

 

 

Add a KML to the NHD Viewer

 

Step 4 Add a KML to the NHD Viewer.

 

First, Download the Colorado Aquifer KML. Save it to a directory of your choosing.

 

Go to the NHD Viewer.

 

In the Advanced tab of the viewer toolbox docked into the top of the viewer, choose the add data tool.

 

 

A dialog box will prompt you for more information.

Choose the option for "KML RSS".

 

 

 

You now have the option to upload a file (KML or KMZ) or enter a URL if the KML exists on a website. In this example, we will link to a KMZ that contains aquifer extents for Colorado.

 

Choose the option to upload a file.

 

Browse to the KML called CO_Aquifers.kmz

Under classification, choose "Unclassified".

 

The dialog box should look like this:

 

 

 

Click "Open".

 

 

 

It may take a couple of minutes for the KML to open in the viewer.

 

The viewer will display the KML over the NHD Basemap. We can now observe Colorado Aquifers with hydro data or other information from The National Map without using ArcGIS.

 

 

 

Which tutorial would you like to see next?

Provide feedback by emailing krisham@usgs.gov