Support Forums

Google Maps Module for V3 & V4

This is a discussion on Google Maps Module for V3 & V4 within the Modules / Plugins / Modifications forums, part of the Developer Forums category; One more question.... ....is there any way to display map in listing preview, so user will see if his map ...


Go Back   68 Classifieds Forums > Developer Forums > Modules / Plugins / Modifications

Reply
 
Thread Tools Display Modes
Old 09-13-2008, 05:49 PM   #11
Member
 
Join Date: Aug 2008
Posts: 42
Rep Power: 8
MiśUszatek is on a distinguished road
Default

One more question....

....is there any way to display map in listing preview, so user will see if his map is correct?
__________________
68 Classifieds » version 4.0.8 Designer
MiśUszatek is offline   Reply With Quote
Old 09-13-2008, 05:57 PM   #12
curmudgeon
 
Join Date: Mar 2006
Posts: 5,225
Rep Power: 128
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

No there is not. The best thing to do is to tell people to test their address at google first. They can also go back in and edit the address after the ad is placed.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline   Reply With Quote
Old 09-14-2008, 11:06 AM   #13
Member
 
Join Date: Aug 2008
Posts: 42
Rep Power: 8
MiśUszatek is on a distinguished road
Default

where I should look if I want to change GIcon?

I was looking at iconImage parameter in GoogleMapAPI.class.php ....is that correct file? If so...what exactly I need to change to provide URL to icon and shadow?
__________________
68 Classifieds » version 4.0.8 Designer
MiśUszatek is offline   Reply With Quote
Old 09-14-2008, 12:11 PM   #14
curmudgeon
 
Join Date: Mar 2006
Posts: 5,225
Rep Power: 128
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

I dont know exactly what needs to be changed or if its possible with the API that I use. You would have to experiment.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline   Reply With Quote
Old 09-14-2008, 09:42 PM   #15
Member
 
Join Date: Aug 2008
Posts: 42
Rep Power: 8
MiśUszatek is on a distinguished road
Default

I know exactly what but since I don't have programing skills I would need a little guide

in API guide I found note:
Quote:
setMarkerIcon($iconImage,$iconShadowImage,$iconAnc horX,$iconAnchorY,$infoWindowAnchorX,$infoWindowAn chorY)
----------------------------------------------------------------------------------------------------------

This sets the icon image for ALL the map markers. Call this once. If you
want to set a different icon for each marker, use addMarkerIcon()
instead.

You must supply a separate image for the icon and its shadow.
iconAnchorX/Y is the X/Y coordinates of the icon for the map point.
infoWindowAnchorX/Y is the X/Y coordinates of the icon where the info
window connects.

The iconImage and iconShadowImage can be either fully qualified URLs, or
a relative path from your web server DOCUMENT_ROOT. These images MUST
exist and readable so the library can calculate the dimensions.

Example:

$map->setMarkerIcon('/images/house.png','/images/house_shadow.png',0,0,10,10);
so I placed this in the code:

Quote:
/**
* generate an array of params for a new marker icon image
* iconShadowImage is optional
* If anchor coords are not supplied, we use the center point of the image by default.
* Can be called statically. For private use by addMarkerIcon() and setMarkerIcon()
*
* @param string $iconImage URL to icon image
* @param string $iconShadowImage URL to shadow image
* @param string $iconAnchorX X coordinate for icon anchor point
* @param string $iconAnchorY Y coordinate for icon anchor point
* @param string $infoWindowAnchorX X coordinate for info window anchor point
* @param string $infoWindowAnchorY Y coordinate for info window anchor point
*/

$map->setMarkerIcon('/images/arroe.png','/images/arrow_shadow.png',0,0,10,10);


