Customizing Google Map Dashboards in Code Ignitor with the BIOSTALL Google Map Library

I learned from this thread that setting up google map pan is pretty simple. Working in Java script using google map API.

Unfortunately I am not good at Java script and my project is in Codeigniter. I used the BIOSTALL google map library for Codeigniter which works great (thanks BIOSTALL ), but now I am stuck with the last thing and that is map panels definition and dynamic scaling. I wonder if anyone has experience with this and can he help me how to do it in codeigner.

I need to display all the map markers that are returned from a search query. Below is my code for collecting markers and creating a map.

    $zip_codes=$this->search_model->get_zip_codes();

    for($i=0;$i<count($zip_codes);$i++)
    {
        $data['marker_items']=$this->search_model->get_items_by_zip_code($data['search'],$zip_codes[$i]['zip']);
        $marker = array();
        $marker['position'] = $data['marker_items'][0]['latitude'].','.$data['marker_items'][0]['longitude'];
        $map_markers=$this->load->view('map_marker',$data,true);
        $marker['infowindow_content']=$map_markers;
        $marker['icon'] = 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld='.count($data['marker_items']).'|3399FF|000000';
        $this->googlemaps->add_marker($marker);
    }
    $data['map'] = $this->googlemaps->create_map();

      

I get the coordinates of the center of the map in two ways;

  • If the user is logged in. Get coordinates from his address
  • If the user is logged out. Get its coordinates from your IP address.

My site link

Thanks for any help. Thanks to

+3


source to share


1 answer


You can use $config['zoom'] = 'auto';

. It will act as the fit function of the JS map library.



You can also set a minimum zoom level to get not very deep scaling and a good user experience.

+2


source







All Articles