コード例 #1
0
    def test_crs84_inequal(self):
        """Prove that using strings from other vendors is also parsed."""
        crs84 = CRS.from_string("urn:ogc:def:crs:OGC:1.3:CRS84")
        assert crs84.srid == WGS84.srid

        # EPSG:4326 specifies coordinates in lat/long order and CRS:84 in long/lat order
        assert crs84 != WGS84
コード例 #2
0
 def crs(self) -> CRS:
     """Tell which projection the data should be presented at."""
     if self._crs is None:
         # Default CRS
         return CRS.from_srid(self.geometry_field.srid)  # checks lookup too
     else:
         return self._crs
コード例 #3
0
    def from_xml(cls, element: Element):
        """Push the whole <gml:...> element into the GEOS parser.
        This avoids having to support the whole GEOS logic.

        GML is a complex beast with many different forms for the same thing:
        http://erouault.blogspot.com/2014/04/gml-madness.html
        """
        srs = CRS.from_string(get_attribute(element, "srsName"))

        # Push the whole <gml:...> element into the GEOS parser.
        # This avoids having to support the whole GEOS logic.
        geos_data = GEOSGeometry.from_gml(tostring(element))
        geos_data.srid = srs.srid
        return cls(srs=srs, geos_data=geos_data)
コード例 #4
0
from gisserver.geometries import CRS

WFS_NS = "http://www.opengis.net/wfs/2.0"
OWS_NS = "http://www.opengis.net/ows/1.1"
XLINK_NS = "http://www.w3.org/1999/xlink"
NAMESPACES = {
    "app": "http://example.org/gisserver",
    "gml": "http://www.opengis.net/gml/3.2",
    "ows": "http://www.opengis.net/ows/1.1",
    "wfs": "http://www.opengis.net/wfs/2.0",
    "xsd": "http://www.w3.org/2001/XMLSchema",
}

RD_NEW_SRID = 28992  # https://epsg.io/28992

RD_NEW = CRS.from_string("urn:ogc:def:crs:EPSG::28992")
コード例 #5
0
"""Expose common projections for Dutch GIS systems

NOTE: the CRS class should be imported when publishing this as a separate library.
"""
from gisserver.geometries import CRS, WGS84

__all__ = [
    "CRS",
    "WGS84",
    "RD_NEW",
    "WEB_MERCATOR",
    "ETRS89",
    "DEFAULT_CRS",
    "OTHER_CRS",
    "ALL_CRS",
]

# Common projections for Dutch GIS systems:
RD_NEW = CRS.from_string("EPSG:28992")  # Amersfoort / RD New
WEB_MERCATOR = CRS.from_string(
    "EPSG:3857")  # Spherical Mercator (Google Maps, ...)
ETRS89 = CRS.from_string(
    "EPSG:4258")  # European Terrestrial Reference System 1989

DEFAULT_CRS = RD_NEW
OTHER_CRS = [WGS84, WEB_MERCATOR, ETRS89]
ALL_CRS = set([DEFAULT_CRS] + OTHER_CRS)
コード例 #6
0
# These values come from postgis 2.5.3 on homebrew
RD_NEW_PROJ = (
    "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 "
    "+k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel "
    "+towgs84=565.2369,50.0087,465.658,-0.406857,0.350733,-1.87035,4.0812 "
    "+units=m +no_defs")
RD_NEW_WKT = (
    'PROJCS["Amersfoort / RD New",'
    'GEOGCS["Amersfoort",'
    'DATUM["Amersfoort",SPHEROID["Bessel 1841",6377397.155,299.1528128,AUTHORITY["EPSG","7004"]],'
    'TOWGS84[565.417,50.3319,465.552,-0.398957,0.343988,-1.8774,4.0725],AUTHORITY["EPSG","6289"]],'
    'PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],'
    'UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],'
    'AUTHORITY["EPSG","4289"]],'
    'PROJECTION["Oblique_Stereographic"],'
    'PARAMETER["latitude_of_origin",52.15616055555555],'
    'PARAMETER["central_meridian",5.38763888888889],'
    'PARAMETER["scale_factor",0.9999079],'
    'PARAMETER["false_easting",155000],'
    'PARAMETER["false_northing",463000],'
    'UNIT["metre",1,AUTHORITY["EPSG","9001"]],'
    'AXIS["X",EAST],'
    'AXIS["Y",NORTH],'
    'AUTHORITY["EPSG","28992"]]')

RD_NEW = CRS.from_string(
    "urn:ogc:def:crs:EPSG::28992",
    backend=SpatialReference(RD_NEW_PROJ),
)
コード例 #7
0
 def test_from_string(self):
     assert CRS.from_string(4326).urn == "urn:ogc:def:crs:EPSG::4326"
     assert CRS.from_string("EPSG:4326").urn == "urn:ogc:def:crs:EPSG::4326"
コード例 #8
0
 def test_crs_url(self):
     assert (CRS.from_string("http://www.opengis.net/def/crs/epsg/0/4326").
             urn == "urn:ogc:def:crs:EPSG::4326")
コード例 #9
0
 def test_crs_empty_version(self):
     """Prove that empty versions are properly re-encoded as empty string"""
     assert (CRS.from_string("urn:ogc:def:crs:EPSG::28992").urn ==
             "urn:ogc:def:crs:EPSG::28992")
コード例 #10
0
ファイル: crs.py プロジェクト: Amsterdam/dso-api
__all__ = [
    "CRS",
    "WGS84",
    "RD_NEW",
    "WEB_MERCATOR",
    "ETRS89",
    "DEFAULT_CRS",
    "OTHER_CRS",
    "ALL_CRS",
]

# Common projections for Dutch GIS systems:

#: Amersfoort / RD New
RD_NEW = CRS.from_string("EPSG:28992")

#: Spherical Mercator (Google Maps, ...)
WEB_MERCATOR = CRS.from_string("EPSG:3857")

#: European Terrestrial Reference System 1989
ETRS89 = CRS.from_string("EPSG:4258")

#: The default suggested CRS (e.g for use in WFS)
DEFAULT_CRS = RD_NEW

#: Other suggested CRS's (e.g for use in WFS)
OTHER_CRS = [WGS84, WEB_MERCATOR, ETRS89]

#: All coordinate reference systems exposed by this file.
ALL_CRS = set([DEFAULT_CRS] + OTHER_CRS)