function createMarkerIcon($iconImage,$iconShadowImage = '',$iconAnchorX = 'x',$iconAnchorY = 'x',$infoWindowAnchorX = 'x',$infoWindowAnchorY = 'x') {
$_icon_image_path = strpos($iconImage,'http') === 0 ? $iconImage : $_SERVER['DOCUMENT_ROOT'] . $iconImage;
if(!($_image_info = @getimagesize($_icon_image_path))) {
die('GoogleMapAPI:createMarkerIcon: Error reading image: ' . $iconImage);
}
if($iconShadowImage) {
$_shadow_image_path = strpos($iconShadowImage,'http') === 0 ? $iconShadowImage : $_SERVER['DOCUMENT_ROOT'] . $iconShadowImage;
if(!($_shadow_info = @getimagesize($_shadow_image_path))) {
die('GoogleMapAPI:createMarkerIcon: Error reading image: ' . $iconShadowImage);
}
}

if($iconAnchorX === 'x') {
$iconAnchorX = (int) ($_image_info[0] / 2);
}
if($iconAnchorY === 'x') {
$iconAnchorY = (int) ($_image_info[1] / 2);
}
if($infoWindowAnchorX === 'x') {
$infoWindowAnchorX = (int) ($_image_info[0] / 2);
}
if($infoWindowAnchorY === 'x') {
$infoWindowAnchorY = (int) ($_image_info[1] / 2);
}

$icon_info = array(
'image' => $iconImage,
'iconWidth' => $_image_info[0],
'iconHeight' => $_image_info[1],
'iconAnchorX' => $iconAnchorX,
'iconAnchorY' => $iconAnchorY,
'infoWindowAnchorX' => $infoWindowAnchorX,
'infoWindowAnchorY' => $infoWindowAnchorY
);
if($iconShadowImage) {
$icon_info = array_merge($icon_info, array('shadow' => $iconShadowImage,
'shadowWidth' => $_shadow_info[0],
'shadowHeight' => $_shadow_info[1]));
}
return $icon_info;
}

/**
* set the marker icon for ALL markers on the map
*/
function setMarkerIcon($iconImage,$iconShadowImage = '',$iconAnchorX = 'x',$iconAnchorY = 'x',$infoWindowAnchorX = 'x',$infoWindowAnchorY = 'x') {
$this->_icons = array($this->createMarkerIcon($iconImage,$iconShadowImage,$ico nAnchorX,$iconAnchorY,$infoWindowAnchorX,$infoWind owAnchorY));

}

/**
* add an icon to go with the correspondingly added marker
*/
function addMarkerIcon($iconImage,$iconShadowImage = '',$iconAnchorX = 'x',$iconAnchorY = 'x',$infoWindowAnchorX = 'x',$infoWindowAnchorY = 'x') {
$this->_icons[] = $this->createMarkerIcon($iconImage,$iconShadowImage,$ico nAnchorX,$iconAnchorY,$infoWindowAnchorX,$infoWind owAnchorY);
return count($this->_icons) - 1;
}

/**
* print map header javascript (goes between <head></head>)
*
*/
function printHeaderJS() {
echo $this->getHeaderJS();
}
.....but that didn't work (since I'm not a programmer probably i messed up something )
__________________
68 Classifieds » version 4.0.8 Designer

Last edited by MiśUszatek; 09-14-2008 at 09:53 PM.
MiśUszatek is offline   Reply With Quote
Old 09-14-2008, 09:44 PM   #16
Member
 
Join Date: Aug 2008
Posts: 42
Rep Power: 8
MiśUszatek is on a distinguished road
Default

well, I'm not sure if I placed this line in correct place but it didn't work, so I checked my old project for different site where I used custom icon for Google map.




look at part of current GoogleMapAPI.class.php

