Hi, I've run into the most bizzare (and rather annoying) bug with
Google Maps. The fact that the .js is all stripped down to ambiguous
functions doesn't help me with the issue.
I will try to give as much detail as I can.
I've got a custom map (replaced the tile url function) and so far
adding markers has been perfect. I decided it was time to add
polylines between my markers and all hell broke loose.
Simple code:
function buildPolyLine(name, color, width, x1, y1, x2, y2)
{
var polyOptions = {geodesic:true};
var polyline = new GPolyline([new GLatLng(y1,x1), new GLatLng(y2,
x2)], color, width, 1, polyOptions);
return polyline;
}
NOTE: I know lat (up/down) comes first, hence the reversal from x,y to
y,x. I know that the coordinates being entered are valid coordinates
because I've succesfully placed markers there and they not only don't
break the map, but they show up perfectly.
In my main function:
var MyLine = buildPolyLine("MyLine", "#FF0000", 1, 81.58284333315854,
-154.3359375, 81.58284333315854, 81.42704495773292, -131.572265625,
81.42704495773292);
map.addOverlay(MyLine);
The symptoms this produce are about a billion javascript errors and
the wierdest handling of the map ever.
On initial load, the map loads perfectly with the line not visible. As
soon as i click the map it starts to accelerate uncontrollably (well
kinda) it seems my delta-x and delta-y mouse movement are translated
into velocity instead of offset. (i.e. moving the mouse 1 pixel makes
the map slowly move that direction at a constant speed)
Additionally I get thrown this error:
Line 533 of linked script
http://maps.google.com/intl/en_ALL/mapfiles/124/maps2.api/main.js
:: d is undefined
Basically I've tracked it down to this line:
Ze.prototype=new lj;Ze.prototype.fromLatLngToPixel=function(a,b){var
c=this,d=c.hs[b],e=A(d.x+a.lng()*c.js[b]),f=Rc(Math.sin(a.lat()*(Ac/
180)),-0.9999,0.9999),g=A(d.y+0.5*Math.log((1+f)/(1-f))*-
c.ks[b]);return new O(e,g)};
It states that d is undefined:
d = c.hs[b]
where
c = this
I tracked fromLatLngToPixel down and determined that the problem is
that it seems to be calling something up in relation to a passed zoom
level. My guess is that the GProjection is missing information for a
specified zoom level.
My Question is... how does adding a line to a map cause this function
to break? This kinda screw up sounds like something that'd happen with
or without a line.
It's driving me crazy and I'm running out of hair. Any help would be
greatly appreciated!
Here's my setup code: (Some information changed to protect my client)
function load()
{
if (GBrowserIsCompatible())
{
// Basic Map Control
map = new GMap2(document.getElementById("div_map"));
map.addControl(new GLargeMapControl());
// Copyright
var copyright = new GCopyright(1, new GLatLngBounds(new
GLatLng(-90,-180),new GLatLng(90,180)), 1, "(c) 2008 Some Company");
var copyrightCollection = new GCopyrightCollection('Map Data:');
copyrightCollection.addCopyright(copyright);
// Custom Map Tiles
w_CustomGetTileUrl=function(a,b){
var f =
"http://somesite.com/map/tiles/"+b+"_"+a.x+"_"+a.y+".jpg";
return f;
}
// Layers
var tilelayers = [new GTileLayer(copyrightCollection,3,6)];
tilelayers[0].getTileUrl = w_CustomGetTileUrl;
// Custom Map
var w_map = new GMapType(tilelayers, new GMercatorProjection(7),
"Old OS");
map.setCenter(new GLatLng(98.12246884621463,-137.8203125,
true), 4,
w_map);
map.addMapType(w_map);
...
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---