[OpenLayers-Users] how to use proj4js for Google

Burgholzer,Robert rwburgholzer at deq.virginia.gov
Wed Oct 15 14:09:04 EDT 2008


Thanks Mike,
I saw the reference to the compressed files, and didn't think to try
that option as I was trying to learn a bit about the code, hence the use
of the uncompressed, un-combined.

Also, the track instance is good info.
r.b.

Robert W. Burgholzer
Surface Water Modeler
Office of Water Supply and Planning
Virginia Department of Environmental Quality
rwburgholzer at deq.virginia.gov
804-698-4405
Open Source Modeling Tools:
http://sourceforge.net/projects/npsource/

-----Original Message-----
From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org]
On Behalf Of Mike Adair
Sent: Wednesday, October 15, 2008 2:03 PM
To: Alexander Petkov
Cc: users at openlayers.org
Subject: Re: [OpenLayers-Users] how to use proj4js for Google

There is a Trac instance setup for Proj4js at 
http://trac.osgeo.org/proj4js/ where you can file tickets.  I've also 
put up a 1.0 release candidate there for testing recently.  As for 
getting laea working (and the others not validated) I would like to get 
those fixed for the final release, it is a matter of finding the time to

do that.

Also for Robert's issue, if you use proj4js-combined.js or 
proj4js-compressed.js, all of the files under lib/projCode are bundled 
into the one file so you don't need to include the individual 
projections.  Also a minor point: the Proj4js.defs['EPSG:4326'] is 
defined by default in the package so there is no need to include that 
one, we should probably do the same the Google one as well, but it's not

there now so you do need to define that.

Mike



Alexander Petkov wrote:
> What is the best way to file a bug report for Proj4js problems? I have
> been trying to transform coordinates to laea, but it is giving me
> result that are offset by a several kilometers. Quick Google search
> indicates that the laea transfom hasn't been checked for validity as
> of Jan 2008.
>
>
> Thanks,
> Alex
>
> On Wed, Oct 15, 2008 at 11:44 AM, Burgholzer,Robert
> <rwburgholzer at deq.virginia.gov> wrote:
>   
>> In case anyone else out there has been having trouble getting the
proj4js
>> lib to do a coordinate transform, I have recently gone through it
with
>> success.  I was goofing up a small part that caused much problems.
>>
>>
>>
>> I did one thing to solve my issue,
>>
>> 1) make sure that I included the merc.js projCode in my header:
>>
>> <script src="/html/scripts/proj4js/lib/projCode/merc.js"></script>
>>
>>
>>
>> So, the following is a page that will convert a latlon coord to
google
>> (based on an original posting from this listserv):
>>
>>
>>
>>
>>
>> <html>
>>
>> <head>
>>
>> <script src="/html/devlib/OpenLayers-2.7/lib/OpenLayers.js"></script>
>>
>> <script src="/html/scripts/proj4js/lib/proj4js.js"></script>
>>
>> <script src="/html/scripts/proj4js/lib/projCode/merc.js"></script>
>>
>>
>>
>> </head>
>>
>> <body>
>>
>> <div id="map"></div>
>>
>> <script type='text/javascript'>
>>
>> <!-- \n";
>>
>>     Proj4js.defs["EPSG:4326"] = "+proj=longlat +ellps=WGS84
+datum=WGS84
>> +no_defs";
>>
>>     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";
>>
>>
>>
>>             var proj4326 = new OpenLayers.Projection("EPSG:4326");
>>
>>             var projGoogle = new
OpenLayers.Projection("EPSG:900913");
>>
>>
>>
>>             var lon = -77.1266708374023;
>>
>>             var lat = 37.6813888549805;
>>
>>             var point = new OpenLayers.Geometry.Point(lon, lat);
>>
>>             OpenLayers.Projection.transform(point, proj4326,
projGoogle);
>>
>>             alert(lon + " " + lat + " = " + point.x +" "+ point.y);
>>
>>
>>
>> // -->
>>
>> </script>
>>
>> </body>
>>
>> </html>
>>
>>
>>
>> Robert W. Burgholzer
>>
>> Surface Water Modeler
>>
>> Office of Water Supply and Planning
>>
>> Virginia Department of Environmental Quality
>>
>> rwburgholzer at deq.virginia.gov
>>
>> 804-698-4405
>>
>> Open Source Modeling Tools:
>>
>> http://sourceforge.net/projects/npsource/
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>>
>>     
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>   
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users



More information about the Users mailing list