Well there was a GScreenOverlay but I think that wasn't the problem.
Due to the inconsistent behavior, I'm not entirely certain the problem
was solved at all. But I did fix a problem with my fromLatLngToPixel
and fromPixelToLatLng functions (they were symmetrically correct but
would produce wrong values on their own). Don't think anyone could've
picked that up without further inside knowledge about the map and tile
layout. But in case anybody has been pondering I'll paste the fixed
versions below. The problem was that pix2lat didnt produce the full
range of 0...360 degrees, but only 0...3.6 degrees. In the end I
figured out I had to multiply the tilesize to it.
I've not seen the problem since the fix, but like I said, I'm not yet
convinced the problem is fixed...
Thanks for the suggestion, Mike.
MyProjection.prototype.fromLatLngToPixel = function(latlng, intZoom) {
if (!latlng) {
// is this some bug or bad implementation?
GLog.write("empty latlng... "+intZoom);
return new GPoint();
}
var x = Math.round(latlng.lng() * this.ppd[intZoom]) / TILE_SIZE;
var y = Math.round(latlng.lat() * this.ppd[intZoom]) / TILE_SIZE;
var m = new GPoint(x, y);
return m;
};
MyProjection.prototype.fromPixelToLatLng = function(point, intZoom) {
var lng = ((point.x * TILE_SIZE) / this.ppd[intZoom]);
var lat = ((point.y * TILE_SIZE) / this.ppd[intZoom]);
var g = new GLatLng(lat, lng, true);
return g;
};
On 17 jan, 20:28, Mike Williams <[email protected]> wrote:
> Is there any possibility that you've got an overlay that has a missing
> GLatLng? When you zoom, all the overlays get .redraw()n, and they all
> call .prototype.fromLatLngToPixel() to work out where their new position
> should be.
>
> I've done some experiments, and convinced myself that it can't happen
> with GMarkers - if you try to create a GMarker that has no latlng, the
> API creates one for you at new GLatLng(NaN,undefined). I've not tried
> other types of overlay.
>
> In particular, watch out for a missing "new" in "new GLatLng(lat,lng)"
> when creating overlays. If you try to call the GLatLng class as a
> Function, rather than a Constructor, it returns void.
>
> --http://econym.org.uk/gmap
> The Blackpool Community Church Javascript Team
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---