[OpenLayers-Users] projection problem proj4js
Christopher Schmidt
crschmidt at metacarta.com
Tue Oct 6 02:21:34 EDT 2009
On Mon, Oct 05, 2009 at 05:00:04PM -0700, karsten vennemann wrote:
> Thanks, now I do not get an error any more with this code:
>
> var mapcenter = new OpenLayers.LonLat(-122.30785315739, 47.638080437239);
> Proj4js.defs["EPSG:102003"] = "+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=37.5 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs";
> var source = new OpenLayers.Projection("EPSG:4326");
> var dest = new OpenLayers.Projection("EPSG:102003");
> OpenLayers.Projection.transform(mapcenter, source, dest);
> alert('coordinates transformed:'+mapcenter.toString());
>
> However the coordinates are the same as the input values (-122.30785315739, 47.638080437239) and not transformed.
> What is still wrong ?
projection.transform doesn't take a lonlat. It takes any object with .x and
.y. You can use lonlat.transform(source, dest) to transform in place.
-- Chris
> Karsten
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
More information about the Users
mailing list