[OpenLayers-Users] Projection problem

Glenn Mullett gmullett at lidwala.com
Mon Aug 29 03:57:58 EDT 2011


Hi Zsolt

in your OL map config you have to set the map to 900913 (spherical
mercator) and set the display projection using displayProjection:
(you have to use 900913 if using Google layers ... else nothing is in
the right place)
 
---------------------------------

	var ol_map_options = {
			id: 'map',
			units: "m",
			projection: new OpenLayers.Projection("EPSG:900913"), 		//so
everything fits on Google Earth Layers
    		         displayProjection: new
OpenLayers.Projection("EPSG:4326"),   // what is shown in the bottom
right corner... I usually use 4326 ...
			controls: [
			        new OpenLayers.Control.Navigation(), 
				new OpenLayers.Control.PanZoomBar(), 
				new OpenLayers.Control.ScaleLine(), 
		  		new OpenLayers.Control.MousePosition() //the mouse position
co-ords display
		        ]
		};

map = new OpenLayers.Map('map', ol_map_options);

---------------------------------

then set the projection of your layer that you are adding ( i've used a
vector layer here - but you can change to what you need...):

---------------------------------

           var vector_sites = new OpenLayers.Layer.Vector("sites", 
                        {  styleMap: new OpenLayers.StyleMap(style)   },

                        //set the projection of the layer - this you
would set to "EPSG:23700"
                       {   projection: new
OpenLayers.Projection("EPSG:4326")  }
           ); 
 
map.addLayer(vector_sites);

---------------------------------

Regards
-- 
Glenn Mullett
BTech(Nature Cons) PGDip(UNIGIS)
H.O.D. GIS
Lidwala Consulting Engineers

____________________________________________________________________________________________________________________________________________________
Lidwala Consulting Engineers (SA) (Pty) Ltd email Disclaimer and
confidentiality note:
This e-mail, its attachments and any rights attaching hereto are, unless
the content clearly indicates otherwise, the property of Lidwala
Consulting Engineers (SA) (Pty) Ltd and its subsidiaries. It is
confidential, private and intended for only the addressee.  Should you
not be the addressee and receive this e-mail by mistake, kindly notify
the sender, and delete this e-mail immediately.  Do not disclose or use
it in any way. Views and opinions expressed in this e-mail are those of
the sender unless clearly stated as those of Lidwala Consulting
Engineers (SA) (Pty) Ltd.  Lidwala Consulting Engineers (SA) (Pty) Ltd
accepts no liability for any loss or damages howsoever incurred, or
suffered, resulting or arising, from the use of this email or its
attachments.  Lidwala Consulting Engineers (SA) (Pty) Ltd does not
warrant the integrity of this e-mail nor that it is free of errors,
viruses, interception or interference.
____________________________________________________________________________________________________________________________________________________ 

On Mon, 2011-08-29 at 09:37 +0200, Magyar Zsolt wrote:
> Dear All,
> 
>  
> 
> I'm sorry for my help request again! I didn’t get any e-mail about
> this problem below somehow. (I think it was up to me, sorry!) 
> 
> Thanks!
> 
>  
> 
> Zsolt
> 
>  
> 
> 
>                                    
> ______________________________________________________________________
> 
> From: Magyar Zsolt 
> Sent: Thursday, August 18, 2011 11:20 AM
> To: 'openlayers-users at lists.osgeo.org'
> Subject: Projection problem
> 
> 
> 
>  
> 
> Please help me!
> 
> http://erdoterkep.mgszh.gov.hu/epsg23700test/eotr_test.html 
> 
> On the map you can see Forestry Directorates of Hungary and some test
> lines. Horizontal coordinates of these lines are exactly 450000,
> 640000 and 880000 in the EPSG:23700 reference system. The problem is -
> as you can see on cursor location bottom right - that the coordinates
> are not correct with google maps. There are 70m difference somewhere.
> 
> The projection is OK, the maps are on the right place, but the
> coordinates are wrong (a bit) somehow.
> 
> On the map of Geoserver Openlayers Layer preview you can see the
> correct coordinates. (see pictures)
> 
>  
> 
> What can I do to make it show the correct coordinate numbers?
> 
>  
> 
> Thanks for advance!
> 
>  
> 
> Zsolt, Magyar
> 
> 
> 
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110829/be3611a4/attachment-0001.html


More information about the Users mailing list