rest_framework_dso.crs module

This expose common projections for Dutch GIS systems.

rest_framework_dso.crs.ALL_CRS = frozenset({CRS(domain='ogc', authority='EPSG', version='', crsid='4326', srid=4326, backend=None, origin=4326, has_custom_backend=False), CRS(domain='ogc', authority='EPSG', version='', crsid='4258', srid=4258, backend=None, origin='EPSG:4258', has_custom_backend=False), CRS(domain='ogc', authority='EPSG', version='', crsid='3857', srid=3857, backend=None, origin='EPSG:3857', has_custom_backend=False), CRS(domain='ogc', authority='EPSG', version='', crsid='28992', srid=28992, backend=None, origin='EPSG:28992', has_custom_backend=False)})

All coordinate reference systems exposed by this file.

class rest_framework_dso.crs.CRS(domain: str, authority: str, version: str, crsid: str, srid: int, backend: SpatialReference | None = None)

Represents a CRS (Coordinate Reference System), which preferably follows the URN format as specified by the OGC consortium.

__init__(domain: str, authority: str, version: str, crsid: str, srid: int, backend: SpatialReference | None = None) None
apply_to(geometry: GEOSGeometry, clone=False) GEOSGeometry | None

Transform the geometry using this coordinate reference.

This method caches the used CoordTransform object

Every transformation within this package happens through this method, giving full control over coordinate transformations.

authority: str

Either “OGC” or “EPSG”.

backend: SpatialReference | None = None

GDAL SpatialReference with PROJ.4 / WKT content to describe the exact transformation.

crsid: str

A string representation of the coordinate system reference ID. For OGC, only “CRS84” is supported as crsid. For EPSG, this is the formatted CRSID.

domain: str

Either “ogc” or “opengis”, whereas “ogc” is highly recommended.

classmethod from_srid(srid: int, backend=None)

Instantiate this class using an numeric spatial reference ID

This is logically identical to calling:

CRS.from_string("urn:ogc:def:crs:EPSG:6.9:<SRID>")
classmethod from_string(uri: str | int, backend: SpatialReference | None = None) CRS

Parse an CRS (Coordinate Reference System) URI, which preferably follows the URN format as specified by the OGC consortium and construct a new CRS instance.

The value can be 3 things:

  • A URI in OGC URN format.

  • A legacy CRS URI (“epsg:<SRID>”, or “http://www.opengis.net/…”).

  • A numeric SRID (which calls from_srid())

has_custom_backend: bool
property legacy

<srid>

Type

Return a legacy string in the format “EPSG

origin: str = None

Original input

srid: int

The integer representing the numeric spatial reference ID as used by the EPSG and GIS database backends.

property urn

Return The OGC URN corresponding to this CRS.

version: str

The version of the authorities’ SRS registry, which is empty or contains two or three numeric components separated by dots like “6.9” or “6.11.9”. For WFS 2.0 this is typically empty.

rest_framework_dso.crs.DEFAULT_CRS = CRS(domain='ogc', authority='EPSG', version='', crsid='28992', srid=28992, backend=None, origin='EPSG:28992', has_custom_backend=False)

The default suggested CRS (e.g for use in WFS)

rest_framework_dso.crs.OTHER_CRS = [CRS(domain='ogc', authority='EPSG', version='', crsid='4326', srid=4326, backend=None, origin=4326, has_custom_backend=False), CRS(domain='ogc', authority='EPSG', version='', crsid='3857', srid=3857, backend=None, origin='EPSG:3857', has_custom_backend=False), CRS(domain='ogc', authority='EPSG', version='', crsid='4258', srid=4258, backend=None, origin='EPSG:4258', has_custom_backend=False)]

Other suggested CRS’s (e.g for use in WFS)

rest_framework_dso.crs.RD_NEW = CRS(domain='ogc', authority='EPSG', version='', crsid='28992', srid=28992, backend=None, origin='EPSG:28992', has_custom_backend=False)

Amersfoort / RD New