setting start and end post codes
i have trying to use Virtual map on my web site, athough it seems to work OK, i canot find a method/ script on here to allow me to enter my start and end Postcodes to generate a route. can only one suggest a forum topic or website for me to find this ?
thanks in advance
added my code here
<html>
<head>
<title></title>
<metahttp-equiv="Content-Type"content="text/html; charset=utf-8">
<scriptsrc="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=5"></script>
<script>
var
map = null
;var
clickEvent = null
;var
zoomLevel = 3;var
From = "FromPostcode"
+ ", UK"
;var
To = "ToPostcode"
+ ", UK"
;function
GetMap(){
map =
new
VEMap('myMap'
);map.LoadMap();
map.SetZoomLevel(zoomLevel);
txtZoom.value = zoomLevel;
map.AttachEvent(
"onclick"
, GetLatLong);latLong = map.GetCenter();
divInfo.innerHTML = latLong;
}
function
GetLatLong(e){
//Get the pixel coordinates from the click event, convert to LatLong value
var
x = e.mapX;var
y = e.mapY;pixel =
new
VEPixel(x, y);latLong = map.PixelToLatLong(pixel);
divInfo.innerHTML = latLong;
}
function
SetCenterAndZoom(){
map.SetCenterAndZoom(latLong, zoomLevel);
}
function
SetCenter(){
map.SetCenter(latLong);
}
function
SetZoom(){
map.SetZoomLevel(zoomLevel);
}
function
ZoomIn(){
//Increase zoom level by a factor of 1
map.ZoomIn();
txtZoom.value = map.GetZoomLevel();
}
function
ZoomOut(){
//Decrease zoom level by a factor of 1
map.ZoomOut();
txtZoom.value = map.GetZoomLevel();
}
function
ValidateEntry(){
//Check to make sure zoom level is within range
if
(txtZoom.value > 0 && txtZoom.value <= 19) zoomLevel = txtZoom.value;else
alert("Enter a value between 1 and 19."
);}
// Dashboard hide & show calls
function
HideDashboard(){
map.HideDashboard();
}
function
ShowDashboard(){
map.ShowDashboard();
}
// 3D Navigation hide & show calls
function
Hide3DNav(){
map.Hide3DNavigationControl();
}
function
Show3DNav(){
if
(map.GetMapMode() == 1){
map.SetMapMode(VEMapMode.Mode3D);
}
map.Show3DNavigationControl();
}
// Find Control hide & show calls
function
HideFindControl(){
map.HideFindControl();
}
function
ShowFindControl(){
map.ShowFindControl();
}
// Mini Map hide & show calls
function
HideMiniMap(){
map.HideMiniMap();
}
function
ShowMiniMap(){
if
(map.GetMapMode() == 2){
map.SetMapMode(VEMapMode.Mode2D);
}
map.ShowMiniMap(200, 100);
}
function
SetScaleBar(distanceUnit){
map.SetScaleBarDistanceUnit(distanceUnit);
}
function
GetMap(){
map =
new
VEMap('myMap'
);map.LoadMap();
map.GetRoute(From, To);
}
</script>
</head>
<bodyonload="GetMap();"style="font-family: Arial">
<divid='myMap'style="position:relative; width:704px; height:500px; z-index: 100; left: 0px; top: 0px;"></div>
<inputid="ShowMiniMap"type="button"value="ShowMiniMap"onclick="ShowMiniMap()"style="z-index: 113; left: 880px; position: absolute; top: 248px">
<inputid="HideMiniMap"type="button"value="HideMiniMap"onclick="HideMiniMap()"style="z-index: 113; left: 756px; position: absolute; top: 248px">
<inputid="ShowFindControl"type="button"value="ShowFindControl"onclick="ShowFindControl()"style="z-index: 113; left: 880px; position: absolute; top: 208px">
<inputid="HideFindControl"type="button"value="HideFindControl"onclick="HideFindControl()"style="z-index: 113; left: 732px; position: absolute; top: 208px">
<inputid="Show3DNav"type="button"value="Show3DNav"onclick="Show3DNav()"style="z-index: 113; left: 880px; position: absolute; top: 168px">
<inputid="Hide3DNav"type="button"value="Hide3DNav"onclick="Hide3DNav()"style="z-index: 113; left: 772px; position: absolute; top: 168px">
<inputid="HideDashboard()"type="button"value="HideDashboard"onclick="HideDashboard()()"style="z-index: 113; left: 880px; position: absolute; top: 128px">
<inputid="ShowDashboard"type="button"value="ShowDashboard"onclick="ShowDashboard()"style="z-index: 113; left: 728px; position: absolute; top: 128px">
<inputid="btnZoomOut"type="button"value="Zoom out by 1"onclick="ZoomOut()"style="z-index: 113; left: 880px; position: absolute; top: 88px">
<inputid="btnZoomIn"type="button"value="Zoom in by 1"onclick="ZoomIn()"style="z-index: 113; left: 756px; position: absolute; top: 88px">
<inputid="btnSetZoom"type="button"value="Set Zoom"onclick="SetZoom()"style="z-index: 113; left: 880px; position: absolute; top: 48px">
<inputid="btnSetCenter"type="button"value="Set Center"onclick="SetCenter()"style="z-index: 113; left: 776px; position: absolute; top: 48px">
<inputid="btnSetCZ"type="button"value="Set Center and Zoom"onclick="SetCenterAndZoom()"style="z-index: 101; left: 776px; position: absolute; top: 16px">
<inputid="GetRoute"type="button"value="GetRoute"onclick="GetRoute()"style="z-index: 113 left: 840px; position: absolute; top: 284px; left: 836px;">
Click the map to select a center point.
<br/>
<divid="divInfo"><br/> </div>
Zoom Level:
<inputid="txtZoom"type="text"value=""onchange="ValidateEntry()"/><br/>
<br/>
<br/>
<br/>
<divid="links">
</div>
</body>
</html>
var From = "FromPostcode" + ", UK";
var To = "ToPostcode" + ", UK";
Typically the From and To would be edit box values, within your web page.
The From value would be FromPostcode plus comma UK
To would be the same if going to another postcode. ie ToPostcode plus comma UK
The declared variables are only used to show the example values.
Duncan Garratt
http://www.gis-logic.co.uk/