Getting an error on a test I'm doing on V3. It concerns the number of
waypoints I have between a 'origin' and 'destination' point. Example
page shown below:
http://www.starsofwa.com.au/googletest.html
This is basically taken from the example files for V3 and the error
occurs when there's 12 waypoints, all set to stopover 'true'. If I
remove any of the waypoints and knock it back to 11, then the map will
display the polyline and the DirectionsRenderer shows the step by step
instructions.
The maximum number of waypoints allowed is 23 plus the 'origin' and
'destination' according to the documentation - which I assume I would
see the error status of MAX_WAYPOINTS_EXCEEDED, but this is not the
case.
Code used as follows:
<script type="text/javascript">
var directionsDisplay;
var directionsService = new google.maps.DirectionsService();
var map;
function initialize() {
directionsDisplay = new google.maps.DirectionsRenderer();
var chicago = new google.maps.LatLng(-25.363882,120.27832);
var myOptions = {
zoom:5,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: chicago
}
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
directionsDisplay.setMap(map);
directionsDisplay.setPanel(document.getElementById
("directionsPanel"));
calcRoute()
}
function calcRoute() {
var request = {
origin: "Perth, WA",
destination: "Albany WA",
waypoints: [
{
location: new google.maps.LatLng
(-32.304291378,115.702241063),
stopover:true
},{
location: new google.maps.LatLng
(-33.319734803,115.643162727),
stopover:true
},{
location: new google.maps.LatLng
(-33.644277591,115.344353914),
stopover:true
},{
location: new google.maps.LatLng
(-33.642241142,115.034279823),
stopover:true
},{
location: new google.maps.LatLng
(-33.698761474,115.016212463),
stopover:true
},{
location: new google.maps.LatLng
(-33.966204552,115.070800781),
stopover:true
},{
location: new google.maps.LatLng
(-34.837547610,116.004209518),
stopover:true
},{
location: new google.maps.LatLng
(-34.454518655,116.049442291),
stopover:true
},{
location: new google.maps.LatLng
(-34.444556637,116.034979820),
stopover:true
},{
location: new google.maps.LatLng
(-34.985987621,116.882944107),
stopover:true
},{
location: new google.maps.LatLng
(-35.035478228,117.919000983),
stopover:true
},{
location: new google.maps.LatLng
(-35.095192592,117.959089279),
stopover:true
}],
provideTripAlternatives: false,
travelMode: google.maps.DirectionsTravelMode.DRIVING,
unitSystem: google.maps.DirectionsUnitSystem.METRIC
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
} else {
alert(status)
}
});
}
</script>
Could it be the use of the LatLng() function within the setup of the
waypoints array?
Cheers
Brendan
--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
Cheers
Brendan
We're working on it but your best short term option is simply to split the route.
On 20 Mar 2010 03:37, "Payden" <yoyo...@gmail.com> wrote:
Has there been anymore developments with this? Or is our only option
to split the routing in two or three parts?
On Jan 20, 6:46 am, ipixel <s13sillb...@gmail.com> wrote:
> Hmmm, will give that a go. Interesting ...
--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript AP...
V3 uses a very long GET URL compared to V2.
Look at:
to see what is happening.
Different browsers have different GET URL limitations. Internet
Explorer truncates the URL sent to the server at something like 2048
characters. An incomplete URL will be missing a proper "token" even
if it is otherwise complete. Without a valid "token" if is considered
an invalid request.
On Mar 22, 1:01 pm, Payden <yoyoja...@gmail.com> wrote:
> Any possibility of google changing the API to allow POST'ing data to
> the directions service instead?
To avoid cross-domain access restrictions, it must be a JS file loaded
with a SCRIPT element. An application cannot POST to Google's servers
without a proxy.