Quote:
function getMapJS() {
$_output = '<script type="text/javascript" charset="utf-8">' . "\n";
$_output .= '//<=!=[=C=D=A=T=A=[' . "\n";
$_output .= "/*************************************************\ n";
$_output .= " * Created with GoogleMapAPI " . $this->_version . "\n";
$_output .= " * Author: Monte Ohrt <monte AT ohrt DOT com>\n";
$_output .= " * Copyright 2005-2006 New Digital Group\n";
$_output .= " * http://www.phpinsider.com/php/code/GoogleMapAPI/\n";
$_output .= " *************************************************/\n";

$_output .= 'var points = [];' . "\n";
$_output .= 'var markers = [];' . "\n";
$_output .= 'var counter = 0;' . "\n";
if($this->sidebar) {
$_output .= 'var sidebar_html = "";' . "\n";
$_output .= 'var marker_html = [];' . "\n";
}

if($this->directions) {
$_output .= 'var to_htmls = [];' . "\n";
$_output .= 'var from_htmls = [];' . "\n";
}

if(!empty($this->_icons)) {
$_output .= 'var icon = [];' . "\n";
for($i = 0, $j = count($this->_icons); $i<$j; $i++) {
$info = $this->_icons[$i];

// hash the icon data to see if we've already got this one; if so, save some javascript
$icon_key = md5(serialize($info));
if(!isset($exist_icn[$icon_key])) {

$_output .= "icon[$i] = new GIcon();\n";
$_output .= sprintf('icon[%s].image = "%s";',$i,$info['image']) . "\n";

if($info['shadow']) {
$_output .= sprintf('icon[%s].shadow = "%s";',$i,$info['shadow']) . "\n";

$_output .= sprintf('icon[%s].shadowSize = new GSize(%s,%s);',$i,$info['shadowWidth'],$info['shadowHeight']) . "\n";
}
$_output .= sprintf('icon[%s].iconSize = new GSize(%s,%s);',$i,$info['iconWidth'],$info['iconHeight']) . "\n";
$_output .= sprintf('icon[%s].iconAnchor = new GPoint(%s,%s);',$i,$info['iconAnchorX'],$info['iconAnchorY']) . "\n";
$_output .= sprintf('icon[%s].infoWindowAnchor = new GPoint(%s,%s);',$i,$info['infoWindowAnchorX'],$info['infoWindowAnchorY']) . "\n";
} else {
$_output .= "icon[$i] = icon[$exist_icn[$icon_key]];\n";
}
}
}
now I compared this with my custom google map icon from different project:


Quote:
var icon = new GIcon();
icon.image = \"template/tm/images/red_arrow.png\";
icon.shadow = \"template/tm/images/red_arrow_shadow.png\";

icon.iconSize = new GSize(36, 29);
icon.shadowSize = new GSize(36, 29);
icon.iconAnchor = new GPoint(10, 25);
icon.infoWindowAnchor = new GPoint(15, 10);
so everything is defined by icon.image & icon.shadow which in this GoogleMapAPI is defined as $iconImage.
Now... where exactly and how I can define URL for that?
__________________
68 Classifieds » version 4.0.8 Designer

Last edited by MiśUszatek; 09-14-2008 at 10:09 PM.
MiśUszatek is offline   Reply With Quote
Old 09-14-2008, 10:08 PM   #17
curmudgeon
 
Join Date: Mar 2006
Posts: 5,225
Rep Power: 128
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Quote:
Originally Posted by MiśUszatek View Post
so everything is defined by icon.image & icon.shadow which in this GoogleMapAPI is defined as $iconImage.
Now...where exactly and how I can define URL for that?
where you have

icon.image = \"template/tm/images/red_arrow.png\";

you could tryusing a complete URL.....ie
icon.image = \"http://mysite.com/template/tm/images/red_arrow.png\";

But I cant guarantee it will work.

One thing you have to realize, the API release by google is for using javascript. The API I use is a class which takes PHP and creates the javascript to create the map. All I did was create a wrapper to allow easy implementation of the php API to be used with 68C.

Because of the way the PHP API interacts with the javascript API I did have some issues with getting images to display on the map marker due to semi hard coded paths in the API and I have not pursued a solution because its just a fluffy add on and not realy necessary for the modul to work as I designed it.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline   Reply With Quote
Old 09-14-2008, 10:23 PM   #18
Hunter Classifieds.com.au
 
newcastledirectory's Avatar
 
Join Date: Mar 2008
Posts: 101
Rep Power: 12
newcastledirectory is on a distinguished road
Default Google Map

Hi Larry
I am still hopping that you figured out why the module will not work on my suite yet?

SS
Newcastledirectory
Hunter Classifieds.com.au
__________________
Hunter Classifieds

v4.1.4 Designer Deepsea
newcastledirectory is offline   Reply With Quote
Old 09-29-2008, 08:05 AM   #19
curmudgeon
 
Join Date: Mar 2006
Posts: 5,225
Rep Power: 128
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Quote:
Originally Posted by newcastledirectory View Post
Hi Larry
I am still hopping that you figured out why the module will not work on my suite yet?

SS
Newcastledirectory
Hunter Classifieds.com.au
Its not a problem with the module but how your site is running. You have 68C installed in the root of one domain, then you haveit installed in a subdirectory, which is a subdomain.

While normally this isnt a problem, it appears that you 68C site is using some files from the root doamin and others form the subdomain and in turn the files are located in 2 different places and because of this when the map modul coad is added to the proper template its not being loaded because your site is using files from the other install.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline   Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Google Maps Module - Beta tester needed. Lhotch Technical Support 17 07-30-2008 12:30 PM
Google Juice fjarabeck Site Marketing 0 04-27-2006 01:40 PM


All times are GMT -4. The time now is 12:25 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0