original_docstring: 
      Generates a raster giving the distance from each cell to the nearest feature in a shapefile
  
      Args:
          polylines: features to calculate distance to
          support_folder: output FOLDER
          epsg: the epsg to reproject the input polyline file to
          cut_shape: an optional raster used to cut down the output file
  
      Returns:
          None
  
      
docstring: Generates a raster giving the distance from each cell to the nearest feature in a shapefile
docstring_tokens: Generates a raster giving the distance from each cell to the nearest feature in a shapefile
code: def generate_distance_raster(polylines, support_folder, outname, epsg=None, cut_shape=None, cut_buffer=1000):
      """
      Generates a raster giving the distance from each cell to the nearest feature in a shapefile
  
      Args:
          polylines: features to calculate distance to
          support_folder: output FOLDER
          epsg: the epsg to reproject the input polyline file to
          cut_shape: an optional raster used to cut down the output file
  
      Returns:
          None
  
      """
      if os.path.exists(support_folder):
          print(f'Removing {support_folder}')
          shutil.rmtree(support_folder)
      print(f'Creating {support_folder}')
      os.mkdir(support_folder)
  
      #buff_name = os.path.join(support_folder, 'buffered_polylines.shp')
      #createBuffer(polylines, buff_name, 1)
  
      if epsg:
          repro_name = os.path.join(support_folder, 'polylines_repro.shp')
          repro_command = f'ogr2ogr -t_srs EPSG:{epsg} {repro_name} {polylines}'
          print(f'Run command: {repro_command}')
          os.system(repro_command)
          polylines = repro_name
  
      if cut_shape:
          buffered_cutter_name = os.path.join(support_folder, 'buffered_cutter.shp')
          print('Creating buffered cutting shape')
          createBuffer(cut_shape, buffered_cutter_name, cut_buffer)
  
          cut_name = os.path.join(support_folder, 'polylines_cut.shp')
          cut_command = f'ogr2ogr -clipsrc {buffered_cutter_name} {cut_name} {polylines}'
          print(f'Run command: {cut_command}')
          os.system(cut_command)
          polylines = cut_name
  
      rasterized_name = os.path.join(support_folder, 'rasterized_polylines.tif')
      rasterize_command = f'gdal_rasterize -burn 1 -tr 1 1 -ot Byte {polylines} {rasterized_name}'
      print(f'Run command: {rasterize_command}')
      os.system(rasterize_command)
  
      distance_name = outname
      distance_command = f'gdal_proximity.py {rasterized_name} {distance_name}'
      print(f'Run command: {distance_command}')
      os.system(distance_command)
code_tokens: def generate_distance_raster ( polylines , support_folder , outname , epsg = None , cut_shape = None , cut_buffer = 1000 ) : if os . path . exists ( support_folder ) : print ( f'Removing {support_folder}' ) shutil . rmtree ( support_folder ) print ( f'Creating {support_folder}' ) os . mkdir ( support_folder ) if epsg : repro_name = os . path . join ( support_folder , 'polylines_repro.shp' ) repro_command = f'ogr2ogr -t_srs EPSG:{epsg} {repro_name} {polylines}' print ( f'Run command: {repro_command}' ) os . system ( repro_command ) polylines = repro_name if cut_shape : buffered_cutter_name = os . path . join ( support_folder , 'buffered_cutter.shp' ) print ( 'Creating buffered cutting shape' ) createBuffer ( cut_shape , buffered_cutter_name , cut_buffer ) cut_name = os . path . join ( support_folder , 'polylines_cut.shp' ) cut_command = f'ogr2ogr -clipsrc {buffered_cutter_name} {cut_name} {polylines}' print ( f'Run command: {cut_command}' ) os . system ( cut_command ) polylines = cut_name rasterized_name = os . path . join ( support_folder , 'rasterized_polylines.tif' ) rasterize_command = f'gdal_rasterize -burn 1 -tr 1 1 -ot Byte {polylines} {rasterized_name}' print ( f'Run command: {rasterize_command}' ) os . system ( rasterize_command ) distance_name = outname distance_command = f'gdal_proximity.py {rasterized_name} {distance_name}' print ( f'Run command: {distance_command}' ) os . system ( distance_command )
short_docstring: Generates a raster giving the distance from each cell to the nearest feature in a shapefile
short_docstring_tokens: Generates a raster giving the distance from each cell to the nearest feature in a shapefile
comment: """
      Generates a raster giving the distance from each cell to the nearest feature in a shapefile
  
      Args:
          polylines: features to calculate distance to
          support_folder: output FOLDER
          epsg: the epsg to reproject the input polyline file to
          cut_shape: an optional raster used to cut down the output file
  
      Returns:
          None
  
      """$SEP$#buff_name = os.path.join(support_folder, 'buffered_polylines.shp')$SEP$#createBuffer(polylines, buff_name, 1)