Google Maps Engine
Make a map with vector data An online HTML version of this tutorial is available here in the Google Maps Engine Help Center. This tutorial shows you how to build a map from vector data—points, lines, and polygons— using Google Maps Engine. See the companion tutorial to make a map with image data. To build the map in this tutorial, we'll do the following: Upload sample vector data. Add the vector data to a vector layer, then style the layer. Add the layer to a map, then publish the map.
About the sample file The sample map you'll build shows the San Francisco Baylands area, and highlights significant sub-regions by color, including the bay channels and waterways, the baylands, and the watersheds. The source data is a type of vector data called a shapefile (provided by the San Francisco Estuary Institute
).
1. Sign in and prepare files To get started: 1. In your internet browser, go to: http://mapsengine.google.com
.
2. Sign in to your organization's Maps Engine project. 3. Download the Google_Maps_Engine_Tutorials_Sample_Vector_Data_20130129.zipfile, which contains a sample dataset for this tutorial. 4. Unzip the file to a working directory on your computer. Tip: If you need a zip or unzip utility for your PC, see www.7-zip.org. After unzipping the file, you should have a folder that contains the following files: EcoAtlas_modern_baylands.dbf EcoAtlas_modern_baylands.prj EcoAtlas_modern_baylands.shp EcoAtlas_modern_baylands.shx
metadata_source.txt
Now you're ready to upload data to Google Maps Engine!
2. Upload vector data About vector data With Google Maps Engine, you can upload vector data in many different file formats. Supported vector formats include Environmental Systems Research Institute (ESRI) shapefiles (.shp), comma-separated value (.csv) files, and Keyhole Markup Language (KML) files. Vector data files are typically organized in a group called a dataset. A dataset must either be in geographic (latitude, longitude) coordinate system with the datum WGS 1984, or have a projection file (.prj), or some other type of location file, associated with it. These associated files are referred to as sidecar files. These sidecar projection files allow Google Maps Engine to place your data in the correct location. To upload a vector dataset: 1. Click the red Upload icon (up arrow) in the upper-left corner, and select Files.
The Upload dialog box displays. 2. Click Browse, then navigate to the folder where you unzipped the sample vector data. 3. Select all the files that make up the the EcoAtlas_modern_baylandsshapefile dataset. The shapefile dataset contains four files: the shapefile itself (.shp), and sidecar files with these extensions: .dbf, .shx, and .prj. Notes You must select ALL the files in the dataset to upload. To select multiple files, select the first file, then hold down the Shift key and select the last file. You can only upload one shapefile dataset at a time.
4. Click Open to add the files to the Upload dialog box.
5. In the Name field, edit the name of the dataset as you would like it to appear in Google Maps Engine. For this exercise, you can leave the name as it is. 6. For Description, enter a description for the dataset. For this exercise, copy the following text and paste it in: This dataset was adapted from the SFEI_modern_baylands_poly_with_crosswalk.shp dataset, part of the San Francisco Bay Area EcoAtlas, and downloaded from the San Francisco Estuary Institute at www.sfei.org/ecoatlas. The dataset was then simplified for use during this tutorial, to show only the "LEVEL2" (renamed to “CLASS”) attributes: baylands, bays and channels, and watersheds. Images were then added to the attribute table for the purposes of this exercise. 7. For Tags, enter one or more tags separated by commas. Along with the description, tags make it easier for others to search for and understand your dataset. For this exercise, type tutorialin the Tag field. 8. Click Upload. The Upload dialog box shows progress while the files are uploaded. When that's done, Google Maps Engine takes you to the Data details page for the dataset you just uploaded. When you first arrive at this page, Maps Engine is still processing the vector data, as shown at the top of the page:
Note: Depending on the size of your dataset, processing could take a few minutes to a few hours. When processing is complete, you may see a message about errors found during processing. This can mean the system found minor problems with the data, but was able to correct or handle them. Click View warnings to see more details, and to find out whether you need to make corrections to your data before re-uploading it. The sample data in this tutorial only produces minor errors, which the system is able to handle, so it's ok to keep going.
9. Click anywhere on the thumbnail map (top right corner), or on the Click to view vector table link (under the map), to view your data in Google Maps.
⬅
10. Press your browser's back button ( ) to return to the Data details page.
3. Create and style a vector layer After uploading your vector data, you must create a layer to hold the data before you can use it in a map. Once the data is on a layer, you can also add styles to the layer, which lets you change the way the data appears on the map.
For example, styles let you change the fill color, border color, and border width of the polygons that make up your vector data. By changing those details for different groups of polygons, you can highlight various areas of your map in distinctive ways. Let's give it a try: 1. Make sure you’re on the Data details page for the EcoAtlas_modern_baylandsvector data source. If you're viewing the data as a map, you can return to the details page by clicking Data details at top right.
2. Under Data sources in the left column, click Create styled layer.
The layer title is automatically filled in, using the name of the data source. You can rename it as needed, or you can add "layer" to the name, to keep it distinct from the data source. 3. Click Create. The Style editor page displays, where you can change the fill color, border color, and border width of the different regions that appear on the baylands map. Right now, the map shows the same default blue color applied to ALL the subregions. We'll change that with the styling we're about to add. Our first style is going to be a turquoise fill color, with no borders. 4. Click Add rule.
5. Change the Fill color to turquoise or light blue. 6. Change the Border Width value to 0. 7. Click Add filter to filter a subset of the data which this style will be applied to. 8. Set the Filter to CLASS == Baylands. Note: Baylands must be spelled exactly as shown. The values that appear in the dropdown list are case-sensitive. 9. Click Apply to apply the current style to your layer. The map should reflect the changes you made—it should only show the polygons with the Baylands Class and they should be the color you selected.
Now let's add two more style rules for the other polygons in the dataset. 10. Click Add rule. For the new display rule, change the Fill color to blue, and set the Border Width to 0. 11. Click Add filter and set the filter to CLASS == Bays and Channels. 12. Click Add rule to add a third rule. This time, set the Fill color to pink, the Border Width to 0, and add a filter for CLASS == Watersheds.
13. Click Apply to apply your styles to the dataset on the map. You've now applied three display rules to the map, and the result is that each subregion is highlighted with its own color: Baylands, turquoise; Bays and Channels, blue; Watersheds, pink. If you zoom in on your map in a region that contains all three types of class, you can see this highlighting in action.
We can stay where we are, with our vector layer open in the Style editor, for the next step in the tutorial.
4. Style info windows and publish layer Info windows are balloons that appear when someone clicks a feature in your layer. You can configure an info window to show informative content—using both text and pictures—about the area that’s clicked. For our Baylands map, we’ll create an info window to show different images depending on whether you click the Baylands, Bays and Channels, or Watersheds areas of the map. 1. At the top of the style editor page, click the Info windows tab. The contents of an info window are built from HTML that you enter in the Info windows tab. The default HTML that appears in the Info windows tab lists every attribute in the
vector table. Left as is, it produces a default info window, which doesn't add much for someone viewing this map. To test it, click somewhere on the map to display the info window for that area.
We'll change the default HTML in the tab so that the resulting info window actually displays helpful images and text. 2. Edit the HTML content in the tab's text box (on the left) to match the HTML content below. You can copy the text below and paste it into the text box, replacing the content that's there.
What is this edited HTML doing? To understand that better, look back at the default info
window above, which simply displays all the attributes in the vector table. The IMAGE1, IMAGE2, and URL attributes are actually URLs. What the edited HTML code does is add the necessary tags, such as
5. Click Exit to exit the style editor and return to the Layer details page.
Publish your layer Now that you're done styling the layer and the Info window, you're ready to publish your layer. This makes the layer available to be used in a map. (Note: This step does not publish the layer to the public.)
6. Click Publish layer.
When the layer is published, the Publish layer button turns into an Unpublish layer button. 7. Click Edit details in the left column. 8. In the Edit layer details dialog box, enter a description and one or more tags for the layer. 9. Click Save. You're now back on the Layer details page for the published vector data layer. Only one step to go!
5. Add vector layer to a map and publish After creating and publishing a vector layer in Maps Engine, your next step is to add the layer to a map. You can then publish your map publicly on the Internet, internally to your organization, or privately to trusted colleagues. 1. Make sure you're still on the Layer details page of the SF baylands vector layer that we styled and published in the last step. If you're previewing the layer in map view, click Layer details
at top right to return to the Layer details page.
2. Click Create > Map.
3. In the Create new map dialog box, give your map a title. For this exercise, enter: San Francisco Bay Map. 4. Click Create. You should now see a preview of your map, with your vector layer visible. From this page it's easy to modify your map and its layers, using the various menus and buttons that are called out below:
Here are some of the things you can do in the future from the map preview page: Click Add layers to add more layers to your map. Edit layer styles Click the Show layer pull-down list, then use the Layers menu to view layer details, edit layer name, or remove a layer from the map.
Mouse over the map name to show the edit link, which lets you edit the map name and description.
Click Sharing
to define who has edit access and viewing access to the map.
Hover over the Base map icon, then click the Change link to change the base map that underlies your image data layer. Click Map details view to switch to the map details page. Now you're ready to publish your map. While you can do this from the map view page, we'll switch to the map details page to publish. 5. At the top of the page, click Map details view. 6. In the map details page, click Publish map. The message at the top of the page changes to Publishing map, then to Map was published. If you later need to unpublish this map, click Unpublish map. You're done! But remember, publishing your map does not make the map or its layers public —it only publishes the map to those users you've chosen to share the map with or make it viewable to. To go farther and make your map available to users on the Internet, see the Share your online map tutorial.
6. What's next? Go to the next tutorial: Share your map online, or you can build a different sample map with the Make a map with image data tutorial. Check out the Maps Engine Roadmap help topic. See more tutorials focused on nonprofit use cases at the Google Earth Outreach site. Check out how organizations like World Wildlife Fund and Living Oceans Society are using Google Maps Engine!