[MetaCRS] Proj4js dynamic CRS lookup

Mike Adair madair at dmsolutions.ca
Tue Nov 2 16:03:21 EDT 2010


Jon,

Proj4js will create the URL and load it for you automatically (for EPSG 
codes anyway).  The only thing you need to do is wait for it to be 
loaded by checking the readyToUse flag on the projection object.

Mike


On 11/2/2010 10:37 AM, Jon Britton wrote:
> Hi guys, thanks for the reply.
>
> I've noticed that you can use the spatialreference.org 
> <http://spatialreference.org> REST interface to make calls like:
>
> http://spatialreference.org/ref/epsg/2805/proj4js/
>
> which gives you the javascript code needed to use the projection.
>
> I assume I need to generate a URL for my given projection, get the 
> contents of the URL and run it as JavaScript.  Unfortunately I've got 
> no idea how to do this!
>
> Jon
>
> On 1 November 2010 18:46, Clément Ronzon <clem.rz at gmail.com 
> <mailto:clem.rz at gmail.com>> wrote:
>
>     Hi Jon,
>
>     I worked on a similar project before : http://twcc.free.fr
>     You can check the JS sources.
>
>     If you need any help to understand the code, feel free to contact me !
>
>     Sincerely,
>     Clément Ronzon
>     151 Av. Félix Faure
>     69003 LYON, FRANCE
>     Tel. # : +33 (0)9 54 43 12 20
>     Fax # : +33 (0)9 59 43 12 20
>     Cell. # : +33 (0)6 08 21 23 27
>     http://perso.apec.fr/clement_ronzon1
>     http://www.computrabajo.com.mx/cvs/clementronzon
>     http://twcc.free.fr
>     http://www.grottocenter.org
>     http://www.zakbag.com
>
>
>     On Mon, Nov 1, 2010 at 6:34 PM, Jon Britton
>     <jonbritton3 at googlemail.com <mailto:jonbritton3 at googlemail.com>>
>     wrote:
>
>         Hi,
>
>         I'm trying to use proj4js in my project and will need to
>         project to various CRSs.  The projection codes are submitted
>         by the user, so I have no way of knowing what CRSs will be
>         used.  I've looked at the user guide and it says that proj4js
>         can dynamically look up CRS info at run-time, but I can't
>         figure out how to set this up.  When I try and carry out a
>         projection, I just get the original values back...
>
>         Any help would be appreciated,
>
>         Jon
>
>         _______________________________________________
>         MetaCRS mailing list
>         MetaCRS at lists.osgeo.org <mailto:MetaCRS at lists.osgeo.org>
>         http://lists.osgeo.org/mailman/listinfo/metacrs
>
>
>
>
> _______________________________________________
> MetaCRS mailing list
> MetaCRS at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/metacrs

-- 
    Michael Adair
    Senior Software Architect
    DM Solutions Group Inc.

    Office: (613) 565-5056 x26
    madair at dmsolutions.ca
    http://www.dmsolutions.ca
    http://research.dmsolutions.ca


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/metacrs/attachments/20101102/0aefa760/attachment.html


More information about the MetaCRS mailing list