<?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: Fishnet creation with ArcPy with origin coordinates from a bounding box (ArcGis 1 in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/fishnet-creation-with-arcpy-with-origin/m-p/662284#M22054</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks! That made it for me. %f seems to force it to understand the points as a string? So I'll need to play around with it a bit more.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Sep 2012 11:10:38 GMT</pubDate>
    <dc:creator>ThomasChudy</dc:creator>
    <dc:date>2012-09-19T11:10:38Z</dc:date>
    <item>
      <title>Fishnet creation with ArcPy with origin coordinates from a bounding box (ArcGis 10.0)</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/fishnet-creation-with-arcpy-with-origin/m-p/662282#M22052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello GIS-Community,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to create a script that helps to create Fishnet based on an irregular formed shape (polygon). It should use the bounding box of that shape as origin coordinate (Xmin, Ymin) and opposite corner (Xmax, Ymax). I managed it to somehow get these values from a created Envelope based on that irregular shape but I can not get it to use it as an input for the Fishnet creation. Maybe it's a wrong data type!? As he sometimes stated 'Input for orig. coordinate should be numeric'.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;As I never tried to create a scrit before, I mostly took ArcPy script parts from ArcGIS web help from different geoprocessing tools trying to combine them with try and error method.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It's not necessary to create all the temporary shapes such as the bounding box, but it's not a problem neither.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;We're on ArcInfo licensing level.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So here is the messy script text I sticked together...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Envelope gets created as I want it. Coordinates from corners of the envelope are taken right (as 'Print' command shows), but giving these values to the fishnet creation doesn't work out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If i give absolute numbers to 'origin coordinate', 'y-axis orientation' and 'opposite corner' it works as it should... so there must be some mistakes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions on that?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for your help!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;# creating bounding box (envelope) import arcpy from arcpy import env env.workspace = "C:/data" arcpy.FeatureEnvelopeToPolygon_management("E:/ArcMap/1412-boundary2012_proj.shp", &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "E:/ArcMap/1412extent.shp", &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "SINGLEPART")&amp;nbsp; # Create a Describe object from the shapefile # desc = arcpy.Describe("E:/ArcMap/1412extent.shp")&amp;nbsp; # Print dataset properties # minX=(desc.extent.XMin)&amp;nbsp; maxX=(desc.extent.XMax)&amp;nbsp; minY=(desc.extent.YMin)&amp;nbsp; maxY=(desc.extent.YMax)&amp;nbsp; print(minX) print(maxX) print(minY) print(maxY)&amp;nbsp; #create boundary points from envelope # pxy = arcpy.Point(minX, minY) ptGeometry = arcpy.PointGeometry(pxy)&amp;nbsp; pxY = arcpy.Point(minX, maxY) ptGeometry = arcpy.PointGeometry(pxY)&amp;nbsp; pXy = arcpy.Point(maxX, minY) ptGeometry = arcpy.PointGeometry(pXy)&amp;nbsp; pXY = arcpy.Point(maxX, maxY) ptGeometry = arcpy.PointGeometry(pXY)&amp;nbsp; print(pxy) print(pxY) print(pXy) print(pXY)&amp;nbsp; print pxy.X,pxy.Y print pxy.X,pxy.Y&amp;nbsp; # Name: CreateFishnet.py # Description: Creates rectangular cells # Author: ESRI&amp;nbsp; # import system module import arcpy from arcpy import env&amp;nbsp; # set workspace environment #&amp;nbsp; env.workspace = "C:/data/output"&amp;nbsp;&amp;nbsp; # Set the extent environment using a keyword. arcpy.env.extent = "E:/ArcMap/1412extent.shp"&amp;nbsp; # Set coordinate system of the output fishnet #&amp;nbsp; env.outputCoordinateSystem = "&amp;lt;install directory&amp;gt;/Coordinate Systems/Projected Coordinate Systems/UTM/NAD 1983/NAD 1983 UTM Zone 11N.prj"&amp;nbsp; outFeatureClass = "E:/ArcMap/bound_net.shp"&amp;nbsp; # Set the origin of the fishnet originCoordinate = pxy.X,pxy.Y&amp;nbsp; # Set the orientation yAxisCoordinate = pxy.X,(pxy.Y+1)&amp;nbsp; # Enter 0 for width and height - these values will be calcualted by the tool cellSizeWidth = '60' cellSizeHeight = '60'&amp;nbsp; # Number of rows and columns together with origin and opposite corner&amp;nbsp; # determine the size of each cell&amp;nbsp; numRows =&amp;nbsp; '0' numColumns = '0'&amp;nbsp; oppositeCoorner = pXY.X,pXY.Y&amp;nbsp; # Create a point label feature class&amp;nbsp; labels = 'false'&amp;nbsp; # Extent is set by origin and opposite corner - no need to use a template fc templateExtent = 'E:/ArcMap/1412extent.shp'&amp;nbsp; # Each output cell will be a polygon geometryType = 'POLYGON'&amp;nbsp; arcpy.CreateFishnet_management(outFeatureClass, originCoordinate, yAxisCoordinate, cellSizeWidth, cellSizeHeight, numRows, numColumns, oppositeCoorner, labels, templateExtent, geometryType)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2012 07:00:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/fishnet-creation-with-arcpy-with-origin/m-p/662282#M22052</guid>
      <dc:creator>ThomasChudy</dc:creator>
      <dc:date>2012-09-17T07:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: Fishnet creation with ArcPy with origin coordinates from a bounding box (ArcGis 1</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/fishnet-creation-with-arcpy-with-origin/m-p/662283#M22053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The inputs have to be strings (look at the examples):&lt;/SPAN&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000002q000000" rel="nofollow" target="_blank"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000002q000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;# Set the origin of the fishnet originCoordinate = "%f %f" % (pxy.X,pxy.Y)&amp;nbsp; # Set the orientation yAxisCoordinate = "%f %f" % (pxy.X,(pxy.Y+1))&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2012 08:53:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/fishnet-creation-with-arcpy-with-origin/m-p/662283#M22053</guid>
      <dc:creator>FabianBlau</dc:creator>
      <dc:date>2012-09-17T08:53:04Z</dc:date>
    </item>
    <item>
      <title>Re: Fishnet creation with ArcPy with origin coordinates from a bounding box (ArcGis 1</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/fishnet-creation-with-arcpy-with-origin/m-p/662284#M22054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks! That made it for me. %f seems to force it to understand the points as a string? So I'll need to play around with it a bit more.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2012 11:10:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/fishnet-creation-with-arcpy-with-origin/m-p/662284#M22054</guid>
      <dc:creator>ThomasChudy</dc:creator>
      <dc:date>2012-09-19T11:10:38Z</dc:date>
    </item>
    <item>
      <title>Re: Fishnet creation with ArcPy with origin coordinates from a bounding box (ArcGis 1</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/fishnet-creation-with-arcpy-with-origin/m-p/662285#M22055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;%f seems to force it to understand the points as a string? So I'll need to play around with it a bit more.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;%f&lt;/STRONG&gt;&lt;SPAN&gt; is a Python string substitution code that formats a number into a text representation of floating point numbers. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;gt;&amp;gt;&amp;gt; "%f %f" % (1,2)
'1.000000 2.000000'
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Python is moving toward a new method for substituting strings in situations like this. This new method was implemented at 2.4 and future versions of 3.x will stop supporting the old C-style string substitution, so we might as well start using it, especially since the new method is a bit less cryptic.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
originCoordinate = "{0} {1}".format(pxy.X,pxy.Y)
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:00:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/fishnet-creation-with-arcpy-with-origin/m-p/662285#M22055</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-12T04:00:25Z</dc:date>
    </item>
  </channel>
</rss>

