blankblank blank




Thematic Polygon Shapefile Display In Google Maps



There are a number of free ways to convert shapefiles to KML format for display in Google Earth, but fewer and less flexible shapefile display options for Google Maps. This site lets you upload small line and polygon shapefiles for display in Google Maps, but not in a permanent form, and with limited display options. This other site details a procedure to display polygon shapefiles in Google Maps, but it’s not particularly straightforward to implement. There’s also some direct support for displaying simple KML files in Google Maps, so you could always try converting the shapefiles to KML and then opening them in Google Maps. But there’s a Java application that makes the process reasonably straightforward for polygon shapefiles, shows the data already loaded in a Google Maps interface, and offers some added display options.

The Google Map Creator can be downloaded from the University College of London’s Centre for Advanced Spatial Analysis. The Windows version, which I’ll describe below, comes in installer format; there’s also a Java archive version that can be run in either Linux or Macintosh. Download and install the program in Windows; it will also install the Java Advanced Imaging Library.You will also need:

1. A shapefile with an associated projection definition file (.prj). If your shapefile doesn’t have a .prj file, you can create one using the free GIS editor MapWindow. Open MapWindow, select GIS Tools => Vector => Assign Projection To Shapefile, and follow the straightforward process of selecting your shapefile and its coordinate system to create a .prj file. The shapefile doesn’t have to be in latitude/longitude/WGS84, unless Google Map Creator has problems re-projecting the data into the correct coordinate system, and it will tell you that.

2. A thematic variable you can plot that is numeric in nature – Google Map Creator doesn’t handle alphabetic variables yet. For small ranges of alphabetic variable, you could open the DBF file in OpenOffice, make a copy of that column, and replace the alphabetic variables with discrete numeric values, but with larger numbers of alphabetic variables this can become very tedious.

3. If you want to post the map you create on the web, you’ll need a free Google Map API key. If you’re only going to use the map on a local computer, a key isn’t needed.

Start up the program, and use File => Open to load your shapefile (in this case, rainfall across the US; click on the picture to view a larger version of the image):

Google Map Creator interface for plotting shapefile data in Google Maps

From the drop-down menu at the top, select the shapefile variable to use as the plotting theme, Range in this case. If you want to see the outlines of the shapefile polygons, click on the Outlines button at the top:

Google Map Creator interface for plotting shapefile data in Google Maps

To select the colors to plot the precipitation range by, click on the “Cols” button at the top:

Google Map Creator interface for plotting shapefile data in Google Maps

Click on Add to add another color; check the Select box and click Delete to delete a color. Double-click on a Value or Description to modify it. As you modify the values, they will automatically be sorted from low to high. Clicking once on a color bar brings up a palette that allows you to select a desired color. Selecting Discrete makes that color apply only to the specific value specified; selecting Transition makes the color for a value shade from one value to another. For example, with the following values entered, and Transition selected:

Google Map Creator interface for plotting shapefile data in Google Maps

the resulting map looks like this:

Google Map Creator interface for plotting shapefile data in Google Maps

where, for example, shades of orange represent values between red (10 inches and less) and yellow (25 inches).

At the left, you set the maximum permissible zoom level in the Google Maps interface. Higher zoom levels mean larger number of image tiles to be generated, stored, and served up. For example, a maximum zoom of 4 creates 16 tiles, while a maximum zoom of 8 will generate 1422 tiles.

Finally, select Edit => Page Data. Here you enter your Google API key if you have and need one, the minimum API version required (usually 2 is fine), and the title of the map:

Google Map Creator interface for plotting shapefile data in Google Maps

Click on Create in the lower right-hand corner, then Start, and the image tiles and an HTML file needed to display the Google Maps interface will be created in the same directory that holds the original shapefile. The image tiles will be stored in a directory with the filename of the shapefile with “-tiles” appended; the HTML file will have the filename of the shapefile with an .html extension. There will also be a ucl75547A.gif file in the directory, the logo of University College of London. To view the newly-created Google Map with the shapefile thematic overlay, open the HTML file in your browser:

Google Map Creator interface for plotting shapefile data in Google Maps

The map key at the upper-right includes the range descriptions entered above. Below the map key are buttons that let you set the transparency of the thematic overlay. “Map” sets the transparency at 100% (no overlay visible), “Data” sets the transparency at 0% (fully opaque), and the fraction buttons set transparency in between those values; the map above is shown at “1/2″ transparency.

