[OpenLayers-Users] Problems with Google and projection
Tim Schaub
tschaub at openplans.org
Wed Mar 5 23:56:52 EST 2008
Hey-
giris68 wrote:
> Hi!
> I'm an newbee to OL and have now spent a week trying to draw an polygon on
> an GoogleMap.
> My last attempt is an slight modification of the geoRSS demo.
>
> I have to problems, maybe the first one is caused by the second...
>
> 1. The polygon doesn't sync on the map where i draw with the mouse.
> Obviously many have problems to view a VMS layer on an Google Map, but why
> can't i draw an polygon directly? (Theresn't no different to use
> displayProjection or not)
>
> 2. When i add displayProjection i got the message:
> point has no properties
> transform(EPSG:900913 projCode=EPSG:900913 proj=Object, EPSG:4326
> projCode=EPSG:4326 proj=Object)LonLat.js (line 129)
> redraw(mousemove clientX=0, clientY=0)MousePosition.js (line 127)
> triggerEvent("mousemove", mousemove clientX=0, clientY=0)Events.js (line
> 665)
> handleBrowserEvent(mousemove clientX=0, clientY=0)Events.js (line 691)
> bindAsEventListener(mousemove clientX=0, clientY=0)BaseTypes.js (line 364)
> [Break on this error] this.lon = point.x;
> from firebug.
>
> The last error seems to be proj4js error ? (How do i install proj4js
> correctly?)
>
> I'm using the trunkversion of OL since a couple of days ago.
>
> http://www.itmedia.se/soft/maps/demonabble.php
> http://www.itmedia.se/soft/maps/demonabble.php
>
The Google Layer constructor takes two arguments (second one optional).
You have specified 5 arguments in your constructor.
see
http://dev.openlayers.org/apidocs/files/OpenLayers/Layer/Google-js.html#OpenLayers.Layer.Google.OpenLayers.Layer.Google
Copy http://openlayers.org/dev/examples/spherical-mercator.html and read
http://trac.openlayers.org/wiki/SphericalMercator for more information.
Looks like you are trying to use spherical mercator (which is good), but
your map bounds are not really reasonable bounds in spherical mercator.
extent = new OpenLayers.Bounds(10.57, 55.2, 24.18, 69.1)
Get Firefox with Firebug, use the above spherical mercator example,
browse to the area you are interested in, type map.getExtent() in the
Firebug console, and use the return to set your map bounds.
Also, you should never set reproject to true (as you do with your
pointLayer. This property doesn't have to do with reprojecting in the
sense that most people think.
Tim
>
More information about the Users
mailing list