Buffer a draw graphic on Google Map

Discussion created by jingwenwang on Feb 21, 2013
Hi everyone,

I'm trying to buffer a draw graphic on google map. But seems it's not able to do the buffer.

I have a listener of drawing:

google.maps.event.addListener(drawingManager, 'overlaycomplete', function(evt) {
    event = evt;

Then the buffer function need to buffer the this graphic:
function GmapBuffering() {
  gsvc = new esri.tasks.GeometryService(gsvcURL);

  //setup the buffer parameters
  var params = new esri.tasks.BufferParameters();
  params.distances = [dojo.byId("distance").value];
  params.bufferSpatialReference = gmaps.ags.SpatialReference.WEB_MERCATOR;
  params.outSpatialReference = gmaps.ags.SpatialReference.WEB_MERCATOR;
  params.unit = eval("esri.tasks.GeometryService." + dojo.byId("unit").value);
  params.geometries = [event.overlay];

  gsvc.buffer(params, function(results, err) {
    if (!err) {
      var g= results.geometries[i][j];
    } else {
      alert(err.message + err.details.join(','));

Here's the problem, I got an error as following:
TypeError: geom.toJson is not a function

Seems like arcgis GeometryService is not able to recognize the "event" graphic. Any ideas would be appreciate!