Select to view content in your preferred language

Get Polygon Ring

2601
1
Jump to solution
10-06-2015 05:23 AM
JulieBiju
Deactivated User

Thank U

Drawing polygon in the following way and it is succcess.

I need to save polygon poins to DB . How can I get the polygin poins????

var symbol;

        toolbar.deactivate();

        map.showZoomSlider();

        map.enableMapNavigation();

        switch (evt.geometry.type) {

            case "point":

            case "multipoint":

                symbol = new SimpleMarkerSymbol();

                break;

            case "polyline":

                symbol = new SimpleLineSymbol();

                break;

            default:

                symbol = new SimpleFillSymbol();

                break;

        }

        var graphic = new Graphic(evt.geometry, symbol);

        map.graphics.add(graphic);

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Julie,

    Something like this:

var poly = evt.geometry,
  pntArray = [];
for (var i2 = poly.rings.length - 1; i2 >= 0; i2--) {
  for (var j1 = 0; j1 < poly.rings[i2].length; j1++) {
    var mp2 = poly.getPoint(i2, j1);
    pntArray.push(mp2);
  }
}

View solution in original post

1 Reply
RobertScheitlin__GISP
MVP Emeritus

Julie,

    Something like this:

var poly = evt.geometry,
  pntArray = [];
for (var i2 = poly.rings.length - 1; i2 >= 0; i2--) {
  for (var j1 = 0; j1 < poly.rings[i2].length; j1++) {
    var mp2 = poly.getPoint(i2, j1);
    pntArray.push(mp2);
  }
}