Demos:
Simple Marker | Multiple Markers | Polyline | Polygon | Circle | Rectangle | Ground Overlay | Directions | Clustering Markers
Geolocation | Drawing Manager | Styling The Map | Traffic Overlay | Bicycling Overlay | Panoramio Layer | Street View
KML Layer | Places API Integration | Places Input Autocomplete
Get Co-ordinates At Clicked Position | Add Marker At Clicked Position | Get Co-ordinates Of Dragged Marker
Pass Co-ordinates Back To The Database | Multiple Maps On The Same Page
The Code

Controller File:

$this->load->library('googlemaps');

$config['center'] = '37.4419, -122.1419';
$config['zoom'] = 'auto';
$this->googlemaps->initialize($config);

$polygon = array();
$polygon['points'] = array('37.425, -122.1321',
'37.4422, -122.1622',
'37.4412, -122.1322',
'37.425, -122.1021'); $polygon['strokeColor'] = '#000099'; $polygon['fillColor'] = '#000099'; $this->googlemaps->add_polygon($polygon); $data['map'] = $this->googlemaps->create_map(); $this->load->view('view_file', $data);

View File:

<html>
<head><?php echo $map['js']; ?></head>
<body><?php echo $map['html']; ?></body>
</html>

Return to Library Homepage