Exemplo n.º 1
0
    def from_wkt(cls, wkt, morph_from_esri_dialect=False):
        """Make a CRS from a WKT string

        Parameters
        ----------
        wkt : str
            A WKT string.
        morph_from_esri_dialect : bool, optional
            If True, items in the input using Esri's dialect of WKT
            will be replaced by OGC standard equivalents.

        Returns
        -------
        CRS

        """
        obj = cls()
        obj._crs = _CRS.from_wkt(wkt, morph_from_esri_dialect=morph_from_esri_dialect)
        return obj
Exemplo n.º 2
0
    def from_wkt(cls, wkt, morph_from_esri_dialect=False):
        """Make a CRS from a WKT string

        Parameters
        ----------
        wkt : str
            A WKT string.
        morph_from_esri_dialect : bool, optional
            If True, items in the input using Esri's dialect of WKT
            will be replaced by OGC standard equivalents.

        Returns
        -------
        CRS

        """
        obj = cls()
        obj._crs = _CRS.from_wkt(wkt, morph_from_esri_dialect=morph_from_esri_dialect)
        return obj
Exemplo n.º 3
0
 def __setstate__(self, state):
     self._wkt = None
     self._data = None
     self._crs = _CRS.from_wkt(state)
Exemplo n.º 4
0
def test_esri_wkt_to_epsg(proj_string):
    """CRS has no EPSG code"""
    assert _CRS.from_wkt(proj_string, morph_from_esri_dialect=True).to_epsg() is None
Exemplo n.º 5
0
def test_compound_crs():
    """Parse compound WKT"""
    wkt = """COMPD_CS["unknown",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],VERT_CS["unknown",VERT_DATUM["unknown",2005],UNIT["metre",1.0,AUTHORITY["EPSG","9001"]],AXIS["Up",UP]]]"""
    assert _CRS.from_wkt(wkt).to_wkt().startswith('COMPD_CS')
Exemplo n.º 6
0
def test_from_esri_wkt_fix_datum(projection_string):
    """Test ESRI CRS morphing with datum fixing"""
    with Env(GDAL_FIX_ESRI_WKT='DATUM'):
        crs = _CRS.from_wkt(projection_string, morph_from_esri_dialect=True)
        assert 'DATUM["North_American_Datum_1983"' in crs.to_wkt()
Exemplo n.º 7
0
def test_from_esri_wkt_no_fix(projection_string):
    """Test ESRI CRS morphing with no datum fixing"""
    with Env():
        crs = _CRS.from_wkt(projection_string)
        assert 'DATUM["D_North_American_1983"' in crs.to_wkt()
Exemplo n.º 8
0
def test_from_wkt_invalid():
    """Raise exception if input WKT is invalid"""
    with pytest.raises(CRSError):
        _CRS.from_wkt('bogus')
Exemplo n.º 9
0
 def __setstate__(self, state):
     self._wkt = None
     self._data = None
     self._crs = _CRS.from_wkt(state)
Exemplo n.º 10
0
def test_compound_crs():
    """Parse compound WKT"""
    wkt = """COMPD_CS["unknown",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],VERT_CS["unknown",VERT_DATUM["unknown",2005],UNIT["metre",1.0,AUTHORITY["EPSG","9001"]],AXIS["Up",UP]]]"""
    assert _CRS.from_wkt(wkt).to_wkt().startswith('COMPD_CS')
Exemplo n.º 11
0
def test_from_esri_wkt_fix_datum(projection_string):
    """Test ESRI CRS morphing with datum fixing"""
    with Env(GDAL_FIX_ESRI_WKT='DATUM'):
        crs = _CRS.from_wkt(projection_string, morph_from_esri_dialect=True)
        assert 'DATUM["North_American_Datum_1983"' in crs.to_wkt()
Exemplo n.º 12
0
def test_from_esri_wkt_no_fix(projection_string):
    """Test ESRI CRS morphing with no datum fixing"""
    with Env():
        crs = _CRS.from_wkt(projection_string)
        assert 'DATUM["D_North_American_1983"' in crs.to_wkt()
Exemplo n.º 13
0
def test_from_wkt_invalid():
    """Raise exception if input WKT is invalid"""
    with pytest.raises(CRSError):
        _CRS.from_wkt('bogus')
Exemplo n.º 14
0
def test_esri_wkt_to_epsg(proj_string):
    """CRS has no EPSG code"""
    assert _CRS.from_wkt(proj_string,
                         morph_from_esri_dialect=True).to_epsg() is None