Hi
After some hours of looking around and testing I finally got Google maps to work as it should, with centering and everything...
To do this I did the following:
1. Download the GoogleMaps api as previously suggested in this forum. I called this file "GMapAPI.class.new.php".
2. In estateagent.php change the following
// $gmap = new GoogleMapAPI('map'

;
// $gmap->setAPIKey($ea_gmap_key);
// $gmap->setWidth($ea_gmap_width);
// $gmap->setHeight($ea_gmap_height);
// $gmap->setMapType($ea_gmap_type);
// // string $address the map address to mark (street/city/state/zip)
// $gmap->addMarkerByAddress($address,"GMap Test","GMap Description"

;
to:
//NOTE! Depending on where you live this will be different! This works for sweden, figure out how your country has it!
$address = "$obj->street $obj->streetnr $obj->pcoce $obj->town $obj->country";
require($mosConfig_absolute_path."/components/com_estateagent/includes/GMapAPI.class.new.php"

;
$gmap = new GoogleMapAPI('map'

;
$gmap->setAPIKey($ea_gmap_key);
$gmap->setWidth($ea_gmap_width);
$gmap->setHeight($ea_gmap_height);
$gmap->setMapType($ea_gmap_type);
//string $address the map address to mark (street/city/state/zip)
$gmap->addMarkerByAddress($address, "<strong>Go here</strong><br>now!!"

;
//$gmap->setCenterCoords($lat,$lon);
$VDloc1=17.618550;
$VDloc2=59.855620;
$gmap->setCenterCoords($VDloc1,$VDloc2);
---
The coordinates above was used in phase 1 of my attempts. they will not be used if you have a real location so you can leave them untouched, or you can edit them if you want to.
IF you want the map to center on a different location than your centerpoint you NEED to do the following:
Find
if(isset($this->center_lat) && isset($this->center_lon)) {
$_output .= sprintf('map.setCenter(new GLatLng(%s, %s), %s, %s);', $this->center_lat, $this->center_lon, $this->zoom, $this->map_type) . "\n";
}
in the GMaps....new.php file and put
$this->center_lat = number_format($this->center_lat, 6, '.', ''

;
$this->center_lon = number_format($this->center_lon, 6, '.', ''

;
right infront of it. This will change the way numbers are displayed (there was a problem with "," and "."

.
IF you have a REAL possition, so that you get a marker you should ALSO comment out the command, like
if(isset($this->center_lat) && isset($this->center_lon)) {
// $_output .= sprintf('map.setCenter(new GLatLng(%s, %s), %s, %s);', $this->center_lat, $this->center_lon, $this->zoom, $this->map_type) . "\n";
}
IF you commented it out you need to put it back in, go to:
if(isset($this->center_lat) && isset($this->center_lon)) {
$_output .= sprintf('map.setCenter(new GLatLng(%s, %s), %s, %s);', $this->center_lat, $this->center_lon, $this->zoom, $this->map_type) . "\n";
}
and replace it with
if(isset($this->center_lat) && isset($this->center_lon)) {
// $_output .= sprintf('map.setCenter(new GLatLng(%s, %s), %s, %s);', $this->center_lat, $this->center_lon, $this->zoom, $this->map_type) . "\n";
$_output .= sprintf('map.setCenter(new GLatLng(%s, %s), %s, %s);', $_marker['lat'], $_marker['lon'], $this->zoom, $this->map_type) . "\n";
}
there, now it should work. It seems to work here at least. One important thing is to get the address format correct.
I am sorry if this guide is difficult to follow, but I have a deadline and if I do not type it now I will never do it...
I hope I didn't miss anything, if you cannot get it working let me know and I will see if I missed something...
It is atleast working at
www.v-dala.se
----
EDIT 5 minutes later:
This is using ME 1.1.0 and version 2.3 of GoogleMapAPI. you can find that here
http://www.phpinsider.com/php/code/GoogleMapAPI/
I get an error, so I hunted it down, you (might?) need to find
if($this->sidebar) {
$_output .= sprintf('document.getElementById("%s"

.innerHTML = "<ul class=\"gmapSidebar\">"+ sidebar_html +"</ul>";', $this->sidebar_id) . "\n";
}
and replace it with
if($this->sidebar) {
// $_output .= sprintf('document.getElementById("%s"

.innerHTML = "<ul class=\"gmapSidebar\">"+ sidebar_html +"</ul>";', $this->sidebar_id) . "\n";
$_output .= "\n";
}
For me this does no difference except that I get no errors, I do not know how this will affect things in general...
Cheers
Johan
Post edited by: JohanSoderstrom, at: 2007/07/10 09:38
Edit again...
There is a problem here in the forum with displaying backslash... There are backslahes infront of some "n"'s.... you will figure it out

<br><br>Post edited by: JohanSoderstrom, at: 2007/07/11 08:56