a
     1$e  ã                   @   s`   d Z ddlmZ dd„ Zdd„ Zdd„ Zd	Zed
d„ e d¡ƒZ	e
edd„ e	D ƒƒƒdg ZdS )aU  Coordinate reference systems and functions

PROJ is the law of this land: https://proj.org/. But whereas PROJ
coordinate reference systems are described by strings of parameters such as

    +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs

here we use mappings:

    {'proj': 'longlat', 'ellps': 'WGS84', 'datum': 'WGS84', 'no_defs': True}
é    )Ústring_typesc                 C   sV   g }t tdd„ |  ¡ ƒƒD ]0\}}| dd tttdd„ ||fƒƒ¡ ¡ qd |¡S )a5  Turn a parameter mapping into a more conventional PROJ.4 string.

    Mapping keys are tested against the ``all_proj_keys`` list. Values of
    ``True`` are omitted, leaving the key bare: {'no_defs': True} -> "+no_defs"
    and items where the value is otherwise not a str, int, or float are
    omitted.
    c                 S   s:   | d t v o8| d duo8t| d tttfƒp8t| d tƒS )Nr   é   F)Úall_proj_keysÚ
isinstanceÚboolÚintÚfloatr   ©Úx© r   úE/var/www/html/django/DPS/env/lib/python3.9/site-packages/fiona/crs.pyÚ<lambda>   s   zto_string.<locals>.<lambda>ú+ú=c                 S   s   | s| dko| duS )Nr   Tr   )Úyr   r   r   r   !   ó    ú )ÚsortedÚfilterÚitemsÚappendÚjoinÚmapÚstr)Zcrsr   ÚkÚvr   r   r   Ú	to_string   s    üÿÿÿr   c                    sL   dd„ |   ¡  ¡ D ƒ}dd„ ‰ t‡ fdd„dd„ |D ƒƒ}td	d„ |D ƒƒS )
z¸Turn a PROJ.4 string into a mapping of parameters.

    Bare parameters like "+no_defs" are given a value of ``True``. All keys
    are checked against the ``all_proj_keys`` list.
    c                 S   s   g | ]}|  d ¡‘qS )r   )Úlstrip)Ú.0Úor   r   r   Ú
<listcomp>+   r   zfrom_string.<locals>.<listcomp>c                 S   sD   z
t | ƒW S  ty   Y n0 z
t| ƒW S  ty>   |  Y S 0 d S ©N)r   Ú
ValueErrorr   )r   r   r   r   Úparse-   s    

zfrom_string.<locals>.parsec                    s,   t | ƒdkr | d ˆ | d ƒfp*| d dfS )Né   r   r   T©Úlen)Úkv©r#   r   r   r   7   r   zfrom_string.<locals>.<lambda>c                 s   s   | ]}|  d ¡V  qdS )r   N)Úsplit)r   Úpr   r   r   Ú	<genexpr>8   r   zfrom_string.<locals>.<genexpr>c                 s   s"   | ]\}}|t v r||fV  qd S r!   )r   )r   r   r   r   r   r   r+   9   r   )Ústripr)   r   Údict)ZprjsÚpartsr   r   r(   r   Úfrom_string%   s    	
þr/   c                 C   s"   t | ƒdkrtdƒ‚d|  ddœS )z~Given an integer code, returns an EPSG-like mapping.

    Note: the input code is not validated against an EPSG database.
    r   z EPSG codes are positive integerszepsg:%sT)ÚinitZno_defs)r   r"   )Úcoder   r   r   Ú	from_epsg<   s    r2   ar  
+a         Semimajor radius of the ellipsoid axis
+alpha     ? Used with Oblique Mercator and possibly a few others
+axis      Axis orientation (new in 4.8.0)
+b         Semiminor radius of the ellipsoid axis
+datum     Datum name (see `proj -ld`)
+ellps     Ellipsoid name (see `proj -le`)
+init      Initialize from a named CRS
+k         Scaling factor (old name)
+k_0       Scaling factor (new name)
+lat_0     Latitude of origin
+lat_1     Latitude of first standard parallel
+lat_2     Latitude of second standard parallel
+lat_ts    Latitude of true scale
+lon_0     Central meridian
+lonc      ? Longitude used with Oblique Mercator and possibly a few others
+lon_wrap  Center longitude to use for wrapping (see below)
+nadgrids  Filename of NTv2 grid file to use for datum transforms (see below)
+no_defs   Don't use the /usr/share/proj/proj_def.dat defaults file
+over      Allow longitude output outside -180 to 180 range, disables wrapping (see below)
+pm        Alternate prime meridian (typically a city name, see below)
+proj      Projection name (see `proj -l`)
+south     Denotes southern hemisphere UTM zone
+to_meter  Multiplier to convert map units to 1.0m
+towgs84   3 or 7 term datum transform parameters (see below)
+units     meters, US survey feet, etc.
+vto_meter vertical conversion to meters.
+vunits    vertical units.
+x_0       False easting
+y_0       False northing
+zone      UTM zone
+a         Semimajor radius of the ellipsoid axis
+alpha     ? Used with Oblique Mercator and possibly a few others
+azi
+b         Semiminor radius of the ellipsoid axis
+belgium
+beta
+czech
+e         Eccentricity of the ellipsoid = sqrt(1 - b^2/a^2) = sqrt( f*(2-f) )
+ellps     Ellipsoid name (see `proj -le`)
+es        Eccentricity of the ellipsoid squared
+f         Flattening of the ellipsoid (often presented as an inverse, e.g. 1/298)
+gamma
+geoc
+guam
+h
+k         Scaling factor (old name)
+K
+k_0       Scaling factor (new name)
+lat_0     Latitude of origin
+lat_1     Latitude of first standard parallel
+lat_2     Latitude of second standard parallel
+lat_b
+lat_t
+lat_ts    Latitude of true scale
+lon_0     Central meridian
+lon_1
+lon_2
+lonc      ? Longitude used with Oblique Mercator and possibly a few others
+lsat
+m
+M
+n
+no_cut
+no_off
+no_rot
+ns
+o_alpha
+o_lat_1
+o_lat_2
+o_lat_c
+o_lat_p
+o_lon_1
+o_lon_2
+o_lon_c
+o_lon_p
+o_proj
+over
+p
+path
+proj      Projection name (see `proj -l`)
+q
+R
+R_a
+R_A       Compute radius such that the area of the sphere is the same as the area of the ellipsoid
+rf        Reciprocal of the ellipsoid flattening term (e.g. 298)
+R_g
+R_h
+R_lat_a
+R_lat_g
+rot
+R_V
+s
+south     Denotes southern hemisphere UTM zone
+sym
+t
+theta
+tilt
+to_meter  Multiplier to convert map units to 1.0m
+units     meters, US survey feet, etc.
+vopt
+W
+westo
+x_0       False easting
+y_0       False northing
+zone      UTM zone
+wktext    Marker
c                 C   s   t | ƒdkS )Nr   r%   r	   r   r   r   r   ·   r   r   Ú
c                 c   s$   | ]}|  ¡ d   d¡ ¡ V  qdS )r   r   N)r)   r   r,   )r   Úliner   r   r   r+   ¹   r   r+   Zno_mayoN)Ú__doc__Úsixr   r   r/   r2   Z_param_datar   r)   Ú_linesÚlistÚsetr   r   r   r   r   Ú<module>   s   mÿÿ