I have a shell script that converts Gauß-Krüger coordinates (which
are still used by some Germand botanists) to WGS 84.  It looks
roughly like this:

        # RW and HW contain the "Rechtswert" and "Hochwert" in GK (Potsdam
        # datum)
        # Figure out the source coordinate system, depending on the first digit
        # of the "Rechtswert", i. e. the "Meridianstreifen":
        case "$RW" in
                (2*) CS="epsg:31466"  ;;
                (3*) CS="epsg:31467"  ;;
                (4*) CS="epsg:31468"  ;;
                (5*) CS="epsg:31469"  ;;
                (**) CS="epsg:31467"  ;;
        esac
        # convert to WGS 84
        echo "$RW" "$HW" |
                cs2cs +init="$CS" +to +init=epsg:4326 |
                read LON LAT JUNK

Now I need to do the reverse transformation.  There is no obvious
way to guess the right destination coordinate system.  Is there a
simpler way than just trying all four and see which one yields the
correct result?

        for CS in epsg:31466 epsg:31467 epsg:31468 epsg:31469; do
                echo "$LAT" "$LON" |
                        cs2cs +init=epsg:4326 +to +init="$CS" |
                        read RW HW JUNK
                # if RW and HW are good, return them, otherwise try next CS
        done

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
_______________________________________________
PROJ mailing list
PROJ@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/proj

Reply via email to