[OpenLayers-Users] mouse-line offset with Google maps
Christopher Schmidt
crschmidt at metacarta.com
Mon Mar 9 11:31:31 EDT 2009
On Mon, Mar 09, 2009 at 04:29:21PM +0100, Erwin Poeze wrote:
> Hello,
>
> I'm new to OpenLayer but I have programming experience with the Google
> Maps API. I like the fact that OpenLayers is independent of the 'map
> provider' and I am considering to continue programming in OpenLayers.
>
> I ran into a problem that I'm unable to solve. I examined the example
> draw-feature.html and replace the map by the Google version, see the
> few line below.
>
> [code]
> map = new OpenLayers.Map('map',{
> projection: new OpenLayers.Projection("EPSG:900913"),
> displayProjection: new OpenLayers.Projection("EPSG:4326")
> });
>
> var gphy = new OpenLayers.Layer.Google(
> "Google Physical",
> {type: G_PHYSICAL_MAP},
> {'sphericalMercator': true,
> 'maxExtent': new
> OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34)
>
These are wrong.
Instead:
{type: G_PHYSICAL_MAP,
'sphericalMercator': true,
'maxExtent': new
OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34)
}
);
-- Chris
> [/code]
>
> The example continuous to work, but now I get a vertical offset
> between the mouse position and the line drawn. I attached a small
> picture to illustrate this. The offset is not constant. Drawing at the
> top of the map results in a offset of nearly zero and the offset is
> maximal when drawing a line at the bottom.
>
> I read the documentation and tried to play around with the projection,
> but I can not imagine that the projection is causing this issue.
>
> Does anyone have any idea what kind of phenomenon this is, and more
> important, how I can solve this?
>
> Thank you very much,
>
> Erwin
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list