View previous topic :: View next topic |
Author |
Message |
kimusan Smarty n00b
Joined: 29 Sep 2006 Posts: 4
|
Posted: Fri Sep 29, 2006 9:02 pm Post subject: GoogleMapAPI problems - no map images shown |
|
|
Hi
I am trying to add a simple map to my homepage, but noting shows up on the map. The frame, controls etc are there, but the background is just grey (no maps).
You can see for yourself here:
www.schulz.dk/getmap.php
The code is the one from the example on the homepage, except that I have disabled the DSN since my webhotel does not support PEAR.
And ofcause I am using my own google api key.
Any ideas on what is wrong? |
|
Back to top |
|
DerrickBB Smarty n00b
Joined: 29 Sep 2006 Posts: 1
|
Posted: Fri Sep 29, 2006 11:00 pm Post subject: |
|
|
I had the same problem and here's how I worked around it. I am using the following code from the API page.
Code: | <?php
require('GoogleMapAPI.class.php');
// pass yahoo app id (something unique) if you are using the
// YAHOO lookup service, which is default
$map = new GoogleMapAPI('map');
// setup database for geocode caching
$map->setDSN('mysql://USER:PASS@localhost/GEOCODES');
// enter YOUR Google Map Key
$map->setAPIKey('YOURGOOGLEMAPKEY');
// create some map markers
$map->addMarkerByAddress('621 N 48th St # 6 Lincoln NE 68502','PJ Pizza','<b>PJ Pizza</b>');
$map->addMarkerByAddress('826 P St Lincoln NE 68502','Old Chicago','<b>Old Chicago</b>');
$map->addMarkerByAddress('3457 Holdrege St Lincoln NE 68502',"Valentino's","<b>Valentino's</b>");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<?php $map->printHeaderJS(); ?>
<?php $map->printMapJS(); ?>
<!-- necessary for google maps polyline drawing in IE -->
<style type="text/css">
v\:* {
behavior:url(#default#VML);
}
</style>
</head>
<body onload="onLoad()">
<table border=1>
<tr><td>
<?php $map->printMap(); ?>
</td><td>
<?php $map->printSidebar(); ?>
</td></tr>
</table>
</body>
</html> |
Find:
Code: | // setup database for geocode caching
$map->setDSN('mysql://USER:PASS@localhost/GEOCODES'); |
And comment out:
Code: | // setup database for geocode caching
// $map->setDSN('mysql://USER:PASS@localhost/GEOCODES'); |
Next I created a page called conn.php which simply connects to the datbase.
Code: | $conn = mysql_connect (localhost,USERNAME,PASSWORD) or die ("Could not connect");
mysql_select_db(DBNAME,$conn) or die ("Could not select DB"); |
Now go to the class file around line 360 and change the function to this:
Code: | function setDSN($dsn) {
$this->dsn = $dsn;
include('conn.php');
} |
All my files are in the same directory so set yours up as needed. This works fine for me.
Hope this helps,
Derrick |
|
Back to top |
|
kimusan Smarty n00b
Joined: 29 Sep 2006 Posts: 4
|
Posted: Sat Sep 30, 2006 7:39 am Post subject: |
|
|
unfortunately that didn't help for me. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Sat Sep 30, 2006 1:47 pm Post subject: |
|
|
Code: | Fatal error: Call to undefined function: is_a() in /mnt/web_dk/web_domains/schulz.dk/public_html/DB.php on line 590 |
|
|
Back to top |
|
kimusan Smarty n00b
Joined: 29 Sep 2006 Posts: 4
|
Posted: Sat Sep 30, 2006 2:00 pm Post subject: |
|
|
yep stopped working on it in the middle of the test. If I comment out the setDSN line, then this error will disappear. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Sat Sep 30, 2006 3:17 pm Post subject: |
|
|
google is your friend.
Quote: | I'm getting a 'Call to undefined function: is_a()' error
If you are using a PHP version prior to PHP 4.2.0 you should consider updating to PHP 4.3.10 or higher, this will fix the problem. An alternative solution is to install the PEAR package PHP_Compat. |
|
|
Back to top |
|
kimusan Smarty n00b
Joined: 29 Sep 2006 Posts: 4
|
Posted: Sat Sep 30, 2006 9:46 pm Post subject: |
|
|
ahh that explains it. webhotel has planned to upgrade php, but probably not for the next month or so. |
|
Back to top |
|
ideo3 Smarty n00b
Joined: 10 Oct 2006 Posts: 2
|
Posted: Tue Oct 10, 2006 9:23 am Post subject: Re: GoogleMapAPI problems - no map images shown |
|
|
Same problem
.. .any solutions?
Thanks, Thomas
kimusan wrote: | Hi
I am trying to add a simple map to my homepage, but noting shows up on the map. The frame, controls etc are there, but the background is just grey (no maps).
You can see for yourself here:
www.schulz.dk/getmap.php
The code is the one from the example on the homepage, except that I have disabled the DSN since my webhotel does not support PEAR.
And ofcause I am using my own google api key.
Any ideas on what is wrong? |
|
|
Back to top |
|
ideo3 Smarty n00b
Joined: 10 Oct 2006 Posts: 2
|
Posted: Tue Oct 10, 2006 9:25 am Post subject: Help |
|
|
I've the same problem... but my code doesn't work... any solutions?
www.ideogroup.it/concept/casa/12345/test.php
Thanks,
Thomas
DerrickBB wrote: | I had the same problem and here's how I worked around it. I am using the following code from the API page.
Code: | <?php
require('GoogleMapAPI.class.php');
// pass yahoo app id (something unique) if you are using the
// YAHOO lookup service, which is default
$map = new GoogleMapAPI('map');
// setup database for geocode caching
$map->setDSN('mysql://USER:PASS@localhost/GEOCODES');
// enter YOUR Google Map Key
$map->setAPIKey('YOURGOOGLEMAPKEY');
// create some map markers
$map->addMarkerByAddress('621 N 48th St # 6 Lincoln NE 68502','PJ Pizza','<b>PJ Pizza</b>');
$map->addMarkerByAddress('826 P St Lincoln NE 68502','Old Chicago','<b>Old Chicago</b>');
$map->addMarkerByAddress('3457 Holdrege St Lincoln NE 68502',"Valentino's","<b>Valentino's</b>");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<?php $map->printHeaderJS(); ?>
<?php $map->printMapJS(); ?>
<!-- necessary for google maps polyline drawing in IE -->
<style type="text/css">
v\:* {
behavior:url(#default#VML);
}
</style>
</head>
<body onload="onLoad()">
<table border=1>
<tr><td>
<?php $map->printMap(); ?>
</td><td>
<?php $map->printSidebar(); ?>
</td></tr>
</table>
</body>
</html> |
Find:
Code: | // setup database for geocode caching
$map->setDSN('mysql://USER:PASS@localhost/GEOCODES'); |
And comment out:
Code: | // setup database for geocode caching
// $map->setDSN('mysql://USER:PASS@localhost/GEOCODES'); |
Next I created a page called conn.php which simply connects to the datbase.
Code: | $conn = mysql_connect (localhost,USERNAME,PASSWORD) or die ("Could not connect");
mysql_select_db(DBNAME,$conn) or die ("Could not select DB"); |
Now go to the class file around line 360 and change the function to this:
Code: | function setDSN($dsn) {
$this->dsn = $dsn;
include('conn.php');
} |
All my files are in the same directory so set yours up as needed. This works fine for me.
Hope this helps,
Derrick |
|
|
Back to top |
|
ezar Smarty n00b
Joined: 22 Oct 2006 Posts: 2
|
Posted: Sun Oct 22, 2006 12:22 am Post subject: error with insert code |
|
|
For solve this you need to change this:
Code: | $_res =& $_db->query('insert into ? values (?, ?, ?)', array($this->_db_cache_table, $address, $lon, $lat)); |
for this:
Code: | $_sth =& $_db->prepare('insert into '.$this->_db_cache_table.' values (?, ?, ?)');
$_db->execute($_sth, array($address, $lon, $lat));
|
in GoogleMapsAPI.class.php |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Sun Oct 22, 2006 5:42 pm Post subject: Re: error with insert code |
|
|
ezar wrote: | For solve this you need to change this:
Code: | $_res =& $_db->query('insert into ? values (?, ?, ?)', array($this->_db_cache_table, $address, $lon, $lat)); |
for this:
Code: | $_sth =& $_db->prepare('insert into '.$this->_db_cache_table.' values (?, ?, ?)');
$_db->execute($_sth, array($address, $lon, $lat));
|
in GoogleMapsAPI.class.php |
fixed in CVS thanks. |
|
Back to top |
|
ronberry Smarty n00b
Joined: 10 Oct 2007 Posts: 3
|
|
Back to top |
|
prchakal Smarty n00b
Joined: 20 Oct 2007 Posts: 2
|
|
Back to top |
|
moosus Smarty n00b
Joined: 12 Feb 2008 Posts: 1
|
Posted: Tue Feb 12, 2008 1:26 am Post subject: |
|
|
Just a quick not to say thanks guys ... after pulling my hair out for a while I found this thread and it solved most of my problems.
Thanks for this class
Cheers
moosus |
|
Back to top |
|
eatc7402 Smarty Rookie
Joined: 18 Feb 2008 Posts: 23
|
Posted: Mon Feb 18, 2008 6:34 am Post subject: |
|
|
Well, I'm kind of at a rock and a hard place. I'm attempting to use the
GoogleMapAPI.class.php for the first time. Using the sample code provided in the readme file in the distribution package. with all my test files in the same dir. When I attempt to preview it
in my Rapid PHP editor (which works fine on all other php files) all I get for output is the RAW CODE instead of anything else... like this...
Code: | setDSN('mysql://USER:PASS@localhost/GEOCODES'); // enter YOUR Google Map Key $map->setAPIKey('YOURGOOGLEMAPKEY'); // create some map markers $map->addMarkerByAddress('621 N 48th St # 6 Lincoln NE 68502','PJ Pizza','PJ Pizza'); $map->addMarkerByAddress('826 P St Lincoln NE 68502','Old Chicago','Old Chicago'); $map->addMarkerByAddress('3457 Holdrege St Lincoln NE 68502',"Valentino's","Valentino's"); ?> printHeaderJS(); ?> printMapJS(); ?>
printMap(); ?> printSidebar(); ?>
|
I don't understand this, or why?
I must be doing something wrong, or have something incorrectly installed. But what?
eatc7402
[/code] |
|
Back to top |
|
|