[OpenLayers-Users] Does anyone have the projection definitions for all EPSG codes in Proj4js format?

Roald de Wit list at rdewit.net
Sun Jun 6 01:15:30 EDT 2010


Hi Vadim,

I don't think there is any pre-cooked list out there, but it should not 
be hard to create one yourself. Just write a script that loops through 
all EPSG codes that you're interested in, requests the proj4js output 
from spatialreference.org and adds that to one .js file (or many if you 
like).

Simple example (Bash shell script):

    #!/bin/bash
    PROJ_FILE=proj.js

    for i in {2000..2010};
    do
       echo -n Fetching EPSG:$i...
       echo `wget -nv -O -
    http://spatialreference.org/ref/epsg/$i/proj4js/` >> "$PROJ_FILE"
    done

Regards, Roald


On 05/06/10 09:17, Vadim Bokin wrote:
> My map viewer is using Proj4js for re-projection and I know that it goes out
> to http://spatialreference.org/ to get definitions that are not yet known to
> OpenLayers through the /def/*.js files.
>
> However, I know that my map client will be used on local network w/o any
> internet connectivity.  It'll be connected to a map server on the LAN and
> the base map can be in whatever projection, not just WGS84 or Mercator.
> Data layers will come from the same LAN.
>
> The map viewer is already built to support "any" projection as long as the
> definition is known and the map client performs all necessary on-the-fly re
> projections for vector data.
>
> However, in this stand-alone environment, there is no access to Spatial
> Reference website.
>
> So I was wondering - does anyone have a JavaScript file - e.g. EPSG.js -
> that has all of the definitions, or say "a lot" of definitions preloaded
> ahead of time that I could load into OL at start up?
>
> I'm thinking of a single file with a bunch of definitions
>
> Proj4js.defs["EPSG:1111"] = "...;
> Proj4js.defs["EPSG:2222"] = "...;
>
> Or a zip file of individual files for all the WKIDs
>
> e.g.
>
> EPSG1111.js, EPSG2222.js, and so on.
>
>
> Or perhaps someone from http://spatialreference.org/ here could comment if a
> data-dump is available from your site?
>
> Thank you.
>
>    




More information about the Users mailing list