Tell me more ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm tryin to draw rectangle based on extent object. Could someone look trought my code and Tell me what am I doing wrong?

var polygon = {
  "geometry" : {
                "rings" : [[[extent.xmin, extent.ymin],[extent.xmin, extent.ymax],[extent.xmax, extent.ymax],[extent.xmax, extent.ymin],[extent.xmin, extent.ymin]]],
            "spatialReference" : {
                        "wkid" : 2180
                         }
               },
            "attributes" : {},
            "symbol" : {
                "color" : [0, 255, 0, 196],
                "outline" : {
                    "color" : [0, 0, 0, 225],
                    "width" : 1.5,
                    "type" : "esriSLS",
                    "style" : "esriSLSSolid"
                },
                "type" : "esriSFS",
                "style" : "esriSFSSolid"
            }
  };
  var test = new esri.Graphic(polygon);
  MAP.map.getLayer('identifyLayer').add(test);

I think that something is wrong with extent coordinates order, but I don't know how to fix it. Thanks!

share|improve this question
2  
I was able to create a graphic using your code. Have you looked at each of your variables, say through console.log, to see if they're created correctly? I'd check your extent before it comes in, as well as test and your 'identifyLayer' to make sure those work. – raykendo Feb 26 at 14:58
great, thanks mate for checking it out! yeah, the problem were in coordinates, because wkid:2180 is transformed CRS where x axis is switched with y. – Krystian Feb 26 at 16:01

closed as too localized by Devdatta Tengshe, whuber Feb 27 at 19:15

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.