
    /i                     "    d Z ddlZddlmZ d Zy)zCRS helpers.    N)CRSc                    | j                   t        d      | j                   j                         dk7  r| j                  d      n| }|j                  \  }}}}||z   dz  }||z   dz  }t        t        j                  |dz   dz        dz         }t        dt        |d            }|d	k\  }	|	rd
|z   nd|z   }
t        j                  |
      S )a  
    Determine an appropriate WGS84 UTM CRS for the given geometry.

    Uses the centroid of the geometry's bounding box in EPSG:4326 to choose
    a UTM zone, returning the corresponding CRS (EPSG:326xx for the northern
    hemisphere and EPSG:327xx for the southern hemisphere).
    z.Geometry lacks CRS; cannot determine UTM zone.i  )epsgg       @         <   r   iX  i  )crs
ValueErrorto_epsgto_crstotal_boundsintmathfloormaxminr   	from_epsg)geometrywgs84minxminymaxxmaxy
center_lon
center_latzonenorth	epsg_codes              scripts/crs_utils.pydetermine_utm_crsr!   	   s     ||IJJ*2,,*>*>*@D*HHOOO&hE"//D$d+$J+$Jtzz:+q01A56Dq#dB- D!OE %54<I==##    )__doc__r   pyprojr   r!    r"   r    <module>r&      s      $r"   