google-routebeschrijving

Gesponsorde koppelingen

PHP script bestanden

  1. google-routebeschrijving

« Lees de omschrijving en reacties

Route1.php

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<form action="#" onSubmit="GO('popup.php?from='+this.adres.value+this.space.value+this.postcode.value+this.space.value+this.plaats.value+'&to='+this.toadres.value+this.space.value+this.topostcode.value+this.space.value+this.toplaats.value+'&locale='+this.locale.value); return false">
<!-- SPACE -->
<input type="hidden" id="space" name="space" value=", " />
<!-- /SPACE -->
    <table>
        <tr>
            <td style="height:20px;" colspan="3"><strong>Van: </strong></td>
        </tr>
        <tr>
            <td style="width:50px; height:20px;"></td>
            <td>Adres: </td>
            <td><input type="text" size="25" id="adres" name="adres" onfocus="if(this.value=='Straatnaam'){this.value='';}" onblur="if(this.value==''){this.value='Straatnaam';}" value="Straatnaam"/></td>
        </tr>
        <tr>
            <td style="width:50px; height:20px;"></td>
            <td>Postcode: </td>
            <td><input type="text" size="25" id="postcode" name="postcode" onfocus="if(this.value=='Postcode'){this.value='';}" onblur="if(this.value==''){this.value='Postcode';}" value="Postcode"/></td>
        </tr>
        <tr>
            <td style="width:50px; height:20px;"></td>
            <td>Woonplaats: </td>
            <td><input type="text" size="25" id="plaats" name="plaats" onfocus="if(this.value=='Woonplaats'){this.value='';}" onblur="if(this.value==''){this.value='Woonplaats';}" value="Woonplaats"/></td>
        </tr>
        <tr>
            <td style="height:20px;" colspan="3"><strong>Naar: </strong></td>
        </tr>
        <tr>
            <td style="width:50px; height:20px;"></td>
            <td>Adres: </td>
            <td><input type="text" size="25" id="toadres" name="toadres" onfocus="if(this.value=='Straatnaam'){this.value='';}" onblur="if(this.value==''){this.value='Straatnaam';}" value="Straatnaam"/></td>
        </tr>
        <tr>
            <td style="width:50px; height:20px;"></td>
            <td>Postcode: </td>
            <td><input type="text" size="25" id="topostcode" name="topostcode" onfocus="if(this.value=='Postcode'){this.value='';}" onblur="if(this.value==''){this.value='Postcode';}" value="Postcode"/></td>
        </tr>
        <tr>
            <td style="width:50px; height:20px;"></td>
            <td>Woonplaats: </td>
            <td><input type="text" size="25" id="toplaats" name="toplaats" onfocus="if(this.value=='Woonplaats'){this.value='';}" onblur="if(this.value==''){this.value='Woonplaats';}" value="Woonplaats"/></td>
        </tr>
        
        <tr>
            <td style="height:20px;" colspan="3"><input id="locale" name="locale" type="hidden" value="nl_NL" /></td>
        <tr>
            <td style="width:50px; height:20px;"></td>
            <td colspan="2" align="center"><input name="submit" type="submit" value="Routebeschrijving" /></td>
        </tr>
    </table>
</form>

Route2.php
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<form action="#" onSubmit="GO('popup.php?from='+this.adres.value+this.space.value+this.postcode.value+this.space.value+this.plaats.value+'&to='+this.to.value+'&locale='+this.locale.value); return false">
<!-- SPACE -->
<input type="hidden" id="space" name="space" value=", " />
<!-- /SPACE -->
    <table>
        <tr>
            <td style="width:50px; height:20px;"></td>
            <td>Adres: </td>
            <td><input type="text" size="25" id="adres" name="adres" onfocus="if(this.value=='Straatnaam'){this.value='';}" onblur="if(this.value==''){this.value='Straatnaam';}" value="Straatnaam"/></td>
        </tr>
        <tr>
            <td style="width:50px; height:20px;"></td>
            <td>Postcode: </td>
            <td><input type="text" size="25" id="postcode" name="postcode" onfocus="if(this.value=='Postcode'){this.value='';}" onblur="if(this.value==''){this.value='Postcode';}" value="Postcode"/></td>
        </tr>
        <tr>
            <td style="width:50px; height:20px;"></td>
            <td>Woonplaats: </td>
            <td><input type="text" size="25" id="plaats" name="plaats" onfocus="if(this.value=='Woonplaats'){this.value='';}" onblur="if(this.value==''){this.value='Woonplaats';}" value="Woonplaats"/></td>
        </tr>

        <tr>
            <td><input type="hidden" size="25" id="toAddress" name="to" value="Straatnaam + Huisnummer, Postcode, Plaats" /></td>
        </tr>
        
        <tr>
            <td colspan="3" height="20"><input id="locale" name="locale" type="hidden" value="nl_NL" /></td>
        <tr>
            <td style="width:50px; height:20px;"></td>
            <td colspan="2" align="center"><input name="submit" type="submit" value="Routebescrijving" /></td>
        </tr>
    </table>
</form>

