Welcome Guest, Not a member yet? Register   Sign In
Google Maps and CodeIgniter?
#1

[eluser]Sinclair[/eluser]
Hi,

I need to insert some google maps in a CodeIgniter application. There are some extra(3 party) classes that could help me?

Best Regards,
#2

[eluser]Ben Edmunds[/eluser]
Yes. Check it out here: http://codeigniter.com/wiki/Google_Maps/
#3

[eluser]megabyte[/eluser]
I'm looking for some information, code, examples or just being pointed in the right direction.


I need to do what this website has done:

http://www.spoonfedsoup.com/Articles.asp?ID=124

It shades an area showing delivery zones.

Thanks,

K
#4

[eluser]Ben Edmunds[/eluser]
That's an overlay.

Better start reading up on javascript and the google maps api Wink

Or prepare for the future and use their new xml api...
#5

[eluser]megabyte[/eluser]
Glimpsed over it,but couldn't find where to get the latitude points. to create the overlay
#6

[eluser]BrianDHall[/eluser]
This is the one I use, I give it my full endorsement: http://www.phpinsider.com/php/code/GoogleMapAPI/

I use it on the site I created here: http://rentals800.com

You just have to rig it up for CI, which isn't hard. The main change is it was created to use PEAR's DB, so just search for "db" and you'll find a few places you'll need to make adjustments to make it work with CI.

Hm, come to think of it I guess there are a few things I did, so I'll just include the file here for your convenience if you want to use it.

Usage: stick it in the libraries folder of your application, then in your controller:

Code:
$this->output->enable_profiler(TRUE);
        
        $this->load->library('googlemapapi');

        $map = new GoogleMapAPI('map');
        
        $map->setAPIKey($this->google_api_key);
    
        // create some map markers
        $map->addMarkerByAddress('900 Gulf Breeze Pkwy','Marker Test','<b>Bold Marker Test</b>');
        
        $data['map'] =& $map;

        $this->load->view('test_gmap', $data);

And the view:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
&lt;html &gt;
&lt;head&gt;
&lt;?php $map->printHeaderJS(); ?&gt;
&lt;?php $map->printMapJS(); ?&gt;
&lt;!-- necessary for google maps polyline drawing in IE --&gt;
&lt;!--&lt;style type="text/css"&gt;
  v\:* {
    behavior:url(#default#VML);
  }
&lt;/style&gt;--&gt;
&lt;/head&gt;

&lt;body&gt;
    <div>
        &lt;?php $map->printMap(); ?&gt;
    </div>
    
&lt;/body&gt;
&lt;/html&gt;

You'll of course need to set your api key to test it out in your environment.

This class also needs 1 table for its geocodes, which I highly recommend. It stores lat and long of addresses it has checked before for improved performance.

The thing I really like about this one is how easy it is to add markers by address. I never have to think of lat and long, it handles that crap through the addMarkerByAddress() method.
#7

[eluser]BrianDHall[/eluser]
Oh and for shading out a delivery area? I'd look into the page code to see what functions they were using, beats the heck out of me. First time I've ever seen that.
#8

[eluser]Ben Edmunds[/eluser]
Is order to do the overlay that you want you'll need to reference this http://code.google.com/apis/maps/documen...rlays.html

The google documentation doesn't really spell out how to do the advanced features but it's definitely in there.

This article might also be helpful, http://www.maptiler.org/google-maps-over...y-control/


Enjoy!
#9

[eluser]Sinclair[/eluser]
[quote author="BrianDHall" date="1261430527"]This is the one I use, I give it my full endorsement: http://www.phpinsider.com/php/code/GoogleMapAPI/

I use it on the site I created here: http://rentals800.com

You just have to rig it up for CI, which isn't hard. The main change is it was created to use PEAR's DB, so just search for "db" and you'll find a few places you'll need to make adjustments to make it work with CI.

Hm, come to think of it I guess there are a few things I did, so I'll just include the file here for your convenience if you want to use it.

Usage: stick it in the libraries folder of your application, then in your controller:

Code:
$this->output->enable_profiler(TRUE);
        
        $this->load->library('googlemapapi');

        $map = new GoogleMapAPI('map');
        
        $map->setAPIKey($this->google_api_key);
    
        // create some map markers
        $map->addMarkerByAddress('900 Gulf Breeze Pkwy','Marker Test','<b>Bold Marker Test</b>');
        
        $data['map'] =& $map;

        $this->load->view('test_gmap', $data);

And the view:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
&lt;html &gt;
&lt;head&gt;
&lt;?php $map->printHeaderJS(); ?&gt;
&lt;?php $map->printMapJS(); ?&gt;
&lt;!-- necessary for google maps polyline drawing in IE --&gt;
&lt;!--&lt;style type="text/css"&gt;
  v\:* {
    behavior:url(#default#VML);
  }
&lt;/style&gt;--&gt;
&lt;/head&gt;

&lt;body&gt;
    <div>
        &lt;?php $map->printMap(); ?&gt;
    </div>
    
&lt;/body&gt;
&lt;/html&gt;

You'll of course need to set your api key to test it out in your environment.

This class also needs 1 table for its geocodes, which I highly recommend. It stores lat and long of addresses it has checked before for improved performance.

The thing I really like about this one is how easy it is to add markers by address. I never have to think of lat and long, it handles that crap through the addMarkerByAddress() method.[/quote]

Thanks a lot, I will try it right now!

Best Regards,
#10

[eluser]Sinclair[/eluser]
Hi,

I have tested, but I got an strange error:

Code:
An Error Was Encountered
Unable to load the requested class: curl

What can I do? I have cURL enable on XAMPP.


Best Regards,




Theme © iAndrew 2016 - Forum software by © MyBB