68 Classifieds Forums

Google Maps Module for V3 & V4

This is a discussion on Google Maps Module for V3 & V4 within the v4 Modules / Modifications forums, part of the Help & Support 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 > Help & Support > v4 Modules / Modifications

Reply
 
LinkBack Thread Tools Display Modes
  #11  
Old 09-13-2008, 06:49 PM
Member
 
Join Date: Aug 2008
Posts: 42
Rep Power: 2
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
Reply With Quote
  #12  
Old 09-13-2008, 06:57 PM
Lhotch's Avatar
Moderator
 
Join Date: Mar 2006
Posts: 3,663
Rep Power: 90
Lhotch is just really niceLhotch is just really nice
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.
(Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free)

Set your site apart from the competition with one of my modules......
Google Map Module | You Tube Module | Google Calendar Module

68 Classifieds Important Links
Customer Area | Issue Tracker | Knowledge Base | User Manuals
Reply With Quote
  #13  
Old 09-14-2008, 12:06 PM
Member
 
Join Date: Aug 2008
Posts: 42
Rep Power: 2
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
Reply With Quote
  #14  
Old 09-14-2008, 01:11 PM
Lhotch's Avatar
Moderator
 
Join Date: Mar 2006
Posts: 3,663
Rep Power: 90
Lhotch is just really niceLhotch is just really nice
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.
(Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free)

Set your site apart from the competition with one of my modules......
Google Map Module | You Tube Module | Google Calendar Module

68 Classifieds Important Links
Customer Area | Issue Tracker | Knowledge Base | User Manuals
Reply With Quote
  #15  
Old 09-14-2008, 10:42 PM
Member
 
Join Date: Aug 2008
Posts: 42
Rep Power: 2
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 10:53 PM.
Reply With Quote
  #16  
Old 09-14-2008, 10:44 PM
Member
 
Join Date: Aug 2008
Posts: 42
Rep Power: 2
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 11:09 PM.
Reply With Quote
  #17  
Old 09-14-2008, 11:08 PM
Lhotch's Avatar
Moderator
 
Join Date: Mar 2006
Posts: 3,663
Rep Power: 90
Lhotch is just really niceLhotch is just really nice
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.
(Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free)

Set your site apart from the competition with one of my modules......
Google Map Module | You Tube Module | Google Calendar Module

68 Classifieds Important Links
Customer Area | Issue Tracker | Knowledge Base | User Manuals
Reply With Quote
  #18  
Old 09-14-2008, 11:23 PM
SS
 
Join Date: Mar 2008
Posts: 71
Rep Power: 5
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
__________________
NewcastleDirectory
Reply With Quote
  #19  
Old 09-29-2008, 09:05 AM
Lhotch's Avatar
Moderator
 
Join Date: Mar 2006
Posts: 3,663
Rep Power: 90
Lhotch is just really niceLhotch is just really nice
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.
(Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free)

Set your site apart from the competition with one of my modules......
Google Map Module | You Tube Module | Google Calendar Module

68 Classifieds Important Links
Customer Area | Issue Tracker | Knowledge Base | User Manuals
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Google Maps Module - Beta tester needed. Lhotch v4 Questions & Support 17 07-30-2008 01:30 PM
Google Map module - beta tester needed. Lhotch v3.1 Questions & Support 0 04-29-2008 01:34 PM
Google Maps LittleRascal v3.1 Modules & Modifications 1 02-05-2008 10:16 AM
Google Juice fjarabeck Site Marketing 0 04-27-2006 02:40 PM


All times are GMT -4. The time now is 06:44 PM.


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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22