Using EPSG codes with cs2cs

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Using EPSG codes with cs2cs

R.Vives
Hello,

Is it possible to use EPSG codes with cs2cs? I tried the following command:

"cs2cs +init=epsg:4326 +to +init=epsg:32632"

but it didn't work, i only get this message:

"Using from definition: init=epsg:4326
Rel. 4.7.1, 23 September 2009
<cs2cs>:
projection initialization failure
cause: Unknown error
program abnormally terminated"

Regards

Rafael
Reply | Threaded
Open this post in threaded view
|

Re: Using EPSG codes with cs2cs

Frank Warmerdam
R.Vives wrote:

> Hello,
>
> Is it possible to use EPSG codes with cs2cs? I tried the following command:
>
> "cs2cs +init=epsg:4326 +to +init=epsg:32632"
>
> but it didn't work, i only get this message:
>
> "Using from definition: init=epsg:4326
> Rel. 4.7.1, 23 September 2009
> <cs2cs>:
> projection initialization failure
> cause: Unknown error
> program abnormally terminated"

Rafael,

It works for me!

Perhaps the epsg init file isn't being found, or your lacks code 32632?

Try setting the PROJ_DEBUG environment variable to the value "5" and running
again to see all files accessed.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [hidden email]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: Using EPSG codes with cs2cs

R.Vives
Thank you for your quick answer,

Where do you modify the PROJ_DEBUG environment variable? (I am a beginner with the PROJ.4 library)
Reply | Threaded
Open this post in threaded view
|

Re: Using EPSG codes with cs2cs

Frank Warmerdam
R.Vives wrote:
> Thank you for your quick answer,
>
> Where do you modify the PROJ_DEBUG environment variable? (I am a beginner
> with the PROJ.4 library)

Rafael,

It is an environment variable.  It depends on your operating system
environment.

For a Windows cmd.exe command shell do:

   set PROJ_DEBUG=5
   cs2cs.exe ...

For unix with a bourne style shell use export:

   export PROJ_DEBUG=5
   cs2cs ...

For unix with a c shell use setenv:

   setenv PROJ_DEBUG 5
   cs2cs ...

Unfortunately you gave no clue to your operating system or I would have
provided an example in my first reply.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [hidden email]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: Using EPSG codes with cs2cs

R.Vives
Sorry, I should have tell you, I work on Windows XP.

I managed to modify the environment variable just like you said and when I enter my command

I have the following new message: "pj_open_lib(epsg): call fopen(C:PROJSHARE\epsg) - failed"

"C:\gdal_ogr>cs2cs +init=epsg:4326 +to +init=epsg:32632
pj_open_lib(epsg): call fopen(C:PROJSHARE\epsg) - failed
Using from definition: init=epsg:4326
Rel. 4.7.1, 23 September 2009
<cs2cs>:
projection initialization failure
cause: Unknown error
program abnormally terminated"

In fact, I don't have any PROJSHARE folder on C:, so I guess this is what is wrong.

Regards,

Rafael
Reply | Threaded
Open this post in threaded view
|

Re: Using EPSG codes with cs2cs

Frank Warmerdam
R.Vives wrote:

> Sorry, I should have tell you, I work on Windows XP.
>
> I managed to modify the environment variable just like you said and when I
> enter my command
>
> I have the following new message: "pj_open_lib(epsg): call
> fopen(C:PROJSHARE\epsg) - failed"
>
> "C:\gdal_ogr>cs2cs +init=epsg:4326 +to +init=epsg:32632
> pj_open_lib(epsg): call fopen(C:PROJSHARE\epsg) - failed
> Using from definition: init=epsg:4326
> Rel. 4.7.1, 23 September 2009
> <cs2cs>:
> projection initialization failure
> cause: Unknown error
> program abnormally terminated"
>
> In fact, I don't have any PROJSHARE folder on C:, so I guess this is what is
> wrong.

Rafael,

