function add_greatcircle_geo( map_id, map_type, greatcircle_data, layer_id, auto_highlight, highlight_colour, legend, bbox, update_view, focus_layer, js_transition, wrap_longitude, brush_radius ) {

 var extensions = [];

  //console.log( brush_radius ) ;

  if ( brush_radius > 0 ) {
  	extensions.push( new deck.BrushingExtension() );
  }

  const greatcircleLayer = new deck.GreatCircleLayer({
  	map_id: map_id,
    id: 'greatcircle-'+layer_id,
    data: greatcircle_data,
    pickable: true,
    parameters: {
	    depthTest: false
	  },
    getWidth: d => d.properties.stroke_width,
    getSourcePosition: d => md_get_origin_coordinates( d ),
    getTargetPosition: d => md_get_destination_coordinates( d ),
    getSourceColor: d => md_hexToRGBA( d.properties.stroke_from ),
    getTargetColor: d => md_hexToRGBA( d.properties.stroke_to ),
    getTilt: d => d.properties.tilt,
    getHeight: d => d.properties.height,
    onClick: info => md_layer_click( map_id, "greatcircle", info ),
    onHover: md_update_tooltip,
    wrapLongitude: wrap_longitude,
    autoHighlight: auto_highlight,
    highlightColor: md_hexToRGBA( highlight_colour ),
    transitions: js_transition || {},
    brushingRadius: brush_radius,
    extensions: extensions
  });

  if( map_type == "google_map") {
	  md_update_overlay( map_id, 'greatcircle-'+layer_id, greatcircleLayer );
	} else {
	  md_update_layer( map_id, 'greatcircle-'+layer_id, greatcircleLayer );
	}
	if (legend !== false) {
	  md_add_legend( map_id, map_type, layer_id, legend, "hex" );
	}
	md_layer_view( map_id, map_type, layer_id, focus_layer, bbox, update_view );
}


function add_greatcircle_polyline( map_id, map_type, greatcircle_data, layer_id, auto_highlight, highlight_colour, legend, bbox, update_view, focus_layer, js_transition, wrap_longitude, brush_radius ) {

 var extensions = [];

  if ( brush_radius > 0 ) {
  	extensions.push( new deck.BrushingExtension() );
  }

  const greatcircleLayer = new deck.GreatCircleLayer({
    map_id: map_id,
    id: 'greatcircle-'+layer_id,
    data: greatcircle_data,
    pickable: true,
    parameters: {
	    depthTest: false
	  },
    getWidth: d => d.stroke_width,
    getSourcePosition: d => md_decode_points( d.origin ),
    getTargetPosition: d => md_decode_points( d.destination ),
    getSourceColor: d => md_hexToRGBA( d.stroke_from ),
    getTargetColor: d => md_hexToRGBA( d.stroke_to ),
    getTilt: d => d.tilt,
    getHeight: d => d.height,
    onClick: info => md_layer_click( map_id, "greatcircle", info ),
    autoHighlight: auto_highlight,
    highlightColor: md_hexToRGBA( highlight_colour ),
    onHover: md_update_tooltip,
    wrapLongitude: wrap_longitude,
    transitions: js_transition || {},
    brushingRadius: brush_radius,
    extensions: extensions
  });

  if( map_type == "google_map") {
	  md_update_overlay( map_id, 'greatcircle-'+layer_id, greatcircleLayer );
	} else {
	  md_update_layer( map_id, 'greatcircle-'+layer_id, greatcircleLayer );
	}
	if (legend !== false) {
	  md_add_legend( map_id, map_type, layer_id, legend, "hex" );
	}
  md_layer_view( map_id, map_type, layer_id, focus_layer, bbox, update_view );
}
