My guess here is that OpenLayers 2.10 is not compatible with Proj4js 2.X. Try 
Proj4js 1.1 instead.

Best regards,
Bart

--
Bart van den Eijnden
Front-end Developer | Boundless
@boundlessgeo

On 11 Feb 2014, at 17:58, Juanma M. R. <[email protected]> wrote:

> Hi,
> 
> Thank you Robert. I already included a file with the CRS like that:
> 
> <script TYPE="text/javascript" src="proj4js-2.1.0/lib/proj4.js"></script>
> <script TYPE="text/javascript" src="proj4js-2.1.0/lib/spider_srs.js"></script>
> <script TYPE="text/javascript" src="OpenLayers-2.10/OpenLayers.js"></script>
> 
> with one line for each CRS like the ones from spatialreference.org:
> 
> 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 +wktext  +no_defs";
> Proj4js.defs["EPSG:4230"] = "+proj=longlat +ellps=intl +no_defs";
> ...
> 
> and it thorughs the error: 
> 
> "ReferenceError: Proj4js is not defined"
> 
> The object Proj4js is not defined but the proj4.js file gives no error. Am I 
> using a wrong object name for including the defs strings?
> 
> Cheers,
> 
> Juan Manuel Moreno Rivera.
> Sección de Teledetección y SIG / Remote Sensing & GIS group
> 
> Instituto de Desarrollo Regional / Institute for Regional Development
> 
> Universidad de Castilla-La Mancha / University of Castilla-La Mancha
> 
> Tlf: +34 967599200 (Ext: 2623)
> 
> http://www.teledeteccionysig.es/
> 
> 
> 2014-02-07 1:35 GMT+01:00 Robert Sanson <[email protected]>:
> Hi Juan
> 
> You are missing the .js file name in the first <script></script> block.
> 
> Here is some code that works for me:
> 
> <script src="lib/proj4js-compressed.js"></script>
> <script src="lib/EPSG2193.js"></script>
> <script src="lib/EPSG4326.js"></script>
> <script src="OpenLayers.js"></script>
> <script type="text/javascript">
> var xys = map.getLonLatFromViewPortPx(e.xy);
>       easting = xys.lon;
>       northing = xys.lat;
>        var tempgeom = new OpenLayers.Geometry.Point(easting,northing);
>       //now re-projection to WGS84
>       var src = new OpenLayers.Projection('EPSG:2193');
>       var dest = new OpenLayers.Projection('EPSG:4326');
>       OpenLayers.Projection.transform(tempgeom, src, dest);
> 
> regards,
> 
> Robert
> 
> >>> "Juanma M. R." <[email protected]> 7/02/2014 3:23 a.m. >>>
> Dear list,
> 
> I am trying to reproject in client side using OpenLAyers but I have
> problems to find how to make OpenLayers detecting Proj4js. The proj
> 
> The source code for including OpenLayers and Proj4js is:
> 
> <script TYPE="text/javascript" src="proj4js-2.1.0/dist/"></script>
> > <script TYPE="text/javascript"
> > src="OpenLayers-2.10/OpenLayers.js"></script>
> 
> 
> The source code for reprojecting is:
> 
> olb = new OpenLayers.Bounds(b.minx,b.miny,b.maxx,b.maxy);
> 
> var srcprj = new OpenLayers.Projection("EPSG:23030");
> >
> var destprj = new OpenLayers.Projection("EPSG:900913"); //A definition of
> >
> 
> newOlb = olb.transform(srcprj, destprj);
> 
> 
> The OpenLayers.Projection method creates a Projection object but the proj
> instance, the property of Projection type, is null in both cases. So I
> imagine it is not capable of creating it. I have the documentation but
> maybe I am missing something so obvious ... the final result is that the
> coordinates of the new bounds are a copy of the original ones.
> 
> The other question is how to declare the "EPSG:900913". I have included a
> file with the Proj4js.defs for each EPSG code to be included but when I add
> the line to include this .js content it teels me that Proj4js is not an
> object.
> 
> So, I am doing something wrong integrating the proj4js and OpenLayers.
> Could anyone help me? Just pointing to the right docummentation to
> configure OpenLayers with Proj4js (I have already tried copying proj4js in
> the same folder as OpenLayers.js but t didn't work).
> 
> Cheers,
> Juan Manuel Moreno Rivera.
> 
> 
> 
> This email and any attachments are confidential and intended solely for the 
> addressee(s). If you are not the intended recipient, please notify us 
> immediately and then delete this email from your system.
> 
> This message has been scanned for Malware and Viruses by Websense Hosted 
> Security.
> www.websense.com
> 
> _______________________________________________
> Users mailing list
> [email protected]
> http://lists.osgeo.org/mailman/listinfo/openlayers-users

_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to