original_docstring: 
      writes a geometry to a vector file.
  
      parameters
      ----------
      geom : OGRGeometry
          geometry object
      fname : str
          full path of the output file name
      format : str
          optional; format name. currently only shapefile is supported
      segment : float
          for precision: distance of longest segment of the geometry polygon
          in units of input osr_spref
      
docstring: writes a geometry to a vector file.
  parameters
  
  geom : OGRGeometry
  geometry object
  fname : str
  full path of the output file name
  format : str
  optional; format name. currently only shapefile is supported
  segment : float
  for precision: distance of longest segment of the geometry polygon
  in units of input osr_spref
docstring_tokens: writes a geometry to a vector file . parameters geom : OGRGeometry geometry object fname : str full path of the output file name format : str optional ; format name . currently only shapefile is supported segment : float for precision : distance of longest segment of the geometry polygon in units of input osr_spref
code: def write_geometry(geom, fname, format="shapefile", segment=None):
      """
      writes a geometry to a vector file.
  
      parameters
      ----------
      geom : OGRGeometry
          geometry object
      fname : str
          full path of the output file name
      format : str
          optional; format name. currently only shapefile is supported
      segment : float
          for precision: distance of longest segment of the geometry polygon
          in units of input osr_spref
      """
  
      if format == 'shapefile':
          drivername = "ESRI Shapefile"
  
      drv = ogr.GetDriverByName("ESRI Shapefile")
      dst_ds = drv.CreateDataSource(fname)
      srs = geom.GetSpatialReference()
  
      dst_layer = dst_ds.CreateLayer("out", srs=srs)
      fd = ogr.FieldDefn('DN', ogr.OFTInteger)
      dst_layer.CreateField(fd)
  
      feature = ogr.Feature(dst_layer.GetLayerDefn())
      feature.SetField("DN", 1)
  
      # modify the geometry such it has no segment longer then the given distance
      if segment is not None:
          geom = segmentize_geometry(geom, segment=segment)
  
      feature.SetGeometry(geom)
      dst_layer.CreateFeature(feature)
  
      dst_ds, feature, geom = None, None, None
      return
code_tokens: def write_geometry ( geom , fname , format = "shapefile" , segment = None ) : if format == 'shapefile' : drivername = "ESRI Shapefile" drv = ogr . GetDriverByName ( "ESRI Shapefile" ) dst_ds = drv . CreateDataSource ( fname ) srs = geom . GetSpatialReference ( ) dst_layer = dst_ds . CreateLayer ( "out" , srs = srs ) fd = ogr . FieldDefn ( 'DN' , ogr . OFTInteger ) dst_layer . CreateField ( fd ) feature = ogr . Feature ( dst_layer . GetLayerDefn ( ) ) feature . SetField ( "DN" , 1 ) if segment is not None : geom = segmentize_geometry ( geom , segment = segment ) feature . SetGeometry ( geom ) dst_layer . CreateFeature ( feature ) dst_ds , feature , geom = None , None , None return
short_docstring: writes a geometry to a vector file.
short_docstring_tokens: writes a geometry to a vector file .
comment: """
      writes a geometry to a vector file.
  
      parameters
      ----------
      geom : OGRGeometry
          geometry object
      fname : str
          full path of the output file name
      format : str
          optional; format name. currently only shapefile is supported
      segment : float
          for precision: distance of longest segment of the geometry polygon
          in units of input osr_spref
      """$SEP$# modify the geometry such it has no segment longer then the given distance