[OpenLayers-Users] Projection problem

JamSquad Jordan_R_Clark at hotmail.com
Tue Apr 20 11:56:24 EDT 2010


Hey there Jose!

I think you might need Proj4js, a script which transforms projections.  

For example, I use googles projection and 26917.  Off the start I had to
define them (you can get definitions from http://spatialreference.org/)

Heres what mine look like at the top of my code:  

//Projection 4 JS
Proj4js.defs["EPSG:900913"] = "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0
+lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs";
Proj4js.defs["EPSG:26917"] = "+proj=utm +zone=17 +ellps=GRS80 +datum=NAD83
+units=m +no_defs";
var projGoogle = new OpenLayers.Projection("EPSG:900913");
var proj26917 = new OpenLayers.Projection("EPSG:26917");

Then, after I made my bounds, I had to transform them into Googles bounds..   
So something like this:

	var bounds = new OpenLayers.Bounds(
		601483.168, 4891001.729,
		618569.5, 4918042.5
		);

        bounds.transform(proj26917, projGoogle);


After that was done, in the options I put my projection and display
projection to projGoogles.  

It works good, although a little confusing.  You can also transform point
coordinates.  Post anymore questions I'd be happy to answer them the best I
can.

JamSquad
-- 
View this message in context: http://n2.nabble.com/Projection-problem-tp4931823p4931927.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list