Partager Envoyer


Bibliothèque Leaflet (cartographie)

Cette bibliothèque externe (Codeigniter-Leaflet-Library), inutilisée dans l'application, est fournie afin de faciliter l'intégration de cartes rendues à l'aide de la bibliothèque Javascript Leaflet directement dans vos contrôleurs et vues.

Son fichier README est reproduit ci-après.

Simple Leaflet JS library for Codeigniter

Features :

  • Create Simple Map
  • Add marker / multiple marker
  • Custom marker icon

Installation :

Upload Leaflet.php file application/libraries/ directory

Using the libraries :

  1. Loading library

  2. Include Leaflet CSS & JS file in the head section of your document:

     <script src="//code.jquery.com/jquery-1.11.2.min.js"></script> // or latest jquery
     <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />	
     <script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
  3. Let's show the map ! Controller :

     $config = array(
     	'center'         => '-0.959, 100.39716', // Center of the map
     	'zoom'           => 12, // Map zoom
     $marker = array(
     	'latlng' 		=>'-0.959, 100.39716', // Marker Location
     	'popupContent' 	=> 'Hi, iam a popup!!', // Popup Content
     $this->data['map'] =  $this->leaflet->create_map();

    On the view file :

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

Feel free to send me an email if you have any problems ;)


Anggri Yulio P



Ce document a été publié le 2018-12-13 12:45:31. (Dernière mise à jour : 2019-07-11 02:38:42.)

This website uses 'cookies' to enhance user experience and provide authentification. You may change which cookies are set at any time by clicking on more info. Accept