CodeIgniter Forums
google maps position problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: google maps position problem (/thread-53412.html)



google maps position problem - El Forum - 07-23-2012

[eluser]mattylux[/eluser]
hello
I have a problem in positioning map of google maps
inside of the page this tutorial http://biostall.com/codeigniter-google-maps-v3-api-library
in the library I found many things to change the map but not to move it.
thanks




google maps position problem - El Forum - 07-23-2012

[eluser]NotDior[/eluser]
You'll have to give us more information? Did you set your center?

You'll need to set it in the array you pass to the initialize. Kind of like this:

Code:
$config['center'] = "41.1323,-104.8126";
$config['zoom'] = '12';
$config['map_height'] = "350px";
$config['map_width'] = "660px";
$config['sensor'] = FALSE; // there was a bug with this in an earlier version...can't confirm if it's been fixed or not.  Possibly has been.



google maps position problem - El Forum - 07-23-2012

[eluser]mattylux[/eluser]
thanks
I was able to decrease the size of the map,
now remains on the left of the page I want to take it to the center of the page or on the right


google maps position problem - El Forum - 07-23-2012

[eluser]NotDior[/eluser]
Moving the map on your page is going to be a result of your CSS or however you've got your page created. I've got a couple of different sites using this library and the map is where I want it on the page.


google maps position problem - El Forum - 07-23-2012

[eluser]phann123[/eluser]
THank you every people


google maps position problem - El Forum - 07-23-2012

[eluser]mattylux[/eluser]
this is my controller

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Mappa extends CI_Controller {


public function index()
                
{
$this->load->library('googlemaps');

$config['center'] = '44.339963, 11.292732';
$config['zoom'] = 12;
$config['map_height'] = "350px";
$config['map_width'] = "660px";
$config['sensor'] = FALSE;
$this->googlemaps->initialize($config);



$circle = array();
$circle['center'] = '44.339963, 11.292732';
$circle['radius'] = '100';
$this->googlemaps->add_circle($circle);


$data['map'] = $this->googlemaps->create_map();


I want to do and put in the middle of the page map



google maps position problem - El Forum - 07-23-2012

[eluser]mattylux[/eluser]
this is my view

Code:
<!DOCTYPE html>
&lt;html&gt;
    
    &lt;head&gt;
        
        &lt;?php echo $map['js']; ?&gt;

    &lt;/head&gt;
    &lt;body&gt;
        
        &lt;?php echo $map['html']; ?&gt;

    &lt;/body&gt;
    
&lt;/html&gt;


how can I change the css on this code?



google maps position problem - El Forum - 07-23-2012

[eluser]boltsabre[/eluser]
Basic css positioning using a wrapper div champ !!!
Code:
<div s.tyle="margin-left:100px">
    &lt;?php echo $map['html']; ?&gt;
</div>
(replace s.tyle with style)

Or whatever works... depending on the rest of your code you may want/have to use one of (or a combination of):
- float:right;
- padding-left:100px;
- position:relative; left:100px;
- position:absolute; left:100px;


google maps position problem - El Forum - 07-23-2012

[eluser]CroNiX[/eluser]
Keep in mind that if your div holding your map is initially hidden, like it's in a tab or something, that you will have to trigger a "resize" event on the map when that tab is activated so it can redraw it or it won't be centered (or part of the map is missing). If the div is initially hidden, maps can't calculate the area needed to display. It can only do it once the div is shown.
Code:
google.maps.event.trigger(map, 'resize');



google maps position problem - El Forum - 07-24-2012

[eluser]mattylux[/eluser]
thank you!!!! I solved the problem I was able to put the map where I wanted

Sad