: # Script to do some testing of various transformation that do not depend # on datum files. # # TEST_CLI_DIR=`dirname $0` EXE=$1 usage() { echo "Usage: ${0} " echo exit 1 } if test -z "${EXE}"; then EXE=../../src/cs2cs fi if test ! -x ${EXE}; then echo "*** ERROR: Can not find '${EXE}' program!" exit 1 fi if test -z "${PROJ_LIB}"; then export PROJ_LIB="`dirname $0`/../../data" fi # Would be great to have a universale way of selecting a locale with # a decimal separator that is not '.' if command locale >/dev/null 2>/dev/null; then if test `locale -a | grep fr_FR.utf8`; then echo "Using locale with comma as decimal separator" export LC_ALL=fr_FR.UTF-8 export PROJ_USE_ENV_LOCALE=1 fi fi echo "============================================" echo "Running ${0} using ${EXE}:" echo "============================================" OUT=tv_out # echo "doing tests into file ${OUT}, please wait" rm -f ${OUT} # echo "##############################################################" >> ${OUT} echo Test raw ellipse to raw ellipse >> ${OUT} # $EXE +proj=latlong +ellps=clrk66 \ +to +proj=latlong +ellps=bessel \ -E >>${OUT} <> ${OUT} echo Test NAD27 to raw ellipse >> ${OUT} # $EXE +proj=latlong +datum=NAD27 \ +to +proj=latlong +ellps=bessel \ -E >>${OUT} <> ${OUT} echo Between two 3parameter approximations on same ellipsoid >> ${OUT} # $EXE +proj=latlong +ellps=bessel +towgs84=5,0,0 \ +to +proj=latlong +ellps=bessel +towgs84=1,0,0 \ -E >>${OUT} <> ${OUT} echo 3param to raw ellipsoid on same ellipsoid >> ${OUT} # $EXE +proj=latlong +ellps=bessel +towgs84=5,0,0 \ +to +proj=latlong +ellps=bessel \ -E >>${OUT} <> ${OUT} echo Test simple prime meridian handling. >> ${OUT} # $EXE +proj=latlong +datum=WGS84 +pm=greenwich \ +to +proj=latlong +datum=WGS84 +pm=1 \ -E >>${OUT} <> ${OUT} echo Test support for the lon_wrap switch. >> ${OUT} # $EXE +proj=latlong +datum=WGS84 \ +to +proj=latlong +datum=WGS84 +lon_wrap=180 \ -E >>${OUT} <> ${OUT} echo Test simple prime meridian handling within a projection. >> ${OUT} # $EXE +proj=utm +zone=11 +datum=WGS84 +pm=3 \ +to +proj=latlong +datum=WGS84 +pm=1w \ -E >>${OUT} <> ${OUT} echo Test geocentric x/y/z generation. >> ${OUT} # $EXE +proj=latlong +datum=WGS84 \ +to +proj=geocent +datum=WGS84 \ -E >>${OUT} <> ${OUT} echo Test geocentric x/y/z consumption. >> ${OUT} # $EXE +proj=geocent +datum=WGS84 \ +to +proj=latlong +datum=WGS84 \ -E >>${OUT} <> ${OUT} echo Test conversion from geodetic latlong to geocentric latlong >> ${OUT} # $EXE +proj=latlong +datum=WGS84 \ +to +proj=latlong +datum=WGS84 +geoc \ -E >>${OUT} <> ${OUT} echo Test conversion from geocentric latlong to geodetic latlong >> ${OUT} # $EXE +proj=latlong +datum=WGS84 +geoc \ +to +proj=latlong +datum=WGS84 \ -E >>${OUT} <> ${OUT} echo "Test stere projection (re: win32 ticket 12)" >> ${OUT} # $EXE +proj=latlong +datum=WGS84 \ +to +proj=stere +lat_0=90 +lon_0=0 +lat_ts=70 +datum=WGS84 \ -E >>${OUT} <> ${OUT} echo "Test stere without lat_ts (#147)" >> ${OUT} # $EXE +proj=latlong +datum=WGS84 \ +to +proj=stere +lat_0=40 +lon_0=10 +datum=WGS84 \ -E >>${OUT} <> ${OUT} echo "Test sts projection (re: ticket 12)" >> ${OUT} # $EXE +proj=latlong +ellps=WGS84 \ +to +proj=kav5 +ellps=WGS84 +units=m \ -E >>${OUT} <>${OUT} <> ${OUT} echo "Test RSO Borneo projection (re: ticket 62)" >> ${OUT} # $EXE +proj=latlong +a=6377298.556 +rf=300.8017 \ +to +proj=omerc +a=6377298.556 +rf=300.8017 +lat_0=4 +lonc=115 \ +alpha=53d18\'56.9537 +gamma=53d7\'48.3685 +k_0=0.99984 \ +x_0=590476.87 +y_0=442857.65 \ -E >>${OUT} <> ${OUT} echo "Test extended transverse mercator (#97)" >> ${OUT} # $EXE +proj=etmerc +k=0.998 +lon_0=-20 +datum=WGS84 +x_0=10000 +y_0=20000 \ +to +proj=latlong +datum=WGS84 \ -E >>${OUT} <> ${OUT} echo "Test extended transverse mercator inverse (#97)" >> ${OUT} # $EXE +proj=latlong +datum=WGS84 \ +to +proj=etmerc +k=0.998 +lon_0=-20 +datum=WGS84 +x_0=10000 +y_0=20000 \ -E >>${OUT} <> ${OUT} echo "Test transverse mercator (#97)" >> ${OUT} # $EXE +proj=tmerc +approx +k=0.998 +lon_0=-20 +datum=WGS84 +x_0=10000 +y_0=20000 \ +to +proj=latlong +datum=WGS84 \ -E >>${OUT} <> ${OUT} echo "Test transverse mercator inverse (#97)" >> ${OUT} # $EXE +proj=latlong +datum=WGS84 \ +to +proj=tmerc +approx +k=0.998 +lon_0=-20 +datum=WGS84 +x_0=10000 +y_0=20000 \ -E >>${OUT} <> ${OUT} echo "Test robinson projection (#113)" >> ${OUT} # $EXE +proj=latlong +datum=WGS84 \ +to +proj=robin +datum=WGS84 \ -E >>${OUT} <>${OUT} <> ${OUT} echo "Test hammer projection (pull request #329)" >> ${OUT} $EXE +proj=latlong +datum=WGS84 \ +to +proj=hammer +datum=WGS84 \ -E >>${OUT} <>${OUT} <> ${OUT} echo "Test healpix forward projection on sphere" >> ${OUT} $EXE +proj=latlong +R=1 +lon_0=0 \ +to +proj=healpix +R=1 +lon_0=0 -f '%.'5'f' \ -E >>${OUT} <>${OUT} <> ${OUT} $EXE +proj=latlong +a=1 +lon_0=0 +ellps=WGS84 \ +to +proj=healpix +a=1 +lon_0=0 +ellps=WGS84 -f '%.'5'f' \ -E >>${OUT} <>${OUT} <> ${OUT} $EXE +proj=latlong +a=1 +lon_0=0 +ellps=WGS84 \ +to +proj=healpix +a=1 +lon_0=0 +ellps=WGS84 -f '%.'5'f' -I\ -E >>${OUT} <>${OUT} <> ${OUT} echo "Test rHEALPix forward projection on sphere north=0 south=0" >> ${OUT} $EXE +proj=latlong +R=5 \ +to +proj=rhealpix +R=5 +north_square=0 +south_square=0 -f '%.'5'f' \ -E >>${OUT} <> ${OUT} echo "Test rHEALPix forward projection on sphere north=1 south=1" >> ${OUT} $EXE +proj=latlong +R=5 \ +to +proj=rhealpix +R=5 +north_square=1 +south_square=1 -f '%.'5'f' \ -E >>${OUT} <> ${OUT} echo "Test rHEALPix inverse projection on sphere north=0 south=0" >> ${OUT} $EXE +proj=latlong +R=5 \ +to +proj=rhealpix +R=5 +north_square=0 +south_square=0 -f '%.'5'f' -I\ -E >>${OUT} <> ${OUT} echo "Test rHEALPix inverse projection on sphere north=1 south=1" >> ${OUT} $EXE +proj=latlong +R=5 \ +to +proj=rhealpix +R=5 +north_square=1 +south_square=1 -f '%.'5'f' -I\ -E >>${OUT} <> ${OUT} echo "Test rHEALPix forward projection on ellipsoid north=0 south=0" >> ${OUT} $EXE +proj=latlong +a=5 +e=0.8 +r_a=4.3220011711888882\ +to +proj=rhealpix +a=5 +e=0.8 +r_a=4.3220011711888882 +north_square=0 +south_square=0 -f '%.'5'f' \ -E >>${OUT} <> ${OUT} echo "Test rHEALPix forward projection on ellipsoid north=1 south=1" >> ${OUT} $EXE +proj=latlong +a=5 +e=0.8 +r_a=4.3220011711888882\ +to +proj=rhealpix +a=5 +e=0.8 +r_a=4.3220011711888882 +north_square=1 +south_square=1 -f '%.'5'f' \ -E >>${OUT} <> ${OUT} echo "Test rHEALPix inverse projection on ellipsoid north=0 south=0" >> ${OUT} $EXE +proj=latlong +a=5 +e=0.8 +r_a=4.3220011711888882\ +to +proj=rhealpix +a=5 -I +e=0.8 +r_a=4.3220011711888882 +north_square=0 +south_square=0 -f '%.'5'f'\ -E >>${OUT} <> ${OUT} echo "Test rHEALPix inverse projection on ellipsoid north=1 south=1" >> ${OUT} $EXE +proj=latlong +a=5 +e=0.8 +r_a=4.3220011711888882\ +to +proj=rhealpix +a=5 -I +e=0.8 +r_a=4.3220011711888882 +north_square=1 +south_square=1 -f '%.'5'f'\ -E >>${OUT} <> ${OUT} echo "Test geos projection" >> ${OUT} echo "Test geos on a sphere" >> ${OUT} $EXE +proj=latlong +ellps=sphere \ +to +proj=geos +h=35785831.0 +lon_0=0 +ellps=sphere -E >>${OUT} <> ${OUT} $EXE +proj=latlong +ellps=sphere \ +to +proj=geos +h=35785831.0 +lon_0=0 +ellps=WGS84 -E >>${OUT} <> ${OUT} $EXE +proj=latlong +ellps=sphere \ +to +proj=geos +h=35785831.0 +lon_0=0 +ellps=sphere -I -E >>${OUT} <> ${OUT} $EXE +proj=latlong +ellps=sphere \ +to +proj=geos +h=35785831.0 +lon_0=0 +ellps=WGS84 -I -E >>${OUT} <> ${OUT} $EXE +proj=latlong +ellps=sphere \ +to +proj=geos +h=35785831.0 +lon_0=0 +ellps=sphere +sweep=x -E >>${OUT} <> ${OUT} $EXE +proj=latlong +ellps=sphere \ +to +proj=geos +h=35785831.0 +lon_0=0 +ellps=WGS84 +sweep=x -E >>${OUT} <> ${OUT} $EXE +proj=latlong +ellps=sphere \ +to +proj=geos +h=35785831.0 +lon_0=0 +ellps=sphere +sweep=x -I -E >>${OUT} <> ${OUT} $EXE +proj=latlong +ellps=sphere \ +to +proj=geos +h=35785831.0 +lon_0=0 +ellps=WGS84 +sweep=x -I -E >>${OUT} <> ${OUT} echo "Test the Natural Earth Projection" >> ${OUT} $EXE +proj=latlong +a=6371008.7714 +b=6371008.7714 \ +to +proj=natearth +a=6371008.7714 +b=6371008.7714 -f '%.'7'f' \ -E >>${OUT} <> ${OUT} echo "Test the Natural Earth II Projection" >> ${OUT} $EXE +proj=latlong +a=6371008.7714 +b=6371008.7714 \ +to +proj=natearth2 +a=6371008.7714 +b=6371008.7714 -f '%.'7'f' \ -E >>${OUT} <> ${OUT} echo "Test the Compact Miller projection" >> ${OUT} $EXE +proj=latlong +a=6371008.7714 +b=6371008.7714 \ +to +proj=comill +a=6371008.7714 +b=6371008.7714 -f '%.'7'f' \ -E >>${OUT} <> ${OUT} echo "Test pconic (#148)" >> ${OUT} # $EXE +proj=latlong +datum=WGS84 \ +to +proj=pconic +units=m +lat_1=20n +lat_2=60n +lon_0=60W +datum=WGS84 \ -E >>${OUT} <>${OUT} <> ${OUT} echo "Test laea" >> ${OUT} # $EXE -f '%.12f' \ +proj=laea +lat_0=45 +lon_0=-100 +units=m +datum=WGS84 \ +to +proj=latlong +datum=WGS84 \ -E >>${OUT} <> ${OUT} echo "Test forward calcofi projection" >> ${OUT} $EXE +proj=latlong +ellps=clrk66 \ +to +proj=calcofi +ellps=clrk66 \ -E >>${OUT} <> ${OUT} $EXE +proj=calcofi +ellps=clrk66 \ +to +proj=longlat +ellps=clrk66 \ -E >>${OUT} <> ${OUT} echo "Check inverse error handling with ob_tran (#225)" >> ${OUT} $EXE +proj=ob_tran \ +o_proj=moll +a=6378137 +es=0 +o_lon_p=0 +o_lat_p=0 +lon_0=180 \ -E >>${OUT} <> ${OUT} $EXE -I +proj=ob_tran \ +o_proj=moll +a=6378137 +es=0 +o_lon_p=0 +o_lat_p=0 +lon_0=180 \ -E >>${OUT} <> ${OUT} echo "Test MGI datum gives expected results (#207)" >> ${OUT} # $EXE -f '%.7f' \ +proj=latlong +datum=WGS84 \ +to +init=epsg:31284 \ -E >>${OUT} <> ${OUT} echo "Test omerc sensitivity with locations 90d from origin(#114)" >> ${OUT} # $EXE -f '%.8f' \ +proj=latlong +ellps=WGS84 \ +to +proj=omerc +ellps=WGS84 +lon_1=62.581150 +lat_1=74.856102 \ +lon_2=53.942810 +lat_2=74.905884 +units=km +no_rot \ -E >>${OUT} <> ${OUT} echo "Test omerc differences between poles (#190)" >> ${OUT} # First, north pole. $EXE -f '%.3f' \ +proj=latlong +ellps=WGS84 \ +to +proj=omerc +ellps=WGS84 +datum=WGS84 +no_rot \ +lon_1=-27 +lat_1=70 +lon_2=-38 +lat_2=80 +lat_0=70 \ -E >>${OUT} <>${OUT} <> ${OUT} echo "Test qsc" >> ${OUT} # $EXE -f '%.7f' \ +proj=latlong +datum=WGS84 \ +to +proj=qsc +datum=WGS84 \ -E >>${OUT} <>${OUT} <> ${OUT} echo "Test bug 229" >> ${OUT} # $EXE -f '%.13f' \ +init=epsg:4326 +proj=longlat +ellps=WGS84 +datum=WGS84 +towgs84=0,0,0 \ +to +proj=latlong +datum=WGS84 \ -E >>${OUT} <> ${OUT} echo "Test bug 229 (2)" >> ${OUT} # $EXE -f '%.13f' \ +init=epsg:4326 +to +init=epsg:4326 \ -E >>${OUT} <> ${OUT} echo "Test bug 244 " >> ${OUT} # $EXE -f '%.8f' \ +init=epsg:4326 \ +to +proj=aeqd +lon_0=130.0 +lat_0=40.0 +a=6378137 +b=6378137 +units=m \ -E >>${OUT} <> ${OUT} echo "Test bug 244 (2)" >> ${OUT} # $EXE -f '%.11f' \ +proj=aeqd +lon_0=130.0 +lat_0=40.0 +a=6378137 +b=6378137 +units=m \ +to +init=epsg:4326 \ -E >>${OUT} <> ${OUT} echo "Test bug 245 (use +datum=carthage)" >> ${OUT} # $EXE -f '%.7f' \ +proj=longlat +datum=WGS84 +to +proj=utm +zone=32 +datum=carthage \ -E >>${OUT} <> ${OUT} echo "Test bug 245 (use expansion of +datum=carthage)" >> ${OUT} # $EXE -f '%.7f' \ +proj=longlat +datum=WGS84 +to +proj=utm +zone=32 +a=6378249.2 +b=6356515 +towgs84=-263.0,6.0,431.0 \ -E >>${OUT} <> ${OUT} echo "Test SCH forward projection" >> ${OUT} # $EXE -f '%.7f' \ +proj=latlong +datum=WGS84 +to +proj=sch +datum=WGS84 +plat_0=30.0 +plon_0=45.0 \ +phdg_0=-12.0 +nodefs \ -E >> ${OUT} <> ${OUT} echo "Test SCH inverse projection" >> ${OUT} # $EXE -f '%.6f' \ +proj=sch +datum=WGS84 +plat_0=30.0 +plon_0=45.0 +phdg_0=-12.0 +nodefs +to \ +proj=latlong +datum=WGS84 \ -E >> ${OUT} <> ${OUT} echo "Test issue #316 (switch utm to use etmerc)" >> ${OUT} # $EXE -f '%.6f' \ +proj=latlong +datum=WGS84 +to +proj=utm +zone=35 +datum=WGS84 \ -E >>${OUT} <> ${OUT} echo "Test issue #316 (switch utm to use etmerc)" >> ${OUT} # $EXE -f '%.6f' \ +proj=latlong +datum=WGS84 +to +proj=etmerc +datum=WGS84 +k=0.9996 +lon_0=27 +x_0=500000 -f %.6f \ -E >>${OUT} <> ${OUT} echo "Test nzmg forward projection" >> ${OUT} # $EXE -f '%.7f' \ +proj=latlong +datum=WGS84 +to \ +proj=nzmg +lat_0=-41 +lon_0=173 +x_0=2510000 +y_0=6023150 +ellps=WGS84 +units=m \ -E >> ${OUT} <> ${OUT} echo "Test nzmg inverse projection" >> ${OUT} # $EXE -f '%.7f' \ +proj=nzmg +lat_0=-41 +lon_0=173 +x_0=2510000 +y_0=6023150 +ellps=WGS84 +units=m +to \ +proj=latlong +datum=WGS84 \ -E >> ${OUT} <> ${OUT} echo "Test misrsom forward projection" >> ${OUT} # $EXE -f '%.7f' \ +proj=latlong +datum=WGS84 +to \ +proj=misrsom +path=41 +ellps=WGS84 +units=m \ -E >> ${OUT} <> ${OUT} echo "Test misrsom inverse projection" >> ${OUT} # $EXE -f '%.7f' \ +proj=misrsom +path=41 +ellps=WGS84 +units=m +to \ +proj=latlong +datum=WGS84 -f '%0.7f' \ -E >> ${OUT} <> ${OUT} echo "Test patterson forward projection" >> ${OUT} # $EXE -f '%0.8f' \ +proj=latlong +datum=WGS84 \ +to +proj=patterson +a=6371008.7714 +b=6371008.7714 +units=m \ -E >> ${OUT} <> ${OUT} echo "Test patterson inverse projection" >> ${OUT} # $EXE -f '%0.3f' \ +proj=patterson +a=6371008.7714 +b=6371008.7714 +units=m \ +to +proj=latlong +datum=WGS84 \ -E >> ${OUT} <> ${OUT} echo "Test Web Mercator to avoid issue #834 in the future" >> ${OUT} # $EXE -f '%0.3f' \ +proj=utm +zone=15 +datum=NAD83 \ +to +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 \ +k=1.0 +units=m +nadgrids=@null \ -E >> ${OUT} <> ${OUT} echo "Test vto_meter" >> ${OUT} # $EXE -f '%0.3f' \ +proj=longlat +a=1 +b=1 +vto_meter=1000 \ +to +proj=longlat +a=1 +b=1 \ -E >> ${OUT} <> ${OUT} <> ${OUT} <> ${OUT} <> ${OUT} echo "Test EPSG:4326 to EPSG:32631" >> ${OUT} # Input is latitude, longitude order $EXE EPSG:4326 +to EPSG:32631 -E >> ${OUT} <> ${OUT} echo "Test EPSG:32631 to EPSG:4326" >> ${OUT} # Input is latitude, longitude order $EXE EPSG:32631 EPSG:4326 -E >> ${OUT} <> ${OUT} echo "Test EPSG:4896 to EPSG:7930" >> ${OUT} # Here we test that 4D coordinates are handled by cs2cs. Due to backwards # compatibility, the t-component is not written to STDOUT as part of the # coordinate data, but rather as part of the string that follows the xyz # components. This is only seen by users when the -E option is used. Which # means that this test also experience that behavior. $EXE -f %.4f EPSG:4896 EPSG:7930 -E >> ${OUT} <> ${OUT} echo "Test ITRF2000 to ITRF1993" >> ${OUT} # Here we test that HUGE_VAL is passed as the time value if not explicitly # specified $EXE -f %.7f ITRF2000 ITRF1993 -E >> ${OUT} <> ${OUT} echo "Check ob_tran with o_proj=longlat (#1525)" >> ${OUT} $EXE -f %.7f +proj=longlat +ellps=GRS80 +to +proj=ob_tran +o_proj=longlat +lon_0=10 +o_lat_p=90 +ellps=GRS80 -E >>${OUT} <> ${OUT} $EXE -f %.7f -I +proj=longlat +ellps=GRS80 +to +proj=ob_tran +o_proj=longlat +lon_0=10 +o_lat_p=90 +ellps=GRS80 -E >>${OUT} <> ${OUT} echo "Check +init=epsg:4326 +over +to +init=epsg:3857 +over" >> ${OUT} $EXE -f %.7f +init=epsg:4326 +over +to +init=epsg:3857 +over -E >>${OUT} <> ${OUT} echo "Check +proj=longlat +over +datum=WGS84 +to proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +over" >> ${OUT} $EXE -f %.7f +proj=longlat +over +datum=WGS84 +to proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +over -E >>${OUT} <> ${OUT} echo "Test EPSG:xxxx EPSG:yyyy filename" >> ${OUT} echo "2 49" > tmp.txt $EXE EPSG:4326 EPSG:4326 tmp.txt -E >> ${OUT} rm tmp.txt echo "##############################################################" >> ${OUT} echo "Test Colombia Urban" >> ${OUT} $EXE -f %.3f EPSG:4686 EPSG:6247 -E >> ${OUT} <> ${OUT} echo "Test effect of --authority (https://github.com/OSGeo/PROJ/issues/2442)" >> ${OUT} echo "The first result should use the EPSG:8076 operation" >> ${OUT} echo "and the second one a no-op" >> ${OUT} $EXE -E ITRF96 ITRF2014 >> ${OUT} <> ${OUT} <> ${OUT} echo "Test effect of --accuracy" >> ${OUT} $EXE -E --accuracy 0.05 EPSG:4326 EPSG:4258 >> ${OUT} <> ${OUT} echo "Test effect of --no-ballpark" >> ${OUT} $EXE -E --no-ballpark EPSG:4267 EPSG:4258 >> ${OUT} <> ${OUT} echo "Check that we can use a transformation spanning the antimeridian (should use Pulkovo 1942 to WGS 84 (20))" >> ${OUT} $EXE -E "Pulkovo 1942" "WGS 84" >> ${OUT} <> ${OUT} echo "Check that we can use a transformation spanning the antimeridian (should use Pulkovo 1942 to WGS 84 (20))" >> ${OUT} $EXE -E EPSG:2636 "WGS 84" >> ${OUT} <> ${OUT} echo "Check that we select the operation that has the smallest area of use, when 2 have the same accuracy" >> ${OUT} $EXE -E EPSG:4326 "NAD83(HARN)" >> ${OUT} <