52 use,
INTRINSIC :: iso_c_binding
60 TYPE(c_ptr) :: ptr = c_null_ptr
72 REAL(kind=c_double) :: u=huge(1.0_c_double)
73 REAL(kind=c_double) :: v=huge(1.0_c_double)
76 REAL(kind=c_double),
PARAMETER :: pj_deg_to_rad=.0174532925199432958d0
77 REAL(kind=c_double),
PARAMETER :: pj_rad_to_deg=57.29577951308232d0
83 MODULE PROCEDURE pj_associated_object
91 CHARACTER(kind=c_char) :: name(*)
97 FUNCTION pj_transform(src, dst, point_count, point_offset, x, y, z) &
98 bind(c,name=
'pj_transform')
102 INTEGER(kind=c_long),
VALUE :: point_count
103 INTEGER(kind=c_int),
VALUE :: point_offset
104 REAL(kind=c_double) :: x(*)
105 REAL(kind=c_double) :: y(*)
106 REAL(kind=c_double) :: z(*)
107 INTEGER(kind=c_int) :: pj_transform
108 END FUNCTION pj_transform
112 FUNCTION pj_datum_transform(src, dst, point_count, point_offset, x, y, z) &
113 bind(c,name=
'pj_datum_transform')
117 INTEGER(kind=c_long),
VALUE :: point_count
118 INTEGER(kind=c_int),
VALUE :: point_offset
119 REAL(kind=c_double) :: x(*)
120 REAL(kind=c_double) :: y(*)
121 REAL(kind=c_double) :: z(*)
122 INTEGER(kind=c_int) :: pj_datum_transform
123 END FUNCTION pj_datum_transform
127 FUNCTION pj_fwd(val, proj) BIND(C,name='pj_fwd')
136 FUNCTION pj_inv(val, proj) BIND(C,name='pj_inv')
145 FUNCTION pj_geocentric_to_geodetic(a, es, point_count, point_offset, x, y, z) &
146 bind(c,name=
'pj_geocentric_to_geodetic')
148 REAL(kind=c_double),
VALUE :: a
149 REAL(kind=c_double),
VALUE :: es
150 INTEGER(kind=c_long),
VALUE :: point_count
151 INTEGER(kind=c_int),
VALUE :: point_offset
152 REAL(kind=c_double) :: x(*)
153 REAL(kind=c_double) :: y(*)
154 REAL(kind=c_double) :: z(*)
155 INTEGER(kind=c_int) :: pj_geocentric_to_geodetic
156 END FUNCTION pj_geocentric_to_geodetic
160 FUNCTION pj_geodetic_to_geocentric(a, es, point_count, point_offset, x, y, z) &
161 bind(c,name=
'pj_geodetic_to_geocentric')
163 REAL(kind=c_double),
VALUE :: a
164 REAL(kind=c_double),
VALUE :: es
165 INTEGER(kind=c_long),
VALUE :: point_count
166 INTEGER(kind=c_int),
VALUE :: point_offset
167 REAL(kind=c_double) :: x(*)
168 REAL(kind=c_double) :: y(*)
169 REAL(kind=c_double) :: z(*)
170 INTEGER(kind=c_int) :: pj_geodetic_to_geocentric
171 END FUNCTION pj_geodetic_to_geocentric
175 FUNCTION pj_compare_datums(srcdefn, dstdefn) BIND(C,name='pj_compare_datums')
179 INTEGER(kind=c_int) :: pj_compare_datums
180 END FUNCTION pj_compare_datums
184 FUNCTION pj_is_latlong(proj) BIND(C,name='pj_is_latlong')
187 INTEGER(kind=c_int) :: pj_is_latlong
188 END FUNCTION pj_is_latlong
192 FUNCTION pj_is_geocent(proj) BIND(C,name='pj_is_geocent')
195 INTEGER(kind=c_int) :: pj_is_geocent
196 END FUNCTION pj_is_geocent
200 FUNCTION pj_get_def(proj, options) BIND(C,name='pj_get_def')
203 INTEGER(kind=c_int) :: options
204 TYPE(c_ptr) :: pj_get_def
205 END FUNCTION pj_get_def
210 FUNCTION pj_latlong_from_proj(proj) BIND(C,name='pj_latlong_from_proj')
214 END FUNCTION pj_latlong_from_proj
238 SUBROUTINE pj_free(proj) BIND(C,name='pj_free')
241 END SUBROUTINE pj_free
260 FUNCTION pj_associated_object(arg1, arg2) RESULT(associated_)
262 TYPE(
pj_object),
INTENT(in),
OPTIONAL :: arg2
263 LOGICAL :: associated_
264 IF(
PRESENT(arg2))
THEN 265 associated_ = c_associated(arg1%ptr, arg2%ptr)
267 associated_ = c_associated(arg1%ptr)
269 END FUNCTION pj_associated_object
278 FUNCTION pj_transform_f(src, dst, x, y, z)
281 REAL(kind=c_double) :: x(:)
282 REAL(kind=c_double) :: y(:)
283 REAL(kind=c_double),
OPTIONAL :: z(:)
284 INTEGER(kind=c_int) :: pj_transform_f
286 REAL(kind=c_double),
POINTER :: dummyz(:)
289 pj_transform_f = pj_transform(src, dst, &
290 int(min(
SIZE(x),
SIZE(y),
SIZE(z)), kind=c_long), 1_c_int, x, y, z)
293 pj_transform_f = pj_transform(src, dst, &
294 int(min(
SIZE(x),
SIZE(y)), kind=c_long), 1_c_int, x, y, dummyz)
297 END FUNCTION pj_transform_f
305 FUNCTION pj_datum_transform_f(src, dst, x, y, z)
308 REAL(kind=c_double) :: x(:)
309 REAL(kind=c_double) :: y(:)
310 REAL(kind=c_double),
OPTIONAL :: z(:)
311 INTEGER(kind=c_int) :: pj_datum_transform_f
313 REAL(kind=c_double),
POINTER :: dummyz(:)
316 pj_datum_transform_f = pj_datum_transform(src, dst, &
317 int(min(
SIZE(x),
SIZE(y),
SIZE(z)), kind=c_long), 1_c_int, x, y, z)
320 pj_datum_transform_f = pj_datum_transform(src, dst, &
321 int(min(
SIZE(x),
SIZE(y)), kind=c_long), 1_c_int, x, y, dummyz)
324 END FUNCTION pj_datum_transform_f
332 FUNCTION pj_geocentric_to_geodetic_f(a, es, x, y, z)
333 REAL(kind=c_double),
VALUE :: a
334 REAL(kind=c_double),
VALUE :: es
335 REAL(kind=c_double) :: x(:)
336 REAL(kind=c_double) :: y(:)
337 REAL(kind=c_double) :: z(:)
338 INTEGER(kind=c_int) :: pj_geocentric_to_geodetic_f
340 pj_geocentric_to_geodetic_f = &
341 pj_geocentric_to_geodetic(a, es, &
342 int(min(
SIZE(x),
SIZE(y),
SIZE(x)), kind=c_long), 1_c_int, x, y, z)
344 END FUNCTION pj_geocentric_to_geodetic_f
352 FUNCTION pj_geodetic_to_geocentric_f(a, es, x, y, z)
353 REAL(kind=c_double),
VALUE :: a
354 REAL(kind=c_double),
VALUE :: es
355 REAL(kind=c_double) :: x(:)
356 REAL(kind=c_double) :: y(:)
357 REAL(kind=c_double) :: z(:)
358 INTEGER(kind=c_int) :: pj_geodetic_to_geocentric_f
360 pj_geodetic_to_geocentric_f = &
361 pj_geodetic_to_geocentric(a, es, &
362 int(min(
SIZE(x),
SIZE(y),
SIZE(x)), kind=c_long), 1_c_int, x, y, z)
364 END FUNCTION pj_geodetic_to_geocentric_f
Initialize a projection from a string.
Fortran 2003 interface to the proj.4 https://github.com/OSGeo/proj.4 library.
Object describing a coordinate pair.
Object describing a cartographic projection.
Test whether an opaque object is valid.