def merge_geometries(geometries_str, sep='$'):
 geometries = geometries_str.split(sep)
 if (len(geometries) == 1):
  return geometries_str
 else:
  pool = OGRGeometry(geometries[0])
  for geom in geometries:
   pool = pool.union(OGRGeometry(geom))
  return pool.wkt

def merge_geometries ( geometries_str , sep = '$' ) : geometries = geometries_str . split ( sep ) if ( len ( geometries ) == 1 ) : return geometries_str else : pool = OGRGeometry ( geometries [ 0 ] ) for geom in geometries : pool = pool . union ( OGRGeometry ( geom ) ) return pool . wkt
take a list of geometries in a string .