<?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 Create an outline of a raster grid in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/create-an-outline-of-a-raster-grid/m-p/410477#M32360</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a raster grid and I need to create a outline from the grid, some areas have No data and I was going to try create an outline using contour, but this will not work for areas of No data.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas would be appreciated,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 Jul 2013 08:46:33 GMT</pubDate>
    <dc:creator>ShaneCarey</dc:creator>
    <dc:date>2013-07-18T08:46:33Z</dc:date>
    <item>
      <title>Create an outline of a raster grid</title>
      <link>https://community.esri.com/t5/python-questions/create-an-outline-of-a-raster-grid/m-p/410477#M32360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a raster grid and I need to create a outline from the grid, some areas have No data and I was going to try create an outline using contour, but this will not work for areas of No data.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas would be appreciated,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jul 2013 08:46:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/create-an-outline-of-a-raster-grid/m-p/410477#M32360</guid>
      <dc:creator>ShaneCarey</dc:creator>
      <dc:date>2013-07-18T08:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: Create an outline of a raster grid</title>
      <link>https://community.esri.com/t5/python-questions/create-an-outline-of-a-raster-grid/m-p/410478#M32361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can use the Extent of the raster to get the lower-left, lower-right, upper-left, and upper-right points and just add these to a new polyline or polygon feature class.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

inputRaster = r"C:\MyRaster"
desc = arcpy.Describe(inputRaster)
ext = desc.extent

ll = ext.lowerLeft
ul = ext.upperLeft
lr = ext.lowerRight
ur = ext.upperRight

arcpy.CreateFeatureclass_management(r"C:\Documents\ArcGIS\Default.gdb","extentoutput", "POLYGON")

outFC = r"C:\Documents\ArcGIS\Default.gdb\extentoutput"

array = arcpy.Array([ll, ul, ur, lr])
pg = arcpy.Polygon(array)

with arcpy.da.InsertCursor(outFC, ["SHAPE@"]) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.insertRow([pg])

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit:&amp;nbsp; If you want it as a polyline output FC, then be sure to add the starting point at the end to "close" the polyline as a bounding box:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

inputRaster = r"C:\MyRaster"
desc = arcpy.Describe(inputRaster)
ext = desc.extent

ll = ext.lowerLeft
ul = ext.upperLeft
lr = ext.lowerRight
ur = ext.upperRight

arcpy.CreateFeatureclass_management(r"C:\Documents\ArcGIS\Default.gdb","extentoutput", "&lt;STRONG&gt;POLYLINE&lt;/STRONG&gt;")

outFC = r"C:\Documents\ArcGIS\Default.gdb\extentoutput"

array = arcpy.Array([ll, ul, ur, lr, &lt;STRONG&gt;ll&lt;/STRONG&gt;])
pl = arcpy.Polyline(array)

with arcpy.da.InsertCursor(outFC, ["SHAPE@"]) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.insertRow([pl])

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:38:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/create-an-outline-of-a-raster-grid/m-p/410478#M32361</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-11T18:38:50Z</dc:date>
    </item>
  </channel>
</rss>

