+
    Tj                     \    ^ RI t ^ RIHt ^RIHtHtHtHtHtH	t	H
t
 R tR tR tR tR tR# )	    N)ValidationError)BANDTYPE_FLAG_HASNODATABANDTYPE_PIXTYPE_MASKGDAL_TO_POSTGISGDAL_TO_STRUCTPOSTGIS_HEADER_STRUCTUREPOSTGIS_TO_GDALSTRUCT_SIZEc                @    \         P                  ! RV ,           .VO5!  # )z6
Pack data into hex string with little endian format.
<)structpack	structuredatas   &&d/var/www/idalgo/venv/lib/python3.14/site-packages/django/contrib/gis/db/backends/postgis/pgraster.pyr   r      s     ;;sY...    c                d    \         P                  ! RV ,           \        P                  V4      4      # )z;
Unpack little endian hexlified binary string into a list.
r   )r   unpackbytesfromhexr   s   &&r   r   r      s"     ==y%--*=>>r   c                    V RV WR 3# )z3
Split a string into two parts at the input index.
N )r   indexs   &&r   chunkr      s     <f%%r   c                d   V f   R# \        V ^z4      w  r\        \        V4      p. p. pV '       d   \        V ^4      w  r@\        RV4      ^ ,          pV\        ,          p\        V,          p\
        V,          p^\        V,          ,          p\        W4      w  r\        Wh4      ^ ,          p\        WV^
,          ,          V^,          ,          4      w  rR\        P                  V	4      /p
V\        ,          '       d   WR&   VP                  V
4       VP                  V4       K  \        \        V4      4      ^8w  d   \        R4      hR\        V^	,          4      RV^
,          RV^,          R	V^ ,          R
V^,          V^,          3RV^,          V^,          3RV^,          V^,          3RV/# )z1
Convert a PostGIS HEX String into a dictionary.
NBr   nodata_valuez"Band pixeltypes are not all equal.sridwidthheightdatatypeoriginscaleskewbands)r   r   r   r   r	   r   r
   r   r   r   appendlensetr   int)r   headerr&   
pixeltypespixeltype_with_flags	pixeltype	pack_type	pack_sizenodatabandband_results   &          r   from_pgrasterr4   %   s    | s#LF,f5F EJ
%*4^"%c+?@C(+@@	 $I.	"9-	I..	
 T-	*1- 4VBZ!7&*!DE
u}}T23  "999*0' 	[! 	)$
 3z?q BCC 	F1I&*JqM6!9fQi(&)VAY'F1I&	 	r   c                   ^^ \        V P                  4      V P                  P                  V P                  P                  V P
                  P                  V P
                  P                  V P                  P                  V P                  P                  V P                  P                  V P                  V P                  3p\        \        V4      pV P                   F  pR\        VP                  4       ,          ,           p\        VP                  4       ,          pVP                   e   V\"        ,          p\        YEVP                   ;'       g    ^ 34      pW&VP%                  RR7      ,           ,          pK  	  V# )z2
Convert a GDALRaster into PostGIS Raster format.
r   T)as_memoryview)r(   r&   r$   xyr#   r%   srsr   r    r!   r   r   r   r"   r   r   r   r   )rastrasterheaderresultr2   r   r.   
bandheaders   &      r   to_pgrasterr>   d   s    	
	DJJ



				

L  *L9F

 .99	 $DMMO4	 (00I )1B1B1G1Ga%HI
 	tyyty<<<3 6 Mr   )r   django.core.exceptionsr   constr   r   r   r   r   r	   r
   r   r   r   r4   r>   r   r   r   <module>rA      s4     2  /?&<~4r   