GeoData

The GEODATA entity is associated to the Modelspace object. The GEODATA entity is supported since the DXF version R2000, but was officially documented the first time in the DXF reference for version R2009.

Subclass of

ezdxf.entities.DXFObject

DXF type

'GEODATA'

Factory function

ezdxf.layouts.Modelspace.new_geodata()

Required DXF version

R2010 ('AC1024')

Warning

Do not instantiate object classes by yourself - always use the provided factory functions!

class ezdxf.entities.GeoData
dxf.version

1

R2009

2

R2010

dxf.coordinate_type

0

unknown

1

local grid

2

projected grid

3

geographic (latitude/longitude)

dxf.block_record_handle

Handle of host BLOCK_RECORD table entry, in general the Modelspace.

dxf.design_point

Reference point in WCS coordinates.

dxf.reference_point

Reference point in geo coordinates, valid only when coordinate type is local grid. The difference between dxf.design_point and dxf.reference_point defines the translation from WCS coordinates to geo-coordinates.

dxf.north_direction

North direction as 2D vector. Defines the rotation (about the dxf.design_point) to transform from WCS coordinates to geo-coordinates

dxf.horizontal_unit_scale

Horizontal unit scale, factor which converts horizontal design coordinates to meters by multiplication.

dxf.vertical_unit_scale

Vertical unit scale, factor which converts vertical design coordinates to meters by multiplication.

dxf.horizontal_units

Horizontal units (see BlockRecord). Will be 0 (Unitless) if units specified by horizontal unit scale is not supported by AutoCAD enumeration.

dxf.vertical_units

Vertical units (see BlockRecord). Will be 0 (Unitless) if units specified by vertical unit scale is not supported by AutoCAD enumeration.

dxf.up_direction

Up direction as 3D vector.

dxf.scale_estimation_method

1

none

2

user specified scale factor

3

grid scale at reference point

4

prismoidal

dxf.sea_level_correction

Bool flag specifying whether to do sea level correction.

dxf.user_scale_factor
dxf.sea_level_elevation
dxf.coordinate_projection_radius
dxf.geo_rss_tag
dxf.observation_from_tag
dxf.observation_to_tag
dxf.mesh_faces_count
source_vertices

2D source vertices in the CRS of the GeoData as VertexArray. Used together with target_vertices to define the transformation from the CRS of the GeoData to WGS84.

target_vertices

2D target vertices in WGS84 (EPSG:4326) as VertexArray. Used together with source_vertices to define the transformation from the CRS of the geoData to WGS84.

faces

List of face definition tuples, each face entry is a 3-tuple of vertex indices (0-based).

coordinate_system_definition

The coordinate system definition string. Stored as XML. Defines the CRS used by the GeoData. The EPSG number and other details like the axis-ordering of the CRS is stored.

get_crs() tuple[int, bool]

Returns the EPSG index and axis-ordering, axis-ordering is True if fist axis is labeled “E” or “W” and False if first axis is labeled “N” or “S”.

If axis-ordering is False the CRS is not compatible with the __geo_interface__ or GeoJSON (see chapter 3.1.1).

Raises:

InvalidGeoDataException – for invalid or unknown XML data

The EPSG number is stored in a tag like:

<Alias id="27700" type="CoordinateSystem">
  <ObjectId>OSGB1936.NationalGrid</ObjectId>
  <Namespace>EPSG Code</Namespace>
</Alias>

The axis-ordering is stored in a tag like:

<Axis uom="METER">
  <CoordinateSystemAxis>
    <AxisOrder>1</AxisOrder>
    <AxisName>Easting</AxisName>
    <AxisAbbreviation>E</AxisAbbreviation>
    <AxisDirection>east</AxisDirection>
  </CoordinateSystemAxis>
  <CoordinateSystemAxis>
    <AxisOrder>2</AxisOrder>
    <AxisName>Northing</AxisName>
    <AxisAbbreviation>N</AxisAbbreviation>
    <AxisDirection>north</AxisDirection>
  </CoordinateSystemAxis>
</Axis>
get_crs_transformation(*, no_checks: bool = False) tuple[Matrix44, int]

Returns the transformation matrix and the EPSG index to transform WCS coordinates into CRS coordinates. Because of the lack of proper documentation this method works only for tested configurations, set argument no_checks to True to use the method for untested geodata configurations, but the results may be incorrect.

Supports only “Local Grid” transformation!

Raises:

InvalidGeoDataException – for untested geodata configurations

setup_local_grid(*, design_point: UVec, reference_point: UVec, north_direction: UVec = (0, 1), crs: str = EPSG_3395)

Setup local grid coordinate system. This method is designed to setup CRS similar to EPSG:3395 World Mercator, the basic features of the CRS should fulfill these assumptions:

  • base unit of reference coordinates is 1 meter

  • right-handed coordinate system: +Y=north/+X=east/+Z=up

The CRS string is not validated nor interpreted!

Hint

The reference point must be a 2D cartesian map coordinate and not a globe (lon/lat) coordinate like stored in GeoJSON or GPS data.

Parameters:
  • design_point – WCS coordinates of the CRS reference point

  • reference_point – CRS reference point in 2D cartesian coordinates

  • north_direction – north direction a 2D vertex, default is (0, 1)

  • crs – Coordinate Reference System definition XML string, default is the definition string for EPSG:3395 World Mercator