;;; This file was automatically generated by SWIG (http://www.swig.org).
;;; Version 1.3.38
;;;
;;; Do not make changes to this file unless you know what you are doing--modify
;;; the SWIG interface file instead.

(define-module (proj))


;; SWIG does not emit define-module for Module linkage
(define-module (proj))
(load-extension "libguile_proj.so" "scm_init_proj_module")

(define-public (degrees-to-radians d) (* 3.14159265358979323846 (/ d 180.0)))
(define-public (radians-to-degrees r) (* 180.0 (/ r 3.14159265358979323846)))

(define *pj-utm84* (pj-init '("proj=utm" "lon_0=69W")))

;; geodetic in degrees, positive east longitude
;; utm in meters

(define-public (geodetic->utm19-84 lat lon)
  (let*
      ((g (new-projUV (degrees-to-radians lon)
		      (degrees-to-radians lat)))
       (u (pj-fwd g *pj-utm84*)))
    (list
     (projUV-u-get u)
     (projUV-v-get u))))

(define-public (utm19-84->geodetic e n)
  (let*
      ((u (new-projUV e n))
       (g (pj-inv u *pj-utm84*)))
    (list
     (radians-to-degrees (projUV-u-get g))
     (radians-to-degrees (projUV-v-get g)))))


(export pj-init
        pj-free
        projUV-u-set
        projUV-u-get
        projUV-v-set
        projUV-v-get
        new-projUV
        delete-projUV
        pj-fwd
        pj-inv)