If you’ve entered a valid Google Map API key into the Page Data, you can now upload the HTML files and image tile directory to the web server of your choice for public Internet access to your map.

Other posts in the Google Maps Tools series

  1. Coordinate Data From Google Maps
  2. Reverse Address Geocoding With Google Maps
  3. Converting Google Maps Search Results To GPX
  4. Coordinate, Elevation, Distance And More In Google Maps
  5. Google Maps "My Maps" Features
  6. Measuring Elevation, Distance And Area In Google Maps
  7. Creating GPS Routes In Google Maps
  8. Thematic Polygon Shapefile Display In Google Maps
  9. Using The Google Maps Interface To Display General Maps And Images
  10. Heat Mapping In Google Maps
  11. Elevation Profile In Google Maps
  12. Embed Google Maps "My Maps" On Your Web Page
  13. Customizing Google Maps Markers
  14. Two Fun Cartographic Google Maps Tools
  15. Simple Guide To Embedding Google Maps "My Maps" On Your Own Webpage
  16. Another Google Maps Geocoder/Reverse Geocoder
  17. Drawing Lines Between Points In Google Maps, Straight And Great Circle
  18. Convert A Google Maps Point To Multiple Text Geographic Formats
  19. Meet Your Friends Halfway
  20. Plotting Swivel Data In Google Maps
  21. Meet Your Friends Halfway II
  22. Geographic Midpoint Calculator
  23. GIS-Like Functionality In Google Maps With ZeeMaps
  24. Creating GPS Waypoints Online From The USGS Geographic Names Information System (GNIS)
  25. MapMyRide.com
  26. Exporting KML Data From Google Maps MyMaps To A GPS
  27. Advanced Tool For Embedding Google Maps MyMaps On Your Website
  28. Draw/Label On Google Maps, And Generate GPX/KML/Embeddable Maps
  29. Another Way To Create Embeddable Google Maps With KML Data
  30. Documenting A Journey With Maptales
  31. Plot A Coordinate Position On Different Map Pages
  32. Worldwide Reverse Geocoding With Google Maps
  33. Google Maps Shaded Relief Site Updates
  34. Digipoint 2: Export Of Google Maps Points In Multiple Formats, And Elevation Data
  35. Google Maps Line Tool Now Supports Distance Measurement
  36. Geographically-Linked Video With VeoGeo
  37. Recent Google Maps Tools
  38. Google Maps Mapplets From Zonums Software
  39. Maximize Google Maps With Google Maps Max
  40. Mapping Zip And Area Code Boundaries, And More
  41. Altitudes And Terrain Profiles In Google Maps
  42. “Friendly” URLs To Address Maps
  43. Quick Zip Code Information
  44. Simple Online Form For Creating An Embeddable Google Map
  45. Embed Synchronized Google/Microsoft Virtual Earth Maps On Your Website/Blog
  46. Worldwide Contour Lines In Google Maps’ Terrain View
  47. Plot Gazetteer Features In A Google Maps Interface
  48. Antipodes Map

Looking for something else? Enter some keywords below, then click "Search".
"This site" searches Free Geography Tools; "Web" searches the Internet using Google.
 



2 Responses to “Thematic Polygon Shapefile Display In Google Maps”


  1. 1 Devin

    Could you explain this a little better?

    “2. A thematic variable you can plot that is numeric in nature – Google Map Creator doesn’t handle alphabetic variables yet. For small ranges of alphabetic variable, you could open the DBF file in OpenOffice, make a copy of that column, and replace the alphabetic variables with discrete numeric values…”

    I’ve been trying to use GMapCreator to convert a US Congressional District shapefile from the Census Bureau into custom tiles, but I keep running into an error that I can’t seem to figure out. At first, I was getting the .prj error message (even when it existed) but eventually seemed to have gotten past then. Then, it looks as though everything is proceeding just fine until the very end when I get this message: “No fields in the shapefile contain numeric data. The file must contain geometry and at least one numeric field which determines the value of the region.”

    Any suggestions?

  2. 2 Leszek Pawlowicz

    I’m guessing that your shapefile doesn’t have a numeric field, e.g. one describing population, growth rate, etc., and the GMapCreator requires at least one. By opening the shapefile’s DBF file and adding a field with numbers, you could get around that; for example, creating a column of numbers representing the district number.

Leave a Reply


I welcome all legitimate comments. But spammers should know that my spam filters are currently blocking almost 100% of comment spam, and any that gets through the filters is immediately deleted. Don't believe me? Try posting a spam comment, and see what happens.

Powered by WP Hashcash