[OpenLayers-Users] WGS84 data on Google layer

Craig Stanton c.stanton at niwa.co.nz
Thu Mar 19 19:28:05 EDT 2009


The bit that I am missing is the exact projection specification I need to get WGS84 data onto a Google layer.
I think these are all the relevant bits of code

*************
var map = new OpenLayers.Map('map'); 

var gphy = new OpenLayers.Layer.Google(
            "Google Physical",
            {type: G_PHYSICAL_MAP}
        );

    map.addLayer(gphy);
*************
othermarkers = new OpenLayers.Layer.Vector("Other sites",{strategies: [new OpenLayers.Strategy.Cluster()], 
											projection : new OpenLayers.Projection("EPSG:4326"),
											styleMap: myStyleMap	 } );
map.addLayer(othermarkers);
********************
(this is in a loop)
	    point = new OpenLayers.Geometry.Point(siteInfo.long, siteInfo.lat);
	    spot = new OpenLayers.Feature.Vector(point,siteInfo);
	    featureGroup.push(spot);

******************
othermarkers.addFeatures(featureGroup);
****************

I've tried setting the Vector layer to 900913 and without any projection but I can't see any difference, the features still get further away from their correct spots the further down the screen I move them. If I move the map up they get closer to where they should be.

:-?


~Craig



>>> "Jan H. van der Ven"  03/20/09 9:05 AM >>>
Dear Craig,

I have started a projection doc page here: 
http://trac.openlayers.org/wiki/Documentation/Dev/proj4js.
If that does not help, please tell me what is missing.

Kind regards,

Jan

Craig Stanton schreef:
> Hi All,
>     I've sorted the clustering strategy that Ivan mentioned a few days ago but have come upon another problem I'd appreciate some advice on. My data is stored as WGS84 lat/longs and I want to use Google Terrain as the base layer, but the points drift off their locations as they get closer to the bottom of the map window. I know the problem is in the projections I'm using but I can't figure out the right combination of 900913, 4326, WGS84 etc etc. Could someone please explain what I should do to the vector layer on which my points are plotted and to the Google layer I am using as my base. 
>
> Cheers,
>      Craig
> NIWA is the trading name of the National Institute of Water & Atmospheric Research Ltd.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>   
> ------------------------------------------------------------------------
>
>
> Geen virus gevonden in het binnenkomende-bericht.
> Gecontroleerd door AVG - www.avg.com 
> Versie: 8.0.238 / Virusdatabase: 270.11.19/2010 - datum van uitgifte: 03/18/09 20:27:00
>
>   


NIWA is the trading name of the National Institute of Water & Atmospheric Research Ltd.



More information about the Users mailing list