<?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 How to extract bounding coordinates from raster files? in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/how-to-extract-bounding-coordinates-from-raster/m-p/5065#M341</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm seeking a Python solution to extract bounding coordinates from 1000+ raster images and save this information in a csv file.&amp;nbsp; (I'm using ArcGIS 10).&amp;nbsp; Can anyone suggest some script that will extract this information for a single raster within Python?&amp;nbsp; I'm fairly new to Python but will be able to create a loop if someone can help me solve this for a single raster.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks so much for your help!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Apr 2013 13:06:31 GMT</pubDate>
    <dc:creator>StavrosC</dc:creator>
    <dc:date>2013-04-09T13:06:31Z</dc:date>
    <item>
      <title>How to extract bounding coordinates from raster files?</title>
      <link>https://community.esri.com/t5/data-management-questions/how-to-extract-bounding-coordinates-from-raster/m-p/5065#M341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm seeking a Python solution to extract bounding coordinates from 1000+ raster images and save this information in a csv file.&amp;nbsp; (I'm using ArcGIS 10).&amp;nbsp; Can anyone suggest some script that will extract this information for a single raster within Python?&amp;nbsp; I'm fairly new to Python but will be able to create a loop if someone can help me solve this for a single raster.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks so much for your help!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Apr 2013 13:06:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/how-to-extract-bounding-coordinates-from-raster/m-p/5065#M341</guid>
      <dc:creator>StavrosC</dc:creator>
      <dc:date>2013-04-09T13:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract bounding coordinates from raster files?</title>
      <link>https://community.esri.com/t5/data-management-questions/how-to-extract-bounding-coordinates-from-raster/m-p/5066#M342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
from arcpy import env
import csv

#Location of raster files to be processed
rasterWS = "C:/JP2"
env.workspace = rasterWS
#List of rasters within workspace; may need to change file type
rasterList = arcpy.ListRasters("*", "JP2")

#Open csv file for writing.
#If you wish to append rows to an existing file, change argument to "ab" (append)
#Without "ab" argument, an existing file will be overwritten
with open("testcsv.csv", "wb") as csvfile:

&amp;nbsp;&amp;nbsp;&amp;nbsp; fileWriter = csv.writer(csvfile)
&amp;nbsp;&amp;nbsp;&amp;nbsp; #Write Column Headers
&amp;nbsp;&amp;nbsp;&amp;nbsp; headers = ["Filename","XMin", "YMin", "XMax","YMax", "ZMin","ZMax","MMin","MMax"]
&amp;nbsp;&amp;nbsp;&amp;nbsp; fileWriter.writerow(headers)

&amp;nbsp;&amp;nbsp;&amp;nbsp; for rasterFile in rasterList:

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Create raster object and get properties
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; raster = arcpy.Raster(rasterFile)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name = raster.name
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; extent = raster.extent

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Create list from extent string, prepend filename to list, and write list as row in csv
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writeData = str(extent).split()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writeData.insert(0, name)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileWriter.writerow(writeData)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is a basic script that should get you started.&amp;nbsp; Change the directory and file type to suit your needs.&amp;nbsp; Hope this helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:11:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/how-to-extract-bounding-coordinates-from-raster/m-p/5066#M342</guid>
      <dc:creator>MichaelQuinene</dc:creator>
      <dc:date>2021-12-10T20:11:41Z</dc:date>
    </item>
  </channel>
</rss>

