[Proj] help with proj.4
Frank Warmerdam
warmerdam at pobox.com
Mon Jun 13 10:37:24 EST 2011
On 11-06-13 10:36 AM, zagot wrote:
> Hi to all
>
> if i run this with cs2cs
>
> cs2cs +proj=tmerc +lat_0=0 +lon_0=-3.45233333333333 +k=0.999600 +x_0=1500000
> +y_0=0 +ellps=intl +pm=rome +units=m
> +towgs84=-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68
> +to +proj=latlong +datum=WGS84
> 1514905.27 5034551.13
>
> i have this result
>
> 3d15'42.057"W 45d27'48.522"N 0.00
>
> i need to do this with programmatic but with this code
>
> char proj4Gauss[]="+proj=tmerc +lat_0=0 +lon_0=-3.45233333333333 +k=0.999600
> +x_0=1500000 +y_0=0 +ellps=intl +pm=rome +units=m
> +towgs84=-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68";
>
> char projWgs84[]="+proj=latlong +datum=WGS84 ";
>
> projPJ projGauss = pj_init_plus(proj4Gauss);
>
> double x=1514905.27 ;
> double y=5034551.13;
> double z=0;
>
> double ris = pj_transform(projGauss, projWgs84, 1, 0,&x,&y,&z);
>
> i have this result (in decimals point)
>
> 4423479.3363604508 715679.13023441052
>
> waths I wrong? in the source code
Zagot,
Are you really passing a string valued projWgs84 to pj_transform()
directly without first turning it into a projPJ structure using
pj_init_plus() like you did for the projGauss? If so, it's a wonder
things didn't crash.
Otherwise, I don't see any obvious problem. Do be aware that geographic
coordinates will be in radians, not decimal degrees so you will need to
adjust for that. But the values you are getting back are clearly not
radians.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the Proj
mailing list