[OpenLayers-Users] vector feature transform problems

Greg Allensworth gregor at greeninfo.org
Wed Sep 21 14:13:30 EDT 2011


On 9/21/2011 10:35 AM, jjdoc wrote:
> The map shows up, but the Line I draw is no where to be found
> on the map, and the mouse position control seems to be
> showing lon/lat values, but somewhat off by a few degrees.

> It appears to be a mismatch of things somewhere, but I haven't
> been able to figure it out. Thanks for your help.

I find that reprojection is a lot more accurate if I preload proj4js. OL 
will auto-detect this and use it. I don't know how OL does them if you 
don't use proj4js; check the source code if you're interested.

You would download the proj4js files and unpack them on your server, 
then include them like this. Do this BEFORE your <script> tag which 
loads OpenLayers.js

   <script type="text/javascript" src="proj4js/proj4js.js"></script>
   <script type="text/javascript" src="proj4js/projCode/tmerc.js"></script>
   <script type="text/javascript" src="proj4js/projCode/merc.js"></script>
   <script type="text/javascript" src="proj4js/projCode/utm.js"></script>
   <script type="text/javascript" src="proj4js/defs/EPSG4326.js"></script>
   <script type="text/javascript" src="proj4js/defs/GOOGLE.js"></script>

-- 
Greg Allensworth, Web GIS Developer
BS  A+  Network+  Security+  Linux+  Server+  ZCE-PHP
GreenInfo Network - Information and Mapping in the Public Interest
564 Market Street, Suite 510  San Francisco CA 94104
PH: 415-979-0343 x302  FX: 415-979-0371    email: gregor at greeninfo.org
Web: www.GreenInfo.org     www.MapsPortal.org

Subscribe to MapLines, our e-newsletter, at www.GreenInfo.org


More information about the Users mailing list