Skip to content

Instantly share code, notes, and snippets.

@BrunoCaimar
Created August 18, 2015 19:20
Show Gist options
  • Save BrunoCaimar/82b8c9b9938de820d266 to your computer and use it in GitHub Desktop.
Save BrunoCaimar/82b8c9b9938de820d266 to your computer and use it in GitHub Desktop.
Obter polígono usando um extent como origem
obter_poligono: function(graphic, commontype)
{
var geometry = graphic.geometry;
var polygon = geometry;
if(geometry.type === "extent")
{
var a = geometry;
polygon = new Polygon(a.spatialReference);
var r=[[a.xmin,a.ymin],
[a.xmin,a.ymax],
[a.xmax,a.ymax],
[a.xmax,a.ymin],
[a.xmin,a.ymin]];
polygon.addRing(r);
geometry = polygon;
commontype = "polygon";
}
return polygon;
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment