I have a script which converts local coordinates to WGS84. The script works fine if source data and source CS is epsg:21781. The CS for the data has changed now to epsg:2056. When I use epsg:2056 as source the point coordinate is not transformed at all and the transformation output equals transformation input. Here is the script where the transformation takes place:

var src = new Proj4js.Proj("EPSG:21781"); //<-- EPSG:2056 does not transform 
var dst = new Proj4js.Proj("WGS84"); 
var point = new Proj4js.Point(center.lon, center.lat); 
Proj4js.transform(src, dst, point) 

I don't know anything about Proj4js and I'm just stuck here.


You must just use version that is new enough for having support for EPSG:2056. For example, the development versions from http://www.gisinternals.com/ are built with proj.4 version "proj-4.8" and they know your projection.

gdalinfo --version
GDAL 2.1.0dev, released 2015/99/99

Check if EPSG:2056 is recognized:

gdalsrsinfo epsg:2056

PROJ.4 : '+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=2600000 +y_0=1200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0
+units=m +no_defs '

PROJCS["CH1903+ / LV95",
            SPHEROID["Bessel 1841",6377397.155,299.1528128,

The definitions of the new and old seem to be:

# CH1903 / LV03
<21781> +proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel +towgs84=674.4,15.1,405.3,0,0,0,0 +units=m +no_defs  <>

# CH1903+ / LV95
<2056> +proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=2600000 +y_0=1200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs  <>

Changes seem to be in false easting and northing and in towgs84 parameters.

If you can't update your Proj.4 you can always define the projection with the proj string instead of the EPSG:code. Thus use this as projection and you will be fine:

+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=2600000 +y_0=1200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs 
  • This is not correct (or better say "not accurate"), you cannot transform from 21781 to/from 2056 like this. Well, you get approximate values with an error of < 1.6m, see Transformation accuracy. If this is sufficient for your application you can go for it. However, then would be easier and quicker just to calculate X(LV95) = X(LV03) + 2000000 and Y(LV95) = Y(LV03) + 1000000 which gives you the same result. – Wernfried Domscheit Jul 9 '16 at 15:24
  • For better accuracy with proj4 you would need a grid shift file. Swisstopo has probably not published such. – user30184 Jul 9 '16 at 22:36
  • Swisstopo provides them, you can download for free from here: shop.swisstopo.admin.ch/en/products/geo_software/GIS_info. However, it also took me some time to find them. – Wernfried Domscheit Jul 10 '16 at 5:44

According to Proj4js project site the tool has only a very limited number of predefined projections. You have to define the projection by yourself. Check the documentation.

For proper (i.e. accurate) transformation you have to download the grid-shift files CHENYX06_etrs.gsb and CHENYX06a.gsb from Swisstopo. Here are the definitions for all combinations:

Transformation from EPSG:21781 to EPSG:2056 (LV03/CH1903 to LV95/CH1903+):

+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel +nadgrids=CHENYX06a.gsb +units=m +no_defs
   +to +proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=2600000 +y_0=1200000 +ellps=bessel +nadgrids=@null +units=m +no_defs

Transformation from EPSG:2056 to EPSG:4326 (LV95/CH1903+ to WGS84):

+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +ellps=bessel +x_0=2600000 +y_0=1200000 +towgs84=674.374,15.056,405.346,0,0,0,0 +k_0=1.0 +units=m +no_defs
   +to +proj=longlat +datum=WGS84 +no_defs

Transformation from EPSG:21781 to EPSG:4326 (LV03/CH1903 to WGS84):

+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel +units=m +nadgrids=chenyx06etrs.gsb +no_defs 
   +to +proj=longlat +datum=WGS84 +no_defs

Obviously you have to swap the definitions if you have to convert the other way around. I don't know where you have to place the grid-shift files, in Proj4 there is a folder named "share" or you can set an environment variable PROJ_LIB where you give the folder name.

  1. Go to http://spatialreference.org
  2. Type in 2056 in the search
  3. Click the link for EPSG:2056
  4. Click proj4 on the left

Here is your definition,

+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=2600000 +y_0=1200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs 

Consider adding that to lib/global.js or supplying it explicitly in the call to proj4

  • If you like to make precise conversion (i.e. proper datum shift) you cannot use this definition. Using this one gives an error up to 1.6m. Code for CoordinateTransformation is EPSG:15486 , you can find if officially at epsg-registry.org (spatialreference.org is just a private non-binding home page) – Wernfried Domscheit Apr 18 '18 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.