close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Address Marker Color From Recordset?

Thread began 8/10/2009 3:32 pm by Cactus Gary | Last modified 8/14/2009 4:09 pm by Eric Mittman | 4120 views | 8 replies |

Cactus Gary

Address Marker Color From Recordset?

I'd like different color address markers (pins) on the map. I'm trying to pull the image file name from the data recordset. I created the map using the color Pacifica. Then replaced "pacifica" in the code with the recordset binding. Pins are shown on the map but only in one color. Help! Here's my code:

var icon_0 = new GIcon();
icon_0.image = 'google_javascript/images/traditionalflat_<?php echo $row_rsMap['proptype']; ?>.png';
icon_0.shadow = 'google_javascript/images/traditionalflat_shadow.png';
icon_0.iconSize = new GSize(34,35);
icon_0.shadowSize = new GSize(34,35);
icon_0.iconAnchor = new GPoint(9,33);
icon_0.infoWindowAnchor = new GPoint(19,0);
icon_0.printImage = 'google_javascript/images/traditionalflat_<?php echo $row_rsMap['proptype']; ?>.gif';
icon_0.mozPrintImage = 'google_javascript/images/traditionalflat_<?php echo $row_rsMap['proptype']; ?>_mozprint.png';
icon_0.printShadow = 'google_javascript/images/traditionalflat_shadow.gif';
icon_0.transparent = 'google_javascript/images/traditionalflat_<?php echo $row_rsMap['proptype']; ?>_transparent.png';

<?php $rsMap_id = 0; ?>
<?php do { ?>
var address_0_<?php echo $rsMap_id; ?> = {
street: '<?php echo str_replace("'", "\'", "".$row_rsMap['address'] .""); ?>',
city: '<?php echo str_replace("'", "\'", "".$row_rsMap['city'] .""); ?>',
state: '',
zip: '',
country: '',
infowindow: 'custom',
infowindowtext: '<span style="font: 10px Verdana, Arial, Helvetica, sans-serif; color: black;"><?php echo str_replace("'", "\'", "Property ID: ".$row_rsMap['propertyid'] ."<br />Type: ".$row_rsPropCat['propcategory'] ."<br />Location: ".$row_rsMap['city'] .", ".$row_rsMap['state'] ."<br />Status: ".$row_rsMap['status'] ."<br />Loan Amount: ".$row_rsMap['loanamt'] ."<br />".$row_rsMap['sqftunits'] ."<br />Call 480-634-8596 to speak to an ORION <br />representative regarding this opportunity."); ?></span>',
full: '<?php echo str_replace("'", "\'", "".$row_rsMap['address'] .""); ?>, <?php echo str_replace("'", "\'", "".$row_rsMap['city'] .""); ?>',
isdefault: true,
addressType: 'address',
loop: 'rsMap',
latitude: '',
longitude: '',
markerStyle: 'Google Traditional (flat)',
markerColor: '<?php echo $row_rsMap['proptype']; ?>'
};


Thanks, Gary

Sign in to reply to this post

Cactus Gary

I see the marker image variables are outside the loop. Moving the code inside the loop doesn't work. I just get pins with random colors. If the marker variables were inside the loop like the info bubble, this would work.

Sign in to reply to this post

Eric Mittman

I have done a little testing with this and here is what I have found. You can have the markers for the locations be specified dynamically like you are trying to do. Here is how I did it. I first made sure that I had the images for all the different colors and styles of markers that I was going to use. I then had to store the image and shadow image names in the individual records in the db.

Once all the images are available and you store the image and it's shadow in the db you are ready to alter the code. In your wagmp_maps_1.php you will need to find the location where the markers are set, then copy this code into the loop just after the do statement.

Once in the loop you can add in your reference to the column that stored the image you want to use like this:

icon_0.image = 'google_javascript/images/<?php echo str_replace("'", "\'", "".$row_Recordset1['marker_file_name'] .""); ?>';

This will get you all of your points showing with the markers you specified in the db. If you are having trouble with this please post back with a URL where this can be seen and I will take a look.

Sign in to reply to this post

Cactus Gary

I don't know if I'm putting the code in the right place. In Firefox I get colored pins and they appear to be correct except for one. In IE8 the pins are all one color. Here's my line of code:

icon_0.image = 'google_javascript/images/<?php echo str_replace("'", "\'", "".$row_rsMap['pinimg'] .""); ?>';

I'm placing it after this statement: <?php do { ?>

If you want to see my test page: test4.php?loan1=A
Click either of the first two loan amounts. Blue pins should indicate retail properties. Green pins should be offices.

The image file names I'm pulling from the recordset are: traditionalflat_pacifica.png and traditionalflat_granitepine.png. Should I be using gif or another file?

Thanks for your help!

Sign in to reply to this post

Cactus Gary

By the way, I copied the code from: wagmp_maps_1.php into the page instead of using an include file.

Sign in to reply to this post

Eric Mittman

When I examine the source code for this page I think I can spot the problem. It looks like you are only redefining the image value in the loop like this:

icon_0.image =

This only will set the value for a single instance, you will need to copy all of the code that this part was taken from and have it all in the loop. The most important part is the line of code that should come before this:

var icon_0 = new GIcon();

You must have this and the other parts of the code inside of the loop for this to work.

Sign in to reply to this post

Cactus Gary

I cut and pasted the image code after "do" as shown below but still no luck. Please let me know if this isn't correct.

<?php $rsMap_id = 0; ?>
<?php do { ?>
var icon_0 = new GIcon();
icon_0.image = 'google_javascript/images/<?php echo str_replace("'", "\'", "".$row_rsMap['pinimg'] .""); ?>';
icon_0.shadow = 'google_javascript/images/traditionalflat_shadow.png';
icon_0.iconSize = new GSize(34,35);
icon_0.shadowSize = new GSize(34,35);
icon_0.iconAnchor = new GPoint(9,33);
icon_0.infoWindowAnchor = new GPoint(19,0);
icon_0.printImage = 'plugins/google_javascript/images/traditionalflat_pacifica.gif';
icon_0.mozPrintImage = 'plugins/google_javascript/images/traditionalflat_pacifica_mozprint.png';
icon_0.printShadow = 'google_javascript/images/traditionalflat_shadow.gif';
icon_0.transparent = 'google_javascript/images/traditionalflat_pacifica_transparent.png';


Map test page: test4.php?loan1=A&loan2=B&loan3=C

Sign in to reply to this post

Cactus Gary

If you look at the page source code after a map is generated, the correct pin image file names are being inserted for: icon_0.image. But for some reason the right color (image file) isn't appearing on the map.

Thanks, Gary

Sign in to reply to this post

Eric Mittman

I have created a ticket for this issue. Please login to WebAssist.com and visit your support history to update the ticket. I will need to have a copy of your google_javascript folder in order to do some more testing.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...