gws.gis.render

Map render utilities.

Source code: gws.gis.render

Package Contents

gws.gis.render.map_view_from_bbox(size: gws.UomSize, bbox: gws.Extent, crs: gws.Crs, dpi: int, rotation: float = 0) gws.MapView

Creates a map view based on a bounding box.

Parameters:
  • size – The map size in units.

  • bbox – The bounding box of the map.

  • crs – The coordinate reference system.

  • dpi – The resolution in dots per inch.

  • rotation – The map rotation angle in degrees.

Returns:

A configured MapView instance.

gws.gis.render.map_view_from_center(size: gws.UomSize, center: gws.Point, crs: gws.Crs, dpi: int, scale: float, rotation: float = 0) gws.MapView

Creates a map view based on a center point.

Parameters:
  • size – The map size in units.

  • center – The center point of the map.

  • crs – The coordinate reference system.

  • dpi – The resolution in dots per inch.

  • scale – The map scale.

  • rotation – The map rotation angle in degrees.

Returns:

A configured MapView instance.

gws.gis.render.map_view_transformer(view: gws.MapView)

Creates a pixel transformer f(map_x, map_y) -> (pixel_x, pixel_y) for a view

Parameters:

view – The map view instance.

Returns:

A function that transforms map coordinates (x, y) into pixel coordinates.

gws.gis.render.MAX_DPI = 1200
gws.gis.render.MIN_DPI
gws.gis.render.output_to_html_element(mro: gws.MapRenderOutput, wrap='relative') gws.XmlElement

Converts a MapRenderOutput to an HTML element.

Parameters:
  • mro – The MapRenderOutput object to convert.

  • wrap – The CSS position value for the wrapper div. Must be one of ‘relative’, ‘absolute’, ‘fixed’, or None. Default is ‘relative’.

Returns:

A gws.XmlElement representing a div containing the map output.

gws.gis.render.output_to_html_string(mro: gws.MapRenderOutput, wrap='relative') str

Converts a MapRenderOutput to an HTML string.

Parameters:
  • mro – The MapRenderOutput object to convert.

  • wrap – The CSS position value for the wrapper div. Must be one of ‘relative’, ‘absolute’, ‘fixed’, or None. Default is ‘relative’.

Returns:

A string containing the HTML representation of the map output.

gws.gis.render.render_map(mri: gws.MapRenderInput) gws.MapRenderOutput

Renders a map based on input parameters.

Parameters:

mri – The map render input configuration.

Returns:

A MapRenderOutput instance containing rendered data.