-
Notifications
You must be signed in to change notification settings - Fork 9
/
polylines.php
61 lines (45 loc) · 1.35 KB
/
polylines.php
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
<?php
// This is for my examples
require( '_system/config.php' );
$relevant_code = array(
'\PHPGoogleMaps\Overlay\Polyline',
'\PHPGoogleMaps\Overlay\Poly',
'\PHPGoogleMaps\Overlay\PolyDecorator'
);
// Autoload stuff
require( '_system/autoload.php' );
$map = new \PHPGoogleMaps\Map;
use \PHPGoogleMaps\Service\Geocoder;
$polyline_paths = array(
Geocoder::geocode( 'San Diego, CA' ),
Geocoder::geocode( 'Austin, TX' ),
Geocoder::geocode( 'New Haven, CT' ),
Geocoder::geocode( 'Seattle, WA' )
);
$polyline_options = array(
'strokeColor' => '#0000ff',
'clickable' => false
);
$polyline = new \PHPGoogleMaps\Overlay\Polyline( $polyline_paths, $polyline_options );
$polyline->addPath( 'San Francisco, CA' );
$map->disableAutoEncompass();
$map->setCenter( 'Austin, TX' );
$map->setZoom( 3 );
$polyline_map = $map->addObject( $polyline );
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Polylines - <?php echo PAGE_TITLE ?></title>
<link rel="stylesheet" type="text/css" href="_css/style.css">
<?php $map->printHeaderJS() ?>
<?php $map->printMapJS() ?>
</head>
<body>
<h1>Polylines</h1>
<?php require( '_system/nav.php' ) ?>
<?php $map->printMap() ?>
<a href="#" onclick="<?php echo $polyline_map->getJsVar() ?>.setMap(null);return false;">Hide polylines</a>
</body>
</html>