I want to merge two graphics into one.

870
2
Jump to solution
01-10-2019 10:00 AM
EugeneStaten
New Contributor III

I have two circles.  The inner circle is red and represents a tightly controlled buffer around a point.  The outer circle is yellow and represents a larger buffer where conditions are not as dire.

I want to combine the two circles, maintaining their individual symbologies, into one graphics that can be turned into a json object and stored in a user database.

Later, I want to pull this data into a map by using:

                   var dangerGraphic = new Graphic(json);

                   layer.add(dangerGraphic);

This would make the object similar to AutoCad blocks or Microstation Cells. 

I know I can store the two circles as an array of graphics, but I am curious if there is a service that would do this.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Eugene,

  One graphic can not have two different symbologies. So you would have to maintain two graphics. You can use toJson method of Circle

https://developers.arcgis.com/javascript/3/jsapi/circle-amd.html#tojson  or Polygon

https://developers.arcgis.com/javascript/3/jsapi/polygon-amd.html#tojson  to get the json for the geometry.

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

Eugene,

  One graphic can not have two different symbologies. So you would have to maintain two graphics. You can use toJson method of Circle

https://developers.arcgis.com/javascript/3/jsapi/circle-amd.html#tojson  or Polygon

https://developers.arcgis.com/javascript/3/jsapi/polygon-amd.html#tojson  to get the json for the geometry.

0 Kudos
EugeneStaten
New Contributor III

OK,  Thanks Robert!!!

It's as I thought...

Perhaps ESRI will consider this for future releases.

0 Kudos