PDA

View Full Version : Directions To Here and From Here in info window


dave.classick353712
04-28-2009, 03:55 PM
Has anyone figured out how to implement "to here" and "from here" directions in the info window of a map created with ProMaps?

alpine
05-11-2009, 02:44 AM
I would imagine that you would need to add in some of the following in a custom infowindow (note that the address variable at the end would probably need to be your actual address or a recordset):

<p><b>Driving Directions</b><br>Enter your start address (street, town, postcode):<form action="http://maps.google.com/maps" method="get" target="_blank">' +
'<input type="text" size=40 maxlength=40 name="saddr" id="saddr" value="" /><br><br>' +
'<input value="Get Directions" type="submit">' +
'<input type="hidden" name="daddr" value="' + address + '"></p>

Ray Borduin
05-11-2009, 08:39 AM
Yeah... there is an example in the prostores demo of directions to here... from here would be almost identical.

It was added manually after the map was created: http://www.powerstore-demo.com/AboutUs.php

troyd
05-19-2009, 09:21 PM
Ray,
This is exactly what I am looking for. I really like how this example has the form built into the information window. I've looked through all of my Pro Maps pdf files and do not find any reference to this. Do you have a link to some direction on creating this type of map?

Thanks,
TroyD

Ray Borduin
05-20-2009, 07:07 AM
You can view the javascript source from that page to see how it was done. I couldn't find any references that talk about it.

Kind of complex to explain, but you could probably just apply promaps on your page, then hijack that code from the sample and replace your javascript code ... then just update the address.

troyd
05-20-2009, 08:38 AM
Thanks Ray,

I had been examining the javascript on that page. But I wasn't sure if it was acceptable practice for me to copy it. I do believe I understand what I need to do. If not, I will most likely post the page in progress and see if I can get you to look at it.

Thanks again,
TroyD

stephenr.cohen388705
09-29-2009, 03:39 PM
I am not a php programmer and cannot identify which part of the powerstore-aboutus page code will add the ability of the user to input their address; nor which .js file to use and where in the file the code wold go. Can you be more specific? My site is skandertire.com/directions1.html. Thanks.
Steve

Ray Borduin
09-30-2009, 09:52 AM
If you aren't a programmer I would copy and paste the entire javascript page and edit the address and API key from there. You won't be able to understand and add individual pieces if you don't understand script in general.

joe5828
11-08-2009, 05:31 AM
I have modified the code used to work with the pro maps directions method - it re-loads same page with directions included next to map

<?php do { ?>
var address_0_<?php echo $Recordset; ?> = {
street: '<?php echo str_replace("'", "\'", "".$row_Recordset['address0'] .""); ?>',
city: '<?php echo str_replace("'", "\'", "".$row_Recordset['address1'] .""); ?>',
state: '',
zip: '<?php echo str_replace("'", "\'", "".$row_Recordset['postcode'] .""); ?>',
country: 'UK',
infowindow: 'custom',
infowindowtext: '<span style="font: 10px Verdana, Arial, Helvetica, sans-serif; color: black;"><?php echo str_replace("'", "\'", "<strong>GP:</strong> ".$row_Recordset['firstname'] . " " .$row_Recordset['name'] ."<br>".$row_Recordset['email'] .""); ?></span>' +
'<p style="font: 10px Verdana, Arial, Helvetica, sans-serif; color: black;"><b>Distance &amp; directions</b><br><form name="address" method="get">' +
'<label for="postcode">Your postcode:</label> <input type="text" size=10 maxlength=10 name="postcode" id="postcode" value="" />' +
'<input value="Go" type="submit">' +
'<input type="hidden" name="address" value="<?php echo $row_Recordset['postcode']; ?>"></p>',
full: '<?php echo str_replace("'", "\'", "".$row_Recordset['address0'] .""); ?>, <?php echo str_replace("'", "\'", "".$row_Recordset['address1'] .""); ?>, <?php echo str_replace("'", "\'", "".$row_Recordset['postcode'] .""); ?>, UK',
isdefault: false,
addressType: 'address',
loop: 'Recordset',
latitude: '<?php echo str_replace("'", "\'", "".$row_Recordset['grid_east_m'] .""); ?>',
longitude: '<?php echo str_replace("'", "\'", "".$row_Recordset['grid_north_m'] .""); ?>',
markerStyle: 'Google Traditional (flat)',
markerColor: 'Pacifica'
};