[google_map]

Description

Link: [google_map]
Author: Randy Phillips
Category: Utility
Version: 8.5.x
License: Public Domain
Posted: Oct. 27, 2008
Updated: Oct. 27, 2008
More by this author...

The purpose of this tag is to access Google's Static Map API.

Refer to Google's Static Map API for map types, marker types, etc.
Docs @ http://code.google.com/apis/maps/documentation/staticmaps/

This ctag returns a static image file of your choosing of a Google Map. It will also overlay markers and paths. 

Note: To find longitude and latitude coordinates of street addresses use the google_geocode ctag.

Parameters

-size string, required Indicate height and width of map
-key string, required Key to access Google Map API.
-center string, optional A comma seperated string to indicate latitude and longitide of center of map
-zoom string, optional Indicate zoom level (see API for details)
-format string, optional Indicate image file type to be returned
-mapType string, optional Indicate type of map to be returned (see API for details)
-markers array, optional An array of longitude and latitude coordinates to place marker overlays on map (see API for details on sizes, color and types)
-path array, optional An array of longitude and latitude coordinates to draw a path overlay on the map
-frame boolean, optional When True a 5px blue border is drawn around the map

Sample Usage

google_map( 
	-size='475x400',
	-key='MAPS_API_KEY',
	-zoom='14',
	-center='40.711614,-74.012318',
	-mapType='mobile',
	-markers=array('40.702147,-74.015794,reda', '40.711614,-74.012318,tinygreen', '40.713504,-74.005607,midyellowb'),
	-path=array('40.702147,-74.015794', '40.713504,-74.005607'),
	-pathColor='0x0000ff',
	-pathWeight='8',
	-format='gif',
	-frame=true,
	);
						

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
define_tag( 
        'map', 
		-namespace='google_',
        -req='size', 
        -req='key', 
        -opt='center',
        -opt='zoom', 
        -opt='format',
        -opt='mapType',
        -opt='markers', -type='array',
        -opt='path', -type='array',
        -opt='frame', -type='boolean',
        -encodenone
    ); 
    
    !local_defined('center') ? local('center') = string;
    !local_defined('zoom') ? local('zoom') = string;
    !local_defined('format') ? local('format') = string;
    !local_defined('mapType') ? local('mapType') = string;
    !local_defined('markers') ? local('markers') = array;
    !local_defined('path') ? local('path') = array;    
    !local_defined('pathColor') ? local('pathColor') = '0x0000ff';
    !local_defined('pathWeight') ? local('pathWeight') = '5';
    !local_defined('frame') ? local('frame') = false;
    
    local('imgURL') = '<img src="http://maps.google.com/staticmap?size=' + #size + '&key=' + #key;
  
   
   // add optional center of map 
    #center ? #imgURL += '&center=' + #center;
    
   // add zoom level to map (API defaults to 0 or world level)
    #zoom ? #imgURL += '&zoom=' + #zoom;
    
   // add optional image file format of map (API defaults to .gif)
    #format ? #imgURL += '&format=' + #format;
    
   // add optional type of map (API defaults to Mobile)
    #mapType ? #imgURL += '&maptype=' + #mapType;
    
    // if true adds optional blue 5px frame around map
    #imgURL += '&frame=' + #frame;
    
   // overlay markers on map (also indicate marker size, color and labels in array)
    #markers->size > 0 ? #imgURL += '&markers=';
    
    iterate(#markers, local('str'));
    	#imgURL +=  #str + '|';
    /iterate;
    
    #imgURL->removetrailing('|');
    
    // overlay paths between two or more points on map (uses RGB color codes for path color)
    #path->size > 1 ? #imgURL += '&path=rgb:' + #pathColor + ',weight:' + #pathWeight + '|';
    
    iterate(#path, local('str'));
    	#imgURL +=  #str + '|';
    /iterate;
    
    #imgURL->removetrailing('|');
    
    
    #imgURL += '" />';
    
     return(#imgURL); 
     
/define_tag;

 

Related Tags



Comments

none

Email:


Password:



Newest

Most Popular