27#include "gdalproto_doxy.f90"
44use,
INTRINSIC :: iso_c_binding
49INTEGER(kind=c_int),
PARAMETER :: GDT_Unknown = 0
50INTEGER(kind=c_int),
PARAMETER :: GDT_Byte = 1
51INTEGER(kind=c_int),
PARAMETER :: GDT_UInt16 = 2
52INTEGER(kind=c_int),
PARAMETER :: GDT_Int16 = 3
53INTEGER(kind=c_int),
PARAMETER :: GDT_UInt32 = 4
54INTEGER(kind=c_int),
PARAMETER :: GDT_Int32 = 5
55INTEGER(kind=c_int),
PARAMETER :: GDT_Float32 = 6
56INTEGER(kind=c_int),
PARAMETER :: GDT_Float64 = 7
57INTEGER(kind=c_int),
PARAMETER :: GDT_CInt16 = 8
58INTEGER(kind=c_int),
PARAMETER :: GDT_CInt32 = 9
59INTEGER(kind=c_int),
PARAMETER :: GDT_CFloat32 = 10
60INTEGER(kind=c_int),
PARAMETER :: GDT_CFloat64 = 11
61INTEGER(kind=c_int),
PARAMETER :: GDT_TypeCount = 12
64INTEGER(kind=c_int),
PARAMETER :: GA_ReadOnly = 0
65INTEGER(kind=c_int),
PARAMETER :: GA_Update = 1
68INTEGER(kind=c_int),
PARAMETER :: GF_Read = 0
69INTEGER(kind=c_int),
PARAMETER :: GF_Write = 1
71INTEGER(kind=c_int),
PARAMETER :: &
72 GCI_Undefined = 0, gci_grayindex = 1, gci_paletteindex = 2, &
73 gci_redband = 3, gci_greenband = 4, gci_blueband = 5, &
74 gci_alphaband = 6, gci_hueband = 7, gci_saturationband = 8, &
75 gci_lightnessband = 9, gci_cyanband = 10, gci_magentaband = 11, &
76 gci_yellowband = 12, gci_blackband = 13, gci_ycbcr_yband = 14, &
77 gci_ycbcr_cbband = 15,gci_ycbcr_crband = 16, gci_max = 16
79INTEGER(kind=c_int),
PARAMETER :: &
80 GPI_Gray = 0, gpi_rgb = 1, gpi_cmyk = 2, gpi_hls = 3
82INTEGER(kind=c_int),
PARAMETER :: &
83 GFT_Integer = 0, gft_real = 1, gft_string = 2
85INTEGER(kind=c_int),
PARAMETER :: &
86 GFU_Generic = 0, gfu_pixelcount = 1, gfu_name = 2, gfu_min = 3, &
87 gfu_max = 4, gfu_minmax = 5, gfu_red = 6, gfu_green = 7, &
88 gfu_blue = 8, gfu_alpha = 9, gfu_redmin = 10, gfu_greenmin = 11, &
89 gfu_bluemin = 12, gfu_alphamin = 13, gfu_redmax = 14, &
90 gfu_greenmax = 15, gfu_bluemax = 16, gfu_alphamax = 17, gfu_maxcount = 18
93TYPE,
BIND(C) :: gdal_gcp
94 TYPE(c_ptr) :: pszid, pszinfo
95 REAL(kind=c_double) :: dfgcppixel, dfgcpline, dfgcpx, dfgcpy, dfgcpz
98TYPE,
BIND(C) :: gdalrpcinfo
99 REAL(kind=c_double) :: dfline_off, dfsamp_off, dflat_off, dflong_off, dfheight_off
100 REAL(kind=c_double) :: dfline_scale, dfsamp_scale, dflat_scale, dflong_scale, dfheight_scale
101 REAL(kind=c_double) :: adfline_num_coeff(20), adfline_den_coeff(20), &
102 adfsamp_num_coeff(20), adfsamp_den_coeff(20)
103 REAL(kind=c_double) :: dfmin_long, dfmin_lat, dfmax_long, dfmax_lat
106TYPE,
BIND(C) :: gdalcolorentry
107 INTEGER(kind=c_short) :: c1, c2, c3, c4
108END TYPE gdalcolorentry
111include
'gdalproto_type.f90'
115 SUBROUTINE gdalapplygeotransform(padfgeotransform, dfpixel, dfline, pdfgeox, pdfgeoy) bind(C,name='GDALApplyGeoTransform')
118 REAL(kind=c_double) :: padfgeotransform(*)
119 REAL(kind=c_double),
VALUE :: dfpixel
120 REAL(kind=c_double),
VALUE :: dfline
121 REAL(kind=c_double) :: pdfgeox
122 REAL(kind=c_double) :: pdfgeoy
123 END SUBROUTINE gdalapplygeotransform
127 FUNCTION gdalgcpstogeotransform(ngcpcount, pasgcps, padfgeotransform, bapproxok) &
128 bind(c,name=
'GDALGCPsToGeoTransform')
131 INTEGER(kind=c_int),
VALUE :: ngcpcount
132 TYPE(gdal_gcp),
INTENT(in) :: pasgcps
133 REAL(kind=c_double) :: padfgeotransform(*)
134 INTEGER(kind=c_int),
VALUE :: bapproxok
135 INTEGER(kind=c_int) :: gdalgcpstogeotransform
136 END FUNCTION gdalgcpstogeotransform
140include
'gdalproto_interf.f90'
157 MODULE PROCEDURE gdalapplygeotransform_f_0d, gdalapplygeotransform_f_1d, &
158 gdalapplygeotransform_f_2d, gdalapplygeotransform_f_3d
161PRIVATE gdalapplygeotransform_f_0d, gdalapplygeotransform_f_1d, &
162 gdalapplygeotransform_f_2d, gdalapplygeotransform_f_3d
186 MODULE PROCEDURE gdaldatasetrasterio_int8, gdaldatasetrasterio_int16, &
187 gdaldatasetrasterio_int32, &
188 gdaldatasetrasterio_float, gdaldatasetrasterio_double, &
189 gdaldatasetrasterio_float_cmplx, gdaldatasetrasterio_double_cmplx
192PRIVATE gdaldatasetrasterio_int8, gdaldatasetrasterio_int16, &
193 gdaldatasetrasterio_int32, &
194 gdaldatasetrasterio_float, gdaldatasetrasterio_double, &
195 gdaldatasetrasterio_float_cmplx, gdaldatasetrasterio_double_cmplx
215 MODULE PROCEDURE gdalrasterio_int8, gdalrasterio_int16, &
216 gdalrasterio_int32, &
217 gdalrasterio_float, gdalrasterio_double, &
218 gdalrasterio_float_cmplx, gdalrasterio_double_cmplx
221PRIVATE gdalrasterio_int8, gdalrasterio_int16, &
222 gdalrasterio_int32, &
223 gdalrasterio_float, gdalrasterio_double, &
224 gdalrasterio_float_cmplx, gdalrasterio_double_cmplx
233 MODULE PROCEDURE gdalmajorobject_fromdataset_new, &
234 gdalmajorobject_fromrasterband_new, &
235 gdalmajorobject_fromdriver_new
238PRIVATE gdalmajorobject_fromdataset_new, &
239 gdalmajorobject_fromrasterband_new, &
240 gdalmajorobject_fromdriver_new
243INTERFACE gdaldatasetrasterio_loc
244 MODULE PROCEDURE gdaldatasetrasterio_int8_loc, gdaldatasetrasterio_int16_loc, &
245 gdaldatasetrasterio_int32_loc, &
246 gdaldatasetrasterio_float_loc, gdaldatasetrasterio_double_loc, &
247 gdaldatasetrasterio_float_cmplx_loc, gdaldatasetrasterio_double_cmplx_loc
249PRIVATE gdaldatasetrasterio_loc
250PRIVATE gdaldatasetrasterio_int8_loc, gdaldatasetrasterio_int16_loc, &
251 gdaldatasetrasterio_int32_loc, &
252 gdaldatasetrasterio_float_loc, gdaldatasetrasterio_double_loc, &
253 gdaldatasetrasterio_float_cmplx_loc, gdaldatasetrasterio_double_cmplx_loc
255INTERFACE gdalrasterio_loc
256 MODULE PROCEDURE gdalrasterio_int8_loc, gdalrasterio_int16_loc, &
257 gdalrasterio_int32_loc, &
258 gdalrasterio_float_loc, gdalrasterio_double_loc, &
259 gdalrasterio_float_cmplx_loc, gdalrasterio_double_cmplx_loc
261PRIVATE gdalrasterio_loc
262PRIVATE gdalrasterio_int8_loc, gdalrasterio_int16_loc, &
263 gdalrasterio_int32_loc, &
264 gdalrasterio_float_loc, gdalrasterio_double_loc, &
265 gdalrasterio_float_cmplx_loc, gdalrasterio_double_cmplx_loc
270include
'gdalproto_proc.f90'
273FUNCTION gdalgcpstogeotransform_f(pasgcps, padfgeotransform, bapproxok)
274TYPE(gdal_gcp),
INTENT(in) :: pasgcps(:)
275REAL(kind=c_double),
INTENT(out) :: padfgeotransform(6)
276INTEGER(kind=c_int),
VALUE :: bapproxok
277INTEGER(kind=c_int) :: gdalgcpstogeotransform_f
279gdalgcpstogeotransform_f = gdalgcpstogeotransform(
SIZE(pasgcps), pasgcps(1), padfgeotransform, bapproxok)
281END FUNCTION gdalgcpstogeotransform_f
289SUBROUTINE gdalapplygeotransform_f_0d(padfgeotransform, &
290 dfpixel, dfline, pdfgeox, pdfgeoy)
291REAL(kind=c_double),
INTENT(in) :: padfgeotransform(6)
292REAL(kind=c_double),
INTENT(in) :: dfpixel
293REAL(kind=c_double),
INTENT(in) :: dfline
294REAL(kind=c_double),
INTENT(out) :: pdfgeox
295REAL(kind=c_double),
INTENT(out) :: pdfgeoy
297pdfgeox = padfgeotransform(1) + &
298 dfpixel * padfgeotransform(2) + dfline * padfgeotransform(3)
299pdfgeoy = padfgeotransform(4) + &
300 dfpixel * padfgeotransform(5) + dfline * padfgeotransform(6)
302END SUBROUTINE gdalapplygeotransform_f_0d
304SUBROUTINE gdalapplygeotransform_f_1d(padfgeotransform, &
305 dfpixel, dfline, pdfgeox, pdfgeoy)
306REAL(kind=c_double),
INTENT(in) :: padfgeotransform(6)
307REAL(kind=c_double),
INTENT(in) :: dfpixel(:)
308REAL(kind=c_double),
INTENT(in) :: dfline(:)
309REAL(kind=c_double),
INTENT(out) :: pdfgeox(:)
310REAL(kind=c_double),
INTENT(out) :: pdfgeoy(:)
312pdfgeox = padfgeotransform(1) + &
313 dfpixel * padfgeotransform(2) + dfline * padfgeotransform(3)
314pdfgeoy = padfgeotransform(4) + &
315 dfpixel * padfgeotransform(5) + dfline * padfgeotransform(6)
317END SUBROUTINE gdalapplygeotransform_f_1d
319SUBROUTINE gdalapplygeotransform_f_2d(padfgeotransform, &
320 dfpixel, dfline, pdfgeox, pdfgeoy)
321REAL(kind=c_double),
INTENT(in) :: padfgeotransform(6)
322REAL(kind=c_double),
INTENT(in) :: dfpixel(:,:)
323REAL(kind=c_double),
INTENT(in) :: dfline(:,:)
324REAL(kind=c_double),
INTENT(out) :: pdfgeox(:,:)
325REAL(kind=c_double),
INTENT(out) :: pdfgeoy(:,:)
327pdfgeox = padfgeotransform(1) + &
328 dfpixel * padfgeotransform(2) + dfline * padfgeotransform(3)
329pdfgeoy = padfgeotransform(4) + &
330 dfpixel * padfgeotransform(5) + dfline * padfgeotransform(6)
332END SUBROUTINE gdalapplygeotransform_f_2d
334SUBROUTINE gdalapplygeotransform_f_3d(padfgeotransform, &
335 dfpixel, dfline, pdfgeox, pdfgeoy)
336REAL(kind=c_double),
INTENT(in) :: padfgeotransform(6)
337REAL(kind=c_double),
INTENT(in) :: dfpixel(:,:,:)
338REAL(kind=c_double),
INTENT(in) :: dfline(:,:,:)
339REAL(kind=c_double),
INTENT(out) :: pdfgeox(:,:,:)
340REAL(kind=c_double),
INTENT(out) :: pdfgeoy(:,:,:)
342pdfgeox = padfgeotransform(1) + &
343 dfpixel * padfgeotransform(2) + dfline * padfgeotransform(3)
344pdfgeoy = padfgeotransform(4) + &
345 dfpixel * padfgeotransform(5) + dfline * padfgeotransform(6)
347END SUBROUTINE gdalapplygeotransform_f_3d
353FUNCTION gdaldatasetrasterio_int8(hds, erwflag, ndsxoff, ndsyoff, pbuffer)
RESULT(err)
354TYPE(gdaldataseth),
VALUE :: hds
355INTEGER(kind=c_int),
INTENT(in) :: erwflag
356INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
357INTEGER(kind=c_int8_t),
INTENT(inout) :: pbuffer(:,:,:)
358INTEGER(kind=c_int) :: err
360INTEGER(kind=c_int) :: i
362err = gdaldatasetrasterio_loc(hds, erwflag, ndsxoff, ndsyoff, &
363 SIZE(pbuffer,1),
SIZE(pbuffer,2),
SIZE(pbuffer,3), pbuffer, &
364 (/(i,i=1,
SIZE(pbuffer,3))/))
366END FUNCTION gdaldatasetrasterio_int8
368FUNCTION gdaldatasetrasterio_int8_loc(hds, erwflag, ndsxoff, ndsyoff, &
369 ndsxsize, ndsysize, nbandcount, pbuffer, panbandcount)
RESULT(err)
370TYPE(gdaldataseth),
VALUE :: hds
371INTEGER(kind=c_int),
INTENT(in) :: erwflag
372INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
373INTEGER(kind=c_int),
INTENT(in) :: ndsxsize
374INTEGER(kind=c_int),
INTENT(in) :: ndsysize
375INTEGER(kind=c_int),
INTENT(in) :: nbandcount
376INTEGER(kind=c_int8_t),
TARGET,
INTENT(inout) :: pbuffer(ndsxsize,ndsysize,nbandcount)
377INTEGER(kind=c_int),
INTENT(in) :: panbandcount(*)
378INTEGER(kind=c_int) :: err
380err = gdaldatasetrasterio(hds, erwflag, ndsxoff, ndsyoff, &
381 ndsxsize, ndsysize, c_loc(pbuffer(1,1,1)), &
382 ndsxsize, ndsysize, gdt_byte, nbandcount, panbandcount, 0, 0, 0)
384END FUNCTION gdaldatasetrasterio_int8_loc
387FUNCTION gdaldatasetrasterio_int16(hds, erwflag, ndsxoff, ndsyoff, pbuffer)
RESULT(err)
388TYPE(gdaldataseth),
VALUE :: hds
389INTEGER(kind=c_int),
INTENT(in) :: erwflag
390INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
391INTEGER(kind=c_int16_t),
INTENT(inout) :: pbuffer(:,:,:)
392INTEGER(kind=c_int) :: err
394INTEGER(kind=c_int) :: i
396err = gdaldatasetrasterio_loc(hds, erwflag, ndsxoff, ndsyoff, &
397 SIZE(pbuffer,1),
SIZE(pbuffer,2),
SIZE(pbuffer,3), pbuffer, &
398 (/(i,i=1,
SIZE(pbuffer,3))/))
400END FUNCTION gdaldatasetrasterio_int16
402FUNCTION gdaldatasetrasterio_int16_loc(hds, erwflag, ndsxoff, ndsyoff, &
403 ndsxsize, ndsysize, nbandcount, pbuffer, panbandcount)
RESULT(err)
404TYPE(gdaldataseth),
VALUE :: hds
405INTEGER(kind=c_int),
INTENT(in) :: erwflag
406INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
407INTEGER(kind=c_int),
INTENT(in) :: ndsxsize
408INTEGER(kind=c_int),
INTENT(in) :: ndsysize
409INTEGER(kind=c_int),
INTENT(in) :: nbandcount
410INTEGER(kind=c_int16_t),
TARGET,
INTENT(inout) :: pbuffer(ndsxsize,ndsysize,nbandcount)
411INTEGER(kind=c_int),
INTENT(in) :: panbandcount(*)
412INTEGER(kind=c_int) :: err
414err = gdaldatasetrasterio(hds, erwflag, ndsxoff, ndsyoff, &
415 ndsxsize, ndsysize, c_loc(pbuffer(1,1,1)), &
416 ndsxsize, ndsysize, gdt_int16, nbandcount, panbandcount, 0, 0, 0)
418END FUNCTION gdaldatasetrasterio_int16_loc
421FUNCTION gdaldatasetrasterio_int32(hds, erwflag, ndsxoff, ndsyoff, pbuffer)
RESULT(err)
422TYPE(gdaldataseth),
VALUE :: hds
423INTEGER(kind=c_int),
INTENT(in) :: erwflag
424INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
425INTEGER(kind=c_int32_t),
INTENT(inout) :: pbuffer(:,:,:)
426INTEGER(kind=c_int) :: err
428INTEGER(kind=c_int) :: i
430err = gdaldatasetrasterio_loc(hds, erwflag, ndsxoff, ndsyoff, &
431 SIZE(pbuffer,1),
SIZE(pbuffer,2),
SIZE(pbuffer,3), pbuffer, &
432 (/(i,i=1,
SIZE(pbuffer,3))/))
434END FUNCTION gdaldatasetrasterio_int32
436FUNCTION gdaldatasetrasterio_int32_loc(hds, erwflag, ndsxoff, ndsyoff, &
437 ndsxsize, ndsysize, nbandcount, pbuffer, panbandcount)
RESULT(err)
438TYPE(gdaldataseth),
VALUE :: hds
439INTEGER(kind=c_int),
INTENT(in) :: erwflag
440INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
441INTEGER(kind=c_int),
INTENT(in) :: ndsxsize
442INTEGER(kind=c_int),
INTENT(in) :: ndsysize
443INTEGER(kind=c_int),
INTENT(in) :: nbandcount
444INTEGER(kind=c_int32_t),
TARGET,
INTENT(inout) :: pbuffer(ndsxsize,ndsysize,nbandcount)
445INTEGER(kind=c_int),
INTENT(in) :: panbandcount(*)
446INTEGER(kind=c_int) :: err
448err = gdaldatasetrasterio(hds, erwflag, ndsxoff, ndsyoff, &
449 ndsxsize, ndsysize, c_loc(pbuffer(1,1,1)), &
450 ndsxsize, ndsysize, gdt_int32, nbandcount, panbandcount, 0, 0, 0)
452END FUNCTION gdaldatasetrasterio_int32_loc
455FUNCTION gdaldatasetrasterio_float(hds, erwflag, ndsxoff, ndsyoff, pbuffer)
RESULT(err)
456TYPE(gdaldataseth),
VALUE :: hds
457INTEGER(kind=c_int),
INTENT(in) :: erwflag
458INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
459REAL(kind=c_float),
INTENT(inout) :: pbuffer(:,:,:)
460INTEGER(kind=c_int) :: err
462INTEGER(kind=c_int) :: i
464err = gdaldatasetrasterio_loc(hds, erwflag, ndsxoff, ndsyoff, &
465 SIZE(pbuffer,1),
SIZE(pbuffer,2),
SIZE(pbuffer,3), pbuffer, &
466 (/(i,i=1,
SIZE(pbuffer,3))/))
468END FUNCTION gdaldatasetrasterio_float
470FUNCTION gdaldatasetrasterio_float_loc(hds, erwflag, ndsxoff, ndsyoff, &
471 ndsxsize, ndsysize, nbandcount, pbuffer, panbandcount)
RESULT(err)
472TYPE(gdaldataseth),
VALUE :: hds
473INTEGER(kind=c_int),
INTENT(in) :: erwflag
474INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
475INTEGER(kind=c_int),
INTENT(in) :: ndsxsize
476INTEGER(kind=c_int),
INTENT(in) :: ndsysize
477INTEGER(kind=c_int),
INTENT(in) :: nbandcount
478REAL(kind=c_float),
TARGET,
INTENT(inout) :: pbuffer(ndsxsize,ndsysize,nbandcount)
479INTEGER(kind=c_int),
INTENT(in) :: panbandcount(*)
480INTEGER(kind=c_int) :: err
482err = gdaldatasetrasterio(hds, erwflag, ndsxoff, ndsyoff, &
483 ndsxsize, ndsysize, c_loc(pbuffer(1,1,1)), &
484 ndsxsize, ndsysize, gdt_float32, nbandcount, panbandcount, 0, 0, 0)
486END FUNCTION gdaldatasetrasterio_float_loc
489FUNCTION gdaldatasetrasterio_double(hds, erwflag, ndsxoff, ndsyoff, pbuffer)
RESULT(err)
490TYPE(gdaldataseth),
VALUE :: hds
491INTEGER(kind=c_int),
INTENT(in) :: erwflag
492INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
493REAL(kind=c_double),
INTENT(inout) :: pbuffer(:,:,:)
494INTEGER(kind=c_int) :: err
496INTEGER(kind=c_int) :: i
498err = gdaldatasetrasterio_loc(hds, erwflag, ndsxoff, ndsyoff, &
499 SIZE(pbuffer,1),
SIZE(pbuffer,2),
SIZE(pbuffer,3), pbuffer, &
500 (/(i,i=1,
SIZE(pbuffer,3))/))
502END FUNCTION gdaldatasetrasterio_double
504FUNCTION gdaldatasetrasterio_double_loc(hds, erwflag, ndsxoff, ndsyoff, &
505 ndsxsize, ndsysize, nbandcount, pbuffer, panbandcount)
RESULT(err)
506TYPE(gdaldataseth),
VALUE :: hds
507INTEGER(kind=c_int),
INTENT(in) :: erwflag
508INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
509INTEGER(kind=c_int),
INTENT(in) :: ndsxsize
510INTEGER(kind=c_int),
INTENT(in) :: ndsysize
511INTEGER(kind=c_int),
INTENT(in) :: nbandcount
512REAL(kind=c_double),
TARGET,
INTENT(inout) :: pbuffer(ndsxsize,ndsysize,nbandcount)
513INTEGER(kind=c_int),
INTENT(in) :: panbandcount(*)
514INTEGER(kind=c_int) :: err
516err = gdaldatasetrasterio(hds, erwflag, ndsxoff, ndsyoff, &
517 ndsxsize, ndsysize, c_loc(pbuffer(1,1,1)), &
518 ndsxsize, ndsysize, gdt_float64, nbandcount, panbandcount, 0, 0, 0)
520END FUNCTION gdaldatasetrasterio_double_loc
523FUNCTION gdaldatasetrasterio_float_cmplx(hds, erwflag, ndsxoff, ndsyoff, pbuffer)
RESULT(err)
524TYPE(gdaldataseth),
VALUE :: hds
525INTEGER(kind=c_int),
INTENT(in) :: erwflag
526INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
527COMPLEX(kind=c_float_complex),
INTENT(inout) :: pbuffer(:,:,:)
528INTEGER(kind=c_int) :: err
530INTEGER(kind=c_int) :: i
532err = gdaldatasetrasterio_loc(hds, erwflag, ndsxoff, ndsyoff, &
533 SIZE(pbuffer,1),
SIZE(pbuffer,2),
SIZE(pbuffer,3), pbuffer, &
534 (/(i,i=1,
SIZE(pbuffer,3))/))
536END FUNCTION gdaldatasetrasterio_float_cmplx
538FUNCTION gdaldatasetrasterio_float_cmplx_loc(hds, erwflag, ndsxoff, ndsyoff, &
539 ndsxsize, ndsysize, nbandcount, pbuffer, panbandcount)
RESULT(err)
540TYPE(gdaldataseth),
VALUE :: hds
541INTEGER(kind=c_int),
INTENT(in) :: erwflag
542INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
543INTEGER(kind=c_int),
INTENT(in) :: ndsxsize
544INTEGER(kind=c_int),
INTENT(in) :: ndsysize
545INTEGER(kind=c_int),
INTENT(in) :: nbandcount
546COMPLEX(kind=c_float_complex),
TARGET,
INTENT(inout) :: pbuffer(ndsxsize,ndsysize,nbandcount)
547INTEGER(kind=c_int),
INTENT(in) :: panbandcount(*)
548INTEGER(kind=c_int) :: err
550err = gdaldatasetrasterio(hds, erwflag, ndsxoff, ndsyoff, &
551 ndsxsize, ndsysize, c_loc(pbuffer(1,1,1)), &
552 ndsxsize, ndsysize, gdt_cfloat32, nbandcount, panbandcount, 0, 0, 0)
554END FUNCTION gdaldatasetrasterio_float_cmplx_loc
557FUNCTION gdaldatasetrasterio_double_cmplx(hds, erwflag, ndsxoff, ndsyoff, pbuffer)
RESULT(err)
558TYPE(gdaldataseth),
VALUE :: hds
559INTEGER(kind=c_int),
INTENT(in) :: erwflag
560INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
561COMPLEX(kind=c_double_complex),
INTENT(inout) :: pbuffer(:,:,:)
562INTEGER(kind=c_int) :: err
564INTEGER(kind=c_int) :: i
566err = gdaldatasetrasterio_loc(hds, erwflag, ndsxoff, ndsyoff, &
567 SIZE(pbuffer,1),
SIZE(pbuffer,2),
SIZE(pbuffer,3), pbuffer, &
568 (/(i,i=1,
SIZE(pbuffer,3))/))
570END FUNCTION gdaldatasetrasterio_double_cmplx
572FUNCTION gdaldatasetrasterio_double_cmplx_loc(hds, erwflag, ndsxoff, ndsyoff, &
573 ndsxsize, ndsysize, nbandcount, pbuffer, panbandcount)
RESULT(err)
574TYPE(gdaldataseth),
VALUE :: hds
575INTEGER(kind=c_int),
INTENT(in) :: erwflag
576INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
577INTEGER(kind=c_int),
INTENT(in) :: ndsxsize
578INTEGER(kind=c_int),
INTENT(in) :: ndsysize
579INTEGER(kind=c_int),
INTENT(in) :: nbandcount
580COMPLEX(kind=c_double_complex),
TARGET,
INTENT(inout) :: pbuffer(ndsxsize,ndsysize,nbandcount)
581INTEGER(kind=c_int),
INTENT(in) :: panbandcount(*)
582INTEGER(kind=c_int) :: err
584err = gdaldatasetrasterio(hds, erwflag, ndsxoff, ndsyoff, &
585 ndsxsize, ndsysize, c_loc(pbuffer(1,1,1)), &
586 ndsxsize, ndsysize, gdt_cfloat64, nbandcount, panbandcount, 0, 0, 0)
588END FUNCTION gdaldatasetrasterio_double_cmplx_loc
594FUNCTION gdalrasterio_int8(hband, erwflag, ndsxoff, ndsyoff, pbuffer)
RESULT(err)
595TYPE(gdalrasterbandh),
VALUE :: hband
596INTEGER(kind=c_int),
INTENT(in) :: erwflag
597INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
598INTEGER(kind=c_int8_t),
INTENT(inout) :: pbuffer(:,:)
599INTEGER(kind=c_int) :: err
601err = gdalrasterio_loc(hband, erwflag, ndsxoff, ndsyoff, &
602 SIZE(pbuffer,1),
SIZE(pbuffer,2), pbuffer)
604END FUNCTION gdalrasterio_int8
606FUNCTION gdalrasterio_int8_loc(hband, erwflag, ndsxoff, ndsyoff, ndsxsize, ndsysize, pbuffer)
RESULT(err)
607TYPE(gdalrasterbandh),
VALUE :: hband
608INTEGER(kind=c_int),
INTENT(in) :: erwflag
609INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
610INTEGER(kind=c_int),
INTENT(in) :: ndsxsize
611INTEGER(kind=c_int),
INTENT(in) :: ndsysize
612INTEGER(kind=c_int8_t),
TARGET,
INTENT(inout) :: pbuffer(ndsxsize,ndsysize)
613INTEGER(kind=c_int) :: err
615err = gdalrasterio(hband, erwflag, ndsxoff, ndsyoff, &
616 ndsxsize, ndsysize, c_loc(pbuffer(1,1)), &
617 ndsxsize, ndsysize, gdt_byte, 0, 0)
619END FUNCTION gdalrasterio_int8_loc
622FUNCTION gdalrasterio_int16(hband, erwflag, ndsxoff, ndsyoff, pbuffer)
RESULT(err)
623TYPE(gdalrasterbandh),
VALUE :: hband
624INTEGER(kind=c_int),
INTENT(in) :: erwflag
625INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
626INTEGER(kind=c_int16_t),
INTENT(inout) :: pbuffer(:,:)
627INTEGER(kind=c_int) :: err
629err = gdalrasterio_loc(hband, erwflag, ndsxoff, ndsyoff, &
630 SIZE(pbuffer,1),
SIZE(pbuffer,2), pbuffer)
632END FUNCTION gdalrasterio_int16
634FUNCTION gdalrasterio_int16_loc(hband, erwflag, ndsxoff, ndsyoff, ndsxsize, ndsysize, pbuffer)
RESULT(err)
635TYPE(gdalrasterbandh),
VALUE :: hband
636INTEGER(kind=c_int),
INTENT(in) :: erwflag
637INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
638INTEGER(kind=c_int),
INTENT(in) :: ndsxsize
639INTEGER(kind=c_int),
INTENT(in) :: ndsysize
640INTEGER(kind=c_int16_t),
TARGET,
INTENT(inout) :: pbuffer(ndsxsize,ndsysize)
641INTEGER(kind=c_int) :: err
643err = gdalrasterio(hband, erwflag, ndsxoff, ndsyoff, &
644 ndsxsize, ndsysize, c_loc(pbuffer(1,1)), &
645 ndsxsize, ndsysize, gdt_int16, 0, 0)
647END FUNCTION gdalrasterio_int16_loc
650FUNCTION gdalrasterio_int32(hband, erwflag, ndsxoff, ndsyoff, pbuffer)
RESULT(err)
651TYPE(gdalrasterbandh),
VALUE :: hband
652INTEGER(kind=c_int),
INTENT(in) :: erwflag
653INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
654INTEGER(kind=c_int32_t),
INTENT(inout) :: pbuffer(:,:)
655INTEGER(kind=c_int) :: err
657err = gdalrasterio_loc(hband, erwflag, ndsxoff, ndsyoff, &
658 SIZE(pbuffer,1),
SIZE(pbuffer,2), pbuffer)
660END FUNCTION gdalrasterio_int32
662FUNCTION gdalrasterio_int32_loc(hband, erwflag, ndsxoff, ndsyoff, ndsxsize, ndsysize, pbuffer)
RESULT(err)
663TYPE(gdalrasterbandh),
VALUE :: hband
664INTEGER(kind=c_int),
INTENT(in) :: erwflag
665INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
666INTEGER(kind=c_int),
INTENT(in) :: ndsxsize
667INTEGER(kind=c_int),
INTENT(in) :: ndsysize
668INTEGER(kind=c_int32_t),
TARGET,
INTENT(inout) :: pbuffer(ndsxsize,ndsysize)
669INTEGER(kind=c_int) :: err
671err = gdalrasterio(hband, erwflag, ndsxoff, ndsyoff, &
672 ndsxsize, ndsysize, c_loc(pbuffer(1,1)), &
673 ndsxsize, ndsysize, gdt_int32, 0, 0)
675END FUNCTION gdalrasterio_int32_loc
678FUNCTION gdalrasterio_float(hband, erwflag, ndsxoff, ndsyoff, pbuffer)
RESULT(err)
679TYPE(gdalrasterbandh),
VALUE :: hband
680INTEGER(kind=c_int),
INTENT(in) :: erwflag
681INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
682REAL(kind=c_float),
INTENT(inout) :: pbuffer(:,:)
683INTEGER(kind=c_int) :: err
685err = gdalrasterio_loc(hband, erwflag, ndsxoff, ndsyoff, &
686 SIZE(pbuffer,1),
SIZE(pbuffer,2), pbuffer)
688END FUNCTION gdalrasterio_float
690FUNCTION gdalrasterio_float_loc(hband, erwflag, ndsxoff, ndsyoff, ndsxsize, ndsysize, pbuffer)
RESULT(err)
691TYPE(gdalrasterbandh),
VALUE :: hband
692INTEGER(kind=c_int),
INTENT(in) :: erwflag
693INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
694INTEGER(kind=c_int),
INTENT(in) :: ndsxsize
695INTEGER(kind=c_int),
INTENT(in) :: ndsysize
696REAL(kind=c_float),
TARGET,
INTENT(inout) :: pbuffer(ndsxsize,ndsysize)
697INTEGER(kind=c_int) :: err
699err = gdalrasterio(hband, erwflag, ndsxoff, ndsyoff, &
700 ndsxsize, ndsysize, c_loc(pbuffer(1,1)), &
701 ndsxsize, ndsysize, gdt_float32, 0, 0)
703END FUNCTION gdalrasterio_float_loc
706FUNCTION gdalrasterio_double(hband, erwflag, ndsxoff, ndsyoff, pbuffer)
RESULT(err)
707TYPE(gdalrasterbandh),
VALUE :: hband
708INTEGER(kind=c_int),
INTENT(in) :: erwflag
709INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
710REAL(kind=c_double),
INTENT(inout) :: pbuffer(:,:)
711INTEGER(kind=c_int) :: err
713err = gdalrasterio_loc(hband, erwflag, ndsxoff, ndsyoff, &
714 SIZE(pbuffer,1),
SIZE(pbuffer,2), pbuffer)
716END FUNCTION gdalrasterio_double
718FUNCTION gdalrasterio_double_loc(hband, erwflag, ndsxoff, ndsyoff, ndsxsize, ndsysize, pbuffer)
RESULT(err)
719TYPE(gdalrasterbandh),
VALUE :: hband
720INTEGER(kind=c_int),
INTENT(in) :: erwflag
721INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
722INTEGER(kind=c_int),
INTENT(in) :: ndsxsize
723INTEGER(kind=c_int),
INTENT(in) :: ndsysize
724REAL(kind=c_double),
TARGET,
INTENT(inout) :: pbuffer(ndsxsize,ndsysize)
725INTEGER(kind=c_int) :: err
727err = gdalrasterio(hband, erwflag, ndsxoff, ndsyoff, &
728 ndsxsize, ndsysize, c_loc(pbuffer(1,1)), &
729 ndsxsize, ndsysize, gdt_float64, 0, 0)
731END FUNCTION gdalrasterio_double_loc
734FUNCTION gdalrasterio_float_cmplx(hband, erwflag, ndsxoff, ndsyoff, pbuffer)
RESULT(err)
735TYPE(gdalrasterbandh),
VALUE :: hband
736INTEGER(kind=c_int),
INTENT(in) :: erwflag
737INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
738COMPLEX(kind=c_float_complex),
INTENT(inout) :: pbuffer(:,:)
739INTEGER(kind=c_int) :: err
741err = gdalrasterio_loc(hband, erwflag, ndsxoff, ndsyoff, &
742 SIZE(pbuffer,1),
SIZE(pbuffer,2), pbuffer)
744END FUNCTION gdalrasterio_float_cmplx
746FUNCTION gdalrasterio_float_cmplx_loc(hband, erwflag, ndsxoff, ndsyoff, ndsxsize, ndsysize, pbuffer)
RESULT(err)
747TYPE(gdalrasterbandh),
VALUE :: hband
748INTEGER(kind=c_int),
INTENT(in) :: erwflag
749INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
750INTEGER(kind=c_int),
INTENT(in) :: ndsxsize
751INTEGER(kind=c_int),
INTENT(in) :: ndsysize
752COMPLEX(kind=c_float_complex),
TARGET,
INTENT(inout) :: pbuffer(ndsxsize,ndsysize)
753INTEGER(kind=c_int) :: err
755err = gdalrasterio(hband, erwflag, ndsxoff, ndsyoff, &
756 ndsxsize, ndsysize, c_loc(pbuffer(1,1)), &
757 ndsxsize, ndsysize, gdt_cfloat32, 0, 0)
759END FUNCTION gdalrasterio_float_cmplx_loc
762FUNCTION gdalrasterio_double_cmplx(hband, erwflag, ndsxoff, ndsyoff, pbuffer)
RESULT(err)
763TYPE(gdalrasterbandh),
VALUE :: hband
764INTEGER(kind=c_int),
INTENT(in) :: erwflag
765INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
766COMPLEX(kind=c_double_complex),
INTENT(inout) :: pbuffer(:,:)
767INTEGER(kind=c_int) :: err
769err = gdalrasterio_loc(hband, erwflag, ndsxoff, ndsyoff, &
770 SIZE(pbuffer,1),
SIZE(pbuffer,2), pbuffer)
772END FUNCTION gdalrasterio_double_cmplx
774FUNCTION gdalrasterio_double_cmplx_loc(hband, erwflag, ndsxoff, ndsyoff, ndsxsize, ndsysize, pbuffer)
RESULT(err)
775TYPE(gdalrasterbandh),
VALUE :: hband
776INTEGER(kind=c_int),
INTENT(in) :: erwflag
777INTEGER(kind=c_int),
INTENT(in) :: ndsxoff, ndsyoff
778INTEGER(kind=c_int),
INTENT(in) :: ndsxsize
779INTEGER(kind=c_int),
INTENT(in) :: ndsysize
780COMPLEX(kind=c_double_complex),
TARGET,
INTENT(inout) :: pbuffer(ndsxsize,ndsysize)
781INTEGER(kind=c_int) :: err
783err = gdalrasterio(hband, erwflag, ndsxoff, ndsyoff, &
784 ndsxsize, ndsysize, c_loc(pbuffer(1,1)), &
785 ndsxsize, ndsysize, gdt_cfloat64, 0, 0)
787END FUNCTION gdalrasterio_double_cmplx_loc
800SUBROUTINE gdaldatasetbbsize_f(hds, bbxmin, bbymin, bbxmax, bbymax, &
801 nx, ny, offsetx, offsety, xmin, ymin, xmax, ymax)
802TYPE(gdaldataseth),
VALUE :: hds
803REAL(kind=c_double),
INTENT(in) :: bbxmin
804REAL(kind=c_double),
INTENT(in) :: bbymin
805REAL(kind=c_double),
INTENT(in) :: bbxmax
806REAL(kind=c_double),
INTENT(in) :: bbymax
807INTEGER,
intent(out) :: nx
808INTEGER,
intent(out) :: ny
809INTEGER,
intent(out) :: offsetx
810INTEGER,
intent(out) :: offsety
811REAL(kind=c_double),
INTENT(out) :: xmin
812REAL(kind=c_double),
INTENT(out) :: ymin
813REAL(kind=c_double),
INTENT(out) :: xmax
814REAL(kind=c_double),
INTENT(out) :: ymax
818INTEGER(kind=c_int) :: ier
819REAL(kind=c_double) :: geotrans(6), invgeotrans(6), i1r, j1r, i2r, j2r, &
821REAL(kind=c_double),
PARAMETER :: epsy = 0.1
822INTEGER(kind=c_int) :: i1, j1, i2, j2
825ier = gdalgetgeotransform(hds, geotrans)
826IF (.NOT.(geotrans(3) == 0.0_c_double .AND. geotrans(5) == 0.0_c_double) .AND. &
827 .NOT.(geotrans(2) == 0.0_c_double .AND. geotrans(6) == 0.0_c_double))
THEN
834ier = gdalinvgeotransform(geotrans, invgeotrans)
835CALL gdalapplygeotransform(invgeotrans, bbxmin, bbymin, i1r, j1r)
836CALL gdalapplygeotransform(invgeotrans, bbxmax, bbymax, i2r, j2r)
839i1 = max(nint(min(i1r, i2r) - epsy), 0)
840j1 = max(nint(min(j1r, j2r) - epsy), 0)
841i2 = min(nint(max(i1r, i2r) + epsy), gdalgetrasterxsize(hds))
842j2 = min(nint(max(j1r, j2r) + epsy), gdalgetrasterysize(hds))
849CALL gdalapplygeotransform(geotrans, i1 + 0.5_c_double, j1 + 0.5_c_double, &
851CALL gdalapplygeotransform(geotrans, i2 - 0.5_c_double, j2 - 0.5_c_double, &
861END SUBROUTINE gdaldatasetbbsize_f
890SUBROUTINE gdaldatasetsimpleread_f(hds, bbxmin, bbymin, bbxmax, bbymax, pbuffer, &
891 xmin, ymin, xmax, ymax)
892TYPE(gdaldataseth),
VALUE :: hds
893REAL(kind=c_double),
INTENT(in) :: bbxmin
894REAL(kind=c_double),
INTENT(in) :: bbymin
895REAL(kind=c_double),
INTENT(in) :: bbxmax
896REAL(kind=c_double),
INTENT(in) :: bbymax
897REAL(kind=c_float),
ALLOCATABLE,
INTENT(out) :: pbuffer(:,:,:)
898REAL(kind=c_double),
INTENT(out) :: xmin
899REAL(kind=c_double),
INTENT(out) :: ymin
900REAL(kind=c_double),
INTENT(out) :: xmax
901REAL(kind=c_double),
INTENT(out) :: ymax
905INTEGER(kind=c_int) :: ier
906INTEGER(kind=c_int) :: nx, ny, offsetx, offsety
909CALL gdaldatasetbbsize_f(hds, bbxmin, bbymin, bbxmax, bbymax, &
910 nx, ny, offsetx, offsety, xmin, ymin, xmax, ymax)
911IF (nx < 0 .OR. ny < 0)
RETURN
913ALLOCATE(pbuffer(nx, ny, gdalgetrastercount(hds)))
914IF (nx == 0 .OR. ny == 0)
RETURN
924END SUBROUTINE gdaldatasetsimpleread_f
946SUBROUTINE gdalrastersimpleread_f(hband, bbxmin, bbymin, bbxmax, bbymax, pbuffer, &
947 xmin, ymin, xmax, ymax)
948TYPE(gdalrasterbandh),
VALUE :: hband
949REAL(kind=c_double),
INTENT(in) :: bbxmin
950REAL(kind=c_double),
INTENT(in) :: bbymin
951REAL(kind=c_double),
INTENT(in) :: bbxmax
952REAL(kind=c_double),
INTENT(in) :: bbymax
953REAL(kind=c_float),
ALLOCATABLE,
INTENT(out) :: pbuffer(:,:)
954REAL(kind=c_double),
INTENT(out) :: xmin
955REAL(kind=c_double),
INTENT(out) :: ymin
956REAL(kind=c_double),
INTENT(out) :: xmax
957REAL(kind=c_double),
INTENT(out) :: ymax
961INTEGER(kind=c_int) :: ier
962INTEGER(kind=c_int) :: nx, ny, offsetx, offsety
965CALL gdaldatasetbbsize_f(gdalgetbanddataset(hband), bbxmin, bbymin, bbxmax, bbymax, &
966 nx, ny, offsetx, offsety, xmin, ymin, xmax, ymax)
967IF (nx < 0 .OR. ny < 0)
RETURN
969ALLOCATE(pbuffer(nx, ny))
970IF (nx == 0 .OR. ny == 0)
RETURN
980END SUBROUTINE gdalrastersimpleread_f
983FUNCTION gdalmajorobject_fromdataset_new(gdalobject)
RESULT(majorobject)
984TYPE(gdaldataseth),
VALUE :: gdalobject
985TYPE(gdalmajorobjecth) :: majorobject
986majorobject%ptr = gdalobject%ptr
987END FUNCTION gdalmajorobject_fromdataset_new
989FUNCTION gdalmajorobject_fromrasterband_new(gdalobject)
RESULT(majorobject)
990TYPE(gdalrasterbandh),
VALUE :: gdalobject
991TYPE(gdalmajorobjecth) :: majorobject
992majorobject%ptr = gdalobject%ptr
993END FUNCTION gdalmajorobject_fromrasterband_new
995FUNCTION gdalmajorobject_fromdriver_new(gdalobject)
RESULT(majorobject)
996TYPE(gdaldriverh),
VALUE :: gdalobject
997TYPE(gdalmajorobjecth) :: majorobject
998majorobject%ptr = gdalobject%ptr
999END FUNCTION gdalmajorobject_fromdriver_new
Simplified Fortran generic interface to the gdaldatasetrasterio C function.
Fortran interface for formally converting a dataset, rasterband or driver opaque object into a generi...
Simplified Fortran generic interface to the gdalrasterio C function.
Fortran 2003 interface to the gdal http://www.gdal.org/ library.