Adding one simple layer
Almost everything you need to do will involve the gv_options.map_type_control variable. In the first example, we'll create a map with a very specific custom layer: aerial photos of the damage done by a tornado in Moore, Oklahoma in May 2013.
The map tiles are stored on the Google Crisis Response server, and each tile's URL looks something like this: http://mw1.gstatic.com/crisisresponse/2013/2013-oklahoma-tornado/digitalglobe/OK_PO_1194054_GE1_2013_05_23_maptiles/1877_3235_13.png
Those last three numbers are the X (longitude), Y (latitude), and Z (zoom) "coordinates" of the tile. Typically, Z will be the smallest number (almost always between 0 and 20); the others are X and Y, but not always in that order. (Sometimes there will be documentation that tells you explicitly which is which.) In the custom code that you insert into your map, you'll replace the numbers with {X}, {Y}, and {Z}; those curly brackets are important.
For our simple tornado damage example, we can incorporate the tiles into our map using a statement like this:
gv_options.map_type_control.custom = [
{
id:"MOORE_TORNADO"
,menu_name:"Moore tornado"
,url:"http://mw1.gstatic.com/crisisresponse/2013/2013-oklahoma-tornado/digitalglobe/OK_PO_1194054_GE1_2013_05_23_maptiles/{X}_{Y}_{Z}.png"
,credit:"Imagery from Google Crisis Response"
}
];
The url parameter is the most important; menu_name is useful because it defines how your new map shows up in the map type menu; credit is what shows up at the bottom of the map, and it can include HTML code such as hyperlinks. You'll want to remember what you choose for the id if you want the map to initially load with your custom map visible, because you would place that value in the gv_options.map_type variable.
|