Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
4fe6588d
Kaydet (Commit)
4fe6588d
authored
Eyl 19, 2017
tarafından
Niall Dalton
Kaydeden (comit)
Tim Graham
Eyl 21, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #28576 -- Added color interpretation method to GDALBand.
üst
52eb5b28
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
1 deletion
+55
-1
AUTHORS
AUTHORS
+1
-0
raster.py
django/contrib/gis/gdal/prototypes/raster.py
+1
-0
band.py
django/contrib/gis/gdal/raster/band.py
+10
-1
const.py
django/contrib/gis/gdal/raster/const.py
+21
-0
gdal.txt
docs/ref/contrib/gis/gdal.txt
+16
-0
2.0.txt
docs/releases/2.0.txt
+4
-0
test_raster.py
tests/gis_tests/gdal_tests/test_raster.py
+2
-0
No files found.
AUTHORS
Dosyayı görüntüle @
4fe6588d
...
...
@@ -591,6 +591,7 @@ answer newbie questions, and generally made Django that much better:
Nebojša Dorđević
Ned Batchelder <http://www.nedbatchelder.com/>
Nena Kojadin <nena@kiberpipa.org>
Niall Dalton <niall.dalton12@gmail.com>
Niall Kelly <duke.sam.vimes@gmail.com>
Nick Efford <nick@efford.org>
Nick Lane <nick.lane.au@gmail.com>
...
...
django/contrib/gis/gdal/prototypes/raster.py
Dosyayı görüntüle @
4fe6588d
...
...
@@ -75,6 +75,7 @@ get_band_index = int_output(std_call('GDALGetBandNumber'), [c_void_p])
get_band_description
=
const_string_output
(
std_call
(
'GDALGetDescription'
),
[
c_void_p
])
get_band_ds
=
voidptr_output
(
std_call
(
'GDALGetBandDataset'
),
[
c_void_p
])
get_band_datatype
=
int_output
(
std_call
(
'GDALGetRasterDataType'
),
[
c_void_p
])
get_band_color_interp
=
int_output
(
std_call
(
'GDALGetRasterColorInterpretation'
),
[
c_void_p
])
get_band_nodata_value
=
double_output
(
std_call
(
'GDALGetRasterNoDataValue'
),
[
c_void_p
,
POINTER
(
c_int
)])
set_band_nodata_value
=
void_output
(
std_call
(
'GDALSetRasterNoDataValue'
),
[
c_void_p
,
c_double
])
if
GDAL_VERSION
>=
(
2
,
1
):
...
...
django/contrib/gis/gdal/raster/band.py
Dosyayı görüntüle @
4fe6588d
...
...
@@ -6,7 +6,9 @@ from django.contrib.gis.gdal.raster.base import GDALRasterBase
from
django.contrib.gis.shortcuts
import
numpy
from
django.utils.encoding
import
force_text
from
.const
import
GDAL_INTEGER_TYPES
,
GDAL_PIXEL_TYPES
,
GDAL_TO_CTYPES
from
.const
import
(
GDAL_COLOR_TYPES
,
GDAL_INTEGER_TYPES
,
GDAL_PIXEL_TYPES
,
GDAL_TO_CTYPES
,
)
class
GDALBand
(
GDALRasterBase
):
...
...
@@ -168,6 +170,13 @@ class GDALBand(GDALRasterBase):
dtype
=
GDAL_PIXEL_TYPES
[
dtype
]
return
dtype
def
color_interp
(
self
,
as_string
=
False
):
"""Return the GDAL color interpretation for this band."""
color
=
capi
.
get_band_color_interp
(
self
.
_ptr
)
if
as_string
:
color
=
GDAL_COLOR_TYPES
[
color
]
return
color
def
data
(
self
,
data
=
None
,
offset
=
None
,
size
=
None
,
shape
=
None
,
as_memoryview
=
False
):
"""
Read or writes pixel values for this band. Blocks of data can
...
...
django/contrib/gis/gdal/raster/const.py
Dosyayı görüntüle @
4fe6588d
...
...
@@ -44,6 +44,27 @@ GDAL_RESAMPLE_ALGORITHMS = {
'Mode'
:
6
,
}
# See http://www.gdal.org/gdal_8h.html#ace76452d94514561fffa8ea1d2a5968c
GDAL_COLOR_TYPES
=
{
0
:
'GCI_Undefined'
,
# Undefined, default value, i.e. not known
1
:
'GCI_GrayIndex'
,
# Greyscale
2
:
'GCI_PaletteIndex'
,
# Paletted
3
:
'GCI_RedBand'
,
# Red band of RGBA image
4
:
'GCI_GreenBand'
,
# Green band of RGBA image
5
:
'GCI_BlueBand'
,
# Blue band of RGBA image
6
:
'GCI_AlphaBand'
,
# Alpha (0=transparent, 255=opaque)
7
:
'GCI_HueBand'
,
# Hue band of HLS image
8
:
'GCI_SaturationBand'
,
# Saturation band of HLS image
9
:
'GCI_LightnessBand'
,
# Lightness band of HLS image
10
:
'GCI_CyanBand'
,
# Cyan band of CMYK image
11
:
'GCI_MagentaBand'
,
# Magenta band of CMYK image
12
:
'GCI_YellowBand'
,
# Yellow band of CMYK image
13
:
'GCI_BlackBand'
,
# Black band of CMLY image
14
:
'GCI_YCbCr_YBand'
,
# Y Luminance
15
:
'GCI_YCbCr_CbBand'
,
# Cb Chroma
16
:
'GCI_YCbCr_CrBand'
,
# Cr Chroma, also GCI_Max
}
# Fixed base path for buffer-based GDAL in-memory files.
VSI_FILESYSTEM_BASE_PATH
=
'/vsimem/'
...
...
docs/ref/contrib/gis/gdal.txt
Dosyayı görüntüle @
4fe6588d
...
...
@@ -1551,6 +1551,22 @@ blue.
``GDT_UInt32``, ``GDT_Int32``, ``GDT_Float32``, ``GDT_Float64``,
``GDT_CInt16``, ``GDT_CInt32``, ``GDT_CFloat32``, and ``GDT_CFloat64``.
.. method:: color_interp(as_string=False)
.. versionadded:: 2.0
The color interpretation for the band, as an integer between 0and 16.
If ``as_string`` is ``True``, the data type is returned as a string
with the following possible values:
``GCI_Undefined``, ``GCI_GrayIndex``, ``GCI_PaletteIndex``,
``GCI_RedBand``, ``GCI_GreenBand``, ``GCI_BlueBand``, ``GCI_AlphaBand``,
``GCI_HueBand``, ``GCI_SaturationBand``, ``GCI_LightnessBand``,
``GCI_CyanBand``, ``GCI_MagentaBand``, ``GCI_YellowBand``,
``GCI_BlackBand``, ``GCI_YCbCr_YBand``, ``GCI_YCbCr_CbBand``, and
``GCI_YCbCr_CrBand``. ``GCI_YCbCr_CrBand`` also represents ``GCI_Max``
because both correspond to the integer 16, but only ``GCI_YCbCr_CrBand``
is returned as a string.
.. method:: data(data=None, offset=None, size=None, shape=None)
The accessor to the pixel values of the ``GDALBand``. Returns the complete
...
...
docs/releases/2.0.txt
Dosyayı görüntüle @
4fe6588d
...
...
@@ -144,6 +144,10 @@ Minor features
GDAL's internal virtual filesystem. Rasters can now be :ref:`created from and
converted to binary data <gdal-raster-vsimem>` in-memory.
* The new :meth:`GDALBand.color_interp()
<django.contrib.gis.gdal.GDALBand.color_interp>` method returns the color
interpretation for the band.
:mod:`django.contrib.messages`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
tests/gis_tests/gdal_tests/test_raster.py
Dosyayı görüntüle @
4fe6588d
...
...
@@ -562,6 +562,8 @@ class GDALBandTests(SimpleTestCase):
self
.
assertEqual
(
self
.
band
.
description
,
''
)
self
.
assertEqual
(
self
.
band
.
datatype
(),
1
)
self
.
assertEqual
(
self
.
band
.
datatype
(
as_string
=
True
),
'GDT_Byte'
)
self
.
assertEqual
(
self
.
band
.
color_interp
(),
1
)
self
.
assertEqual
(
self
.
band
.
color_interp
(
as_string
=
True
),
'GCI_GrayIndex'
)
self
.
assertEqual
(
self
.
band
.
nodata_value
,
15
)
if
numpy
:
data
=
self
.
band
.
data
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment