<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Create polygon without sketching in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/create-polygon-without-sketching/m-p/1231596#M9076</link>
    <description>&lt;P&gt;Hi Andy,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a short example of how to create a polygon.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// current exent of mapView
var extent = MapView.Active.Extent;

var height = extent.Height;
var width = extent.Width;
var centerPt = extent.Center;

// new xmin, xmax, ymin, ymax values - a subset of the extent
var xmin = centerPt.X - width / 4;
var xmax = centerPt.X + width / 4;
var ymin = centerPt.Y - height / 4;
var ymax = centerPt.Y + height / 4;

// create 4 corners of the new polgyon
var pt1 = MapPointBuilderEx.CreateMapPoint(xmin, ymin, MapView.Active.Map.SpatialReference);
var pt2 = MapPointBuilderEx.CreateMapPoint(xmin, ymax, MapView.Active.Map.SpatialReference);
var pt3 = MapPointBuilderEx.CreateMapPoint(xmax, ymax, MapView.Active.Map.SpatialReference);
var pt4 = MapPointBuilderEx.CreateMapPoint(xmax, ymin, MapView.Active.Map.SpatialReference);

// then create a polygon from the set of points
var listPoints = new List&amp;lt;MapPoint&amp;gt;() { pt1, pt2, pt3, pt4 }; 
var polygon2 = PolygonBuilderEx.CreatePolygon(listPoints, MapView.Active.Map.SpatialReference);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There's also the following documentation that can help you discover more about building geometries.&amp;nbsp; &amp;nbsp;-&amp;nbsp;&lt;A href="https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-Geometry" target="_blank"&gt;https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-Geometry&lt;/A&gt;&lt;/P&gt;&lt;P&gt;There are a lot of different code snippets here too. -&amp;nbsp;&lt;A href="https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-Geometry" target="_blank"&gt;https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-Geometry&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Narelle&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Nov 2022 08:39:33 GMT</pubDate>
    <dc:creator>NarelleChedzey</dc:creator>
    <dc:date>2022-11-15T08:39:33Z</dc:date>
    <item>
      <title>Create polygon without sketching</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/create-polygon-without-sketching/m-p/1231523#M9071</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Another simple question, I'm sure.&amp;nbsp; I'm wanting to draw a polygon on the map programmatically.&amp;nbsp; I don't want to sketch with the mouse.&lt;/P&gt;&lt;P&gt;I see the code for making the polygon, but all the examples I've found have the geometry input from sketching.&amp;nbsp; But I don't have that geometry.&amp;nbsp; What does the geometry look like that I can send to the polygon?&amp;nbsp; I've tried all kinds of ways but so far haven't gotten it.&lt;/P&gt;&lt;P&gt;Ultimately, I want to have text and other objects inside the polygon.&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;Andy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 23:45:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/create-polygon-without-sketching/m-p/1231523#M9071</guid>
      <dc:creator>AndrewAlexander1</dc:creator>
      <dc:date>2022-11-14T23:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: Create polygon without sketching</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/create-polygon-without-sketching/m-p/1231595#M9075</link>
      <description>&lt;P&gt;You can use &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic72924.html" target="_blank" rel="noopener"&gt;PolygonBuilderEx.CreatePolygon()&lt;/A&gt; to create polygons from 2D or 3D coordinates, MapPoints, Segments, Multipoints, Envelopes or other Polygons, with or without Spatial Reference.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2022 08:39:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/create-polygon-without-sketching/m-p/1231595#M9075</guid>
      <dc:creator>FridjofSchmidt</dc:creator>
      <dc:date>2022-11-15T08:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: Create polygon without sketching</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/create-polygon-without-sketching/m-p/1231596#M9076</link>
      <description>&lt;P&gt;Hi Andy,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a short example of how to create a polygon.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// current exent of mapView
var extent = MapView.Active.Extent;

var height = extent.Height;
var width = extent.Width;
var centerPt = extent.Center;

// new xmin, xmax, ymin, ymax values - a subset of the extent
var xmin = centerPt.X - width / 4;
var xmax = centerPt.X + width / 4;
var ymin = centerPt.Y - height / 4;
var ymax = centerPt.Y + height / 4;

// create 4 corners of the new polgyon
var pt1 = MapPointBuilderEx.CreateMapPoint(xmin, ymin, MapView.Active.Map.SpatialReference);
var pt2 = MapPointBuilderEx.CreateMapPoint(xmin, ymax, MapView.Active.Map.SpatialReference);
var pt3 = MapPointBuilderEx.CreateMapPoint(xmax, ymax, MapView.Active.Map.SpatialReference);
var pt4 = MapPointBuilderEx.CreateMapPoint(xmax, ymin, MapView.Active.Map.SpatialReference);

// then create a polygon from the set of points
var listPoints = new List&amp;lt;MapPoint&amp;gt;() { pt1, pt2, pt3, pt4 }; 
var polygon2 = PolygonBuilderEx.CreatePolygon(listPoints, MapView.Active.Map.SpatialReference);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There's also the following documentation that can help you discover more about building geometries.&amp;nbsp; &amp;nbsp;-&amp;nbsp;&lt;A href="https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-Geometry" target="_blank"&gt;https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-Geometry&lt;/A&gt;&lt;/P&gt;&lt;P&gt;There are a lot of different code snippets here too. -&amp;nbsp;&lt;A href="https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-Geometry" target="_blank"&gt;https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-Geometry&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Narelle&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2022 08:39:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/create-polygon-without-sketching/m-p/1231596#M9076</guid>
      <dc:creator>NarelleChedzey</dc:creator>
      <dc:date>2022-11-15T08:39:33Z</dc:date>
    </item>
  </channel>
</rss>