I'm not sure where you got your cs2cs.exe binary, but hopefully that also
came with the "epsg" file somewhere in the tree.  If you set the PROJ_LIB
environment variable to point to the directory containing the epsg init
file then things will hopefully work.

eg.

set PROJ_LIB=C:\PROJ\NAD
cs2cs.exe ...

If you need to you can grab a recent epsg init file from:

   http://svn.osgeo.org/metacrs/proj/trunk/proj/nad/epsg

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [hidden email]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: Using EPSG codes with cs2cs

R.Vives
Problem solved!

I specified the path to my 'gdal_ogr' folder (where are located cs2cs.exe and the epsg file).

set PROJ_LIB=C:\gdal_ogr

Then I typed my command again:

C:\gdal_ogr>cs2cs +init=epsg:4326 +to +init=epsg:32632
pj_open_lib(epsg): call fopen(C:\gdal_ogr\epsg) - succeeded
pj_open_lib(epsg): call fopen(C:\gdal_ogr\epsg) - succeeded
45.0 10.0
4714852.20      1361287.34 0.00

It works!!!

Thank you very much,
Best regards.

Rafael

Reply | Threaded
Open this post in threaded view
|

Re: Using EPSG codes with cs2cs

rps_rt
This post has NOT been accepted by the mailing list yet.
This post was updated on .
In reply to this post by Frank Warmerdam
Dear Warmerdam and all members,

I have been browsing and reading for a while to convert my coordinates with no hope until finding this Proj. 4.

Kindly, I seek your support here ... I am using Linux Ubuntu to convert from long/lat (WGS84) to Cartesian (x/y) and vice versa. My need here is to get as accurate as possible results (cm-level if possible).

I was reading this thread because I had a problem of getting a cs2cs results for espg=31495, while I could get them for espg=31468. But the conversion results with the later one were not accurate ~ almost 100 meters away.

e.g.,: echo "13.755944 51.054555" | cs2cs +init=epsg:4326 +to +init=epsg:31468

but when I change it to: echo "13.755944 51.054555" | cs2cs +init=epsg:4326 +to +init=epsg:31495,
I get the message "projection initialization failure cause: no options found in 'init' file".

I tried to change something based on this thread, to make sure that my PROJ_LIB path is in place, but it seems I ruined everything. Afterwards, all espg zones gave the below error:
"
pj_open_lib(epsg): call fopen(/usr/local/bin/cs2cs/epsg) - failed
Using from definition: init=epsg:31467
Rel. 4.8.0, 6 March 2012
<cs2cs>:
projection initialization cause: no system list, errno: 20
"

I tried to "make uninstall" and "make install" but nothing was fixed!!

Here are more details about my project:

My locations are in Dresden city, Germany, (DHDN4), and I have (I assume) all what is needed to get my coordinates converted accurately, but no idea how to process them in Proj. 4 (I am totally new here):

PROJCS["DHDN / Germany zone 4",GEOGCS["DHDN",DATUM["Deutsche_Hauptdreiecksnetz",
SPHEROID["Bessel 1841",6377397.155,299.1528128]],PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",12],
PARAMETER["scale_factor",1],PARAMETER["false_easting",4500000],
PARAMETER["false_northing",0],UNIT["metre",1]]
TOWGS84=582.0,105.0,414.0,5.042e-6,1.696e-6,-1.4932e-5,8.3
EPSG=31495

%Seven parameters:
% 582.00     - Translation dx in meter to WGS84
% 105.0      - Translation dy in meter to WGS84
% 414.50     - Translation dz in meter to WGS84
% 5.042e-6   - Rotation ro (omega) in radians to WGS84
% 1.696e-6   - Rotation rf (phi) in radians to WGS84
% -1.4932e-5 - Rotation rk (Kappa) in radians to WGS84
% 8.3e-06    - Mapscale factor in ppm (parts per million) to WGS84(m)

Sorry for the long thread but did not want to miss any details, even in my first ever thread in this forum.

I will be looking forward to reading form you.
Best regards,
Amro