Route3.php
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<form action="#" onSubmit="GO('popup.php?from='+this.adres.value+this.space.value+this.postcode.value+this.space.value+this.plaats.value+'&to='+this.to.value+'&locale='+this.locale.value); return false">
<!-- SPACE -->
<input type="hidden" id="space" name="space" value=", " />
<!-- /SPACE -->
    <table>
        <tr>
            <td style="height:20px;" colspan="3"><strong>Van: </strong></td>
        </tr>
        <tr>
            <td style="width:50px; height:20px;"></td>
            <td>Adres: </td>
            <td><input type="text" size="25" id="adres" name="adres" onfocus="if(this.value=='Straatnaam'){this.value='';}" onblur="if(this.value==''){this.value='Straatnaam';}" value="Straatnaam"/></td>
        </tr>
        <tr>
            <td style="width:50px; height:20px;"></td>
            <td>Postcode: </td>
            <td><input type="text" size="25" id="postcode" name="postcode" onfocus="if(this.value=='Postcode'){this.value='';}" onblur="if(this.value==''){this.value='Postcode';}" value="Postcode"/></td>
        </tr>
        <tr>
            <td style="width:50px; height:20px;"></td>
            <td>Woonplaats: </td>
            <td><input type="text" size="25" id="plaats" name="plaats" onfocus="if(this.value=='Woonplaats'){this.value='';}" onblur="if(this.value==''){this.value='Woonplaats';}" value="Woonplaats"/></td>
        </tr>
        
        <tr>
            <td style="height:20px;" colspan="3"><strong>Naar: </strong></td>
        </tr>
        <tr>
            <td style="width:50px; height:20px;"></td>
            <td>Locatie: </td>
            <td>
                <select name="to" id="toAdress">
                    <option value="Straatnaam + Huisnummer, Postcode, Plaats">Naam Locatie 1</option>
                    <option value="Straatnaam + Huisnummer, Postcode, Plaats">Naam Locatie 2</option>
                </select>
             </td>
        </tr>
        
        <tr>
            <td style="height:20px;" colspan="3"><input id="locale" name="locale" type="hidden" value="nl_NL" /></td>
        <tr>
            <td style="width:50px; height:20px;"></td>
            <td colspan="2" align="center"><input name="submit" type="submit" value="Routebeschrijving" /></td>
        </tr>
    </table>
</form>

Popup.php
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Routebeschrijving</title>
</head>
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=abcdefg&sensor=true"></script>


<script type="text/javascript">
//<![CDATA[
    var map;
    var gdir;
    var geocoder = null;
    var addressMarker;

    function load() {
      if (GBrowserIsCompatible()) {      
        map = new GMap2(document.getElementById("map"));

        geocoder = new GClientGeocoder();
        if (geocoder) {
            geocoder.getLatLng(
              "<?=$_GET[to]?>",
              function(point) {
                if (!point) {
                  alert("<?=$_GET[to]?>" + " niet gevonden");
                } else {
                  map.setCenter(point, 13);
                  //var marker = new GMarker(point);
                  //map.addOverlay(marker);
                  map.setUIToDefault();
                 // marker.openInfoWindowHtml("<b>Tsja</b><br>laatje 3<br> Bergentheim");
                }
              }
            );
        }

        gdir = new GDirections(map, document.getElementById("directions"));
        GEvent.addListener(gdir, "load", onGDirectionsLoad);
        GEvent.addListener(gdir, "error", handleErrors);

        setDirections("The Netherlands", "Hoogeveen", "nl_NL");
        
      }
    }
    
    function setDirections(fromAddress, toAddress, locale) {
      gdir.load("from: " + fromAddress + " to: " + toAddress,
                { "locale": locale });
        checkAddress(fromAddress);
    }
    
    function checkAddress(adres){
        geocoder2 = new GClientGeocoder();
        if (geocoder2) {
            geocoder2.getLatLng(
              adres,
              function(point) {
                if (!point) {
                  alert(adres + " is geen geldig adres. Voer als volgt in: Straat + huisnr, postcode, plaats");
                }
              }
            );
        }
    }

    function handleErrors(){
       if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
         alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.nError code: " + gdir.getStatus().code);
       else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
         alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.n Error code: " + gdir.getStatus().code);
      
       else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
         alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.n Error code: " + gdir.getStatus().code);

    //   else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS)  <--- Doc bug... this is either not defined, or Doc is wrong
    //     alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.n Error code: " + gdir.getStatus().code);
        
       else if (gdir.getStatus().code == G_GEO_BAD_KEY)
         alert("The given key is either invalid or does not match the domain for which it was given. n Error code: " + gdir.getStatus().code);

       else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
         alert("A directions request could not be successfully parsed.n Error code: " + gdir.getStatus().code);
        
       else alert("An unknown error occurred.");
      
    }                        



//]]>

<!--
function timeout(){
    setDirections("<?=$_GET[from]?>", "<?=$_GET[to]?>", "<?=$_GET[locale]?>");
}
setTimeout("timeout()",1000);
-->
</script>
</head>
<body onLoad="load();" onUnload="GUnload()">
<table border="0">
<tr>
    <td style="vertical-align:top; padding:5px;"><div id="map" style="width: 405px; height: 400px; float:left;"></div></td>
</tr><tr>
    <td style="vertical-align:top;"><div id="directions" style="width: 405px; float:right; padding:5px;"></div></td>
</tr>
</table>
</body>
</html>

Popup.js
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
function PopUpWindow(filename,windowname,toolbar,location,directories,status,menubar,scrollbars,resizable,copyhistory,_width,_height)
 {
  window.open(filename,windowname,"toolbar="+toolbar+",location="+location+",directories="+directories+",status="+status+",menubar="+menubar+",scrollbars="+scrollbars+",resizable="+resizable+",copyhistory="+copyhistory+",width="+_width+",height="+_height+"");
 }
function GO(url) {PopUpWindow(url,'Routebeschrijving',0,0,0,1,0,1,0,0,550,600)}

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.