Home arrow Forum
Home
About
Demo
Forum
FAQ
Live Sites
Feedback

Login





Lost Password?
No account yet? Register
Stay Tuned!
 
Who's Online
We have 3 members online

powered_by Joomla
ME Forum
Welcome, Guest
Please Login or Register.    Lost Password?
Re:Hacking ME to get google maps to work (100% ??) (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:Hacking ME to get google maps to work (100% ??)
#4011
JohanSoderstrom (User)
Junior Boarder
Posts: 27
graphgraph
User Offline Click here to see the profile of this user
Hacking ME to get google maps to work (100% ??) 12 Months ago Karma: 2  
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 ".&quot.

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&quot.innerHTML = "<ul class=\"gmapSidebar\">"+ sidebar_html +"</ul>";', $this->sidebar_id) . "\n";
}

and replace it with

if($this->sidebar) {
// $_output .= sprintf('document.getElementById("%s&quot.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 &quot;n&quot;'s.... you will figure it out <br><br>Post edited by: JohanSoderstrom, at: 2007/07/11 08:56
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4018
admin (Admin)
Admin
Posts: 562
graph
User Offline Click here to see the profile of this user
Gender: Male MisterEstate Location: South Germany
Re:Hacking ME to get google maps to work (100% ??) 12 Months ago Karma: 31  
Hi Johan,

thanks for your contribution. Such moments enhance my motivation, because it´s nice to see, that there are users out there which give something back and help to revise and improve MisterEstate!

I´m currently verybusy with moving to my &quot;new&quot; appartment and a lot of other work. When I find a little free time, I´m going to establish something like a &quot;howto &amp; hacks corner&quot; and move your posting there.<br><br>Post edited by: admin, at: 2007/07/11 03:48
 
Report to moderator   Logged Logged  
 
kindly regards / beste Gruesse

Admin
  The administrator has disabled public write access.
#4070
eGulp (User)
Senior Boarder
Posts: 51
graphgraph
User Offline Click here to see the profile of this user
Re:Hacking ME to get google maps to work (100% ??) 11 Months, 3 Weeks ago Karma: 0  
Cannot see any &quot;demo&quot; on link you posted because seem no post in there.

So I write to ask if the Google map integration include the road indications pre installed,
so when I look where is the house I can and have just to input where I start and have back instructions to arrive to the house; Do you have included it ?
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4071
JohanSoderstrom (User)
Junior Boarder
Posts: 27
graphgraph
User Offline Click here to see the profile of this user
Re:Hacking ME to get google maps to work (100% ??) 11 Months, 3 Weeks ago Karma: 2  
As this is a live website there is only offerings there when we have them, but trust me - it works.

In the version I have there are no &quot;how to get there&quot; instructions (well, there is, sort of...) - but the API has a sidebar included, so hacking the files to include this function would not be so difficult.

To get the driving instructions you can click a how to get there link and a full Google maps will open up, in my theme driving instructions will not fit in, and as all locations are in the same city it was not needed...

Again, I am confident that you can include this function with a few hours of hacking the API...

Cheers
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4232
abray (User)
Fresh Boarder
Posts: 3
graphgraph
User Offline Click here to see the profile of this user
Re:Hacking ME to get google maps to work (100% ??) 11 Months, 1 Week ago Karma: 0  
You say, &quot;download GMapAPI.class.new.php&quot; but where is this file located in the Download area? I cannot find it to download. Thanks.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4249
JohanSoderstrom (User)
Junior Boarder
Posts: 27
graphgraph
User Offline Click here to see the profile of this user
Re:Hacking ME to get google maps to work (100% ??) 11 Months, 1 Week ago Karma: 2  
It is not avaliable in the download area of this webste. There was a discussion in this forum about it..

You can find the API at http://www.phpinsider.com/php/code/GoogleMapAPI/

note that there might be a new verson out, I do not knwo...

Cheers

Johan
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop