<?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: arcpy.sa.ExtractByMask fails for enterprise geodatabase raster in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-sa-extractbymask-fails-for-enterprise/m-p/119310#M9404</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Alex,&lt;/P&gt;&lt;P&gt;Thanks for following up.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get that error message if I set the "scratch workspace" to a folder.&amp;nbsp; I get the other error when the scratch workspace is a file geodatabase.&amp;nbsp; But both are about the same: the default output name is not valid for either workspace type. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suspect all the other "arcpy.sa.Extract..." methods will fail in the same way.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Current workarounds are:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. don't use a database with less than 4 characters&lt;/P&gt;&lt;P&gt;2. connect with an os account or schema owned account&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Neither of these were possible for me, given the production environment already exists.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: renaming the database at the SQL level causes lots more issues.&amp;nbsp; I can't connect from any ArcGIS client after renaming the DB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There might be some tweak that makes the read-only SQL account default to the data owner schema but I haven't figured it out. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying this now...&lt;/P&gt;&lt;P&gt;3. use the data management tool to "clip" the raster down to temporary location then use the extract function.&amp;nbsp; This one adds some extra processing time and there are few settings that need to be tweaked to get the exact pixel size and orientation as the original but should get thru. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 Jul 2016 18:57:57 GMT</pubDate>
    <dc:creator>FredSpataro</dc:creator>
    <dc:date>2016-07-05T18:57:57Z</dc:date>
    <item>
      <title>arcpy.sa.ExtractByMask fails for enterprise geodatabase raster</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-sa-extractbymask-fails-for-enterprise/m-p/119306#M9400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm tracking on odd issue that's come up when I moved some code to the production environment. In that environment, the rasters used by the scripts are stored in an enterprise geodatabase.&amp;nbsp; When running arcpy.sa.ExtractByMask with an input raster from an enterprise geodatabase the following error is thrown:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Messages&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Executing: ExtractByMask GIS.DATACREATOR.dem watershed C:\...\Default.gdb\Extract_GIS.1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Start Time: Wed Jun 29 14:14:06 2016&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;ERROR 999999: Error executing function.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;The table name is invalid.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;No spatial reference exists.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;ERROR 010302: Unable to create the output raster: C:\...\Default.gdb\Extract_GIS.1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;ERROR 010067: Error in executing grid expression.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Failed to execute (ExtractByMask).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Failed at Wed Jun 29 14:14:19 2016 (Elapsed Time: 13.04 seconds)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The stock system toolbox tool (System toolbox\Spatial Analyst Tools\Extraction\Extract By Mask) generates the same error.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It appears that this is caused by the "default output raster name".&amp;nbsp; In this case, that string is 'Extract_GIS.1' - which is an illegal raster name.&amp;nbsp; This is the typical GP default value: part tool name, part input dataset name.&amp;nbsp; Since the input raster is from a database, it's name is fully qualified (database.schema.table): GIS.DATACREATER.dem and the default text string uses the first four characters including the dot character ".".&amp;nbsp; It's unclear why the default name is not being checked as a valid name for the workspace... this seems to happen everywhere else in the stock GP tools. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So...in the stock tool, modifying the default output name to something valid allows the tool to run correctly.&amp;nbsp; BUT the arcpy.sa.ExtractByVersion does not take an "output dataset parameter".&amp;nbsp; It only takes the input raster and mask features. It then creates some default scratch raster which, in the examples, is later saved to a specific name using the raster.Save() method.&amp;nbsp; But b/c the default name is invalid, this arcpy function can never complete successfully if the input raster is from an enterprise geodatabase.&amp;nbsp; Ugh. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Things I've tried:&lt;/P&gt;&lt;P&gt;1. creating a layer file for the input raster with a clean name... the function still tries to use the FQN as the base for the default output name and fails&lt;/P&gt;&lt;P&gt;2. Changing the scratch workspace to a folder rather than the file geodatabase... Same name issue occurs with slightly different message but the file based name is still invalid as well....Again why is an invalid default name being chosen? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why is the method signature of stock toolbox tool and arcpy version different? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jun 2016 16:30:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-sa-extractbymask-fails-for-enterprise/m-p/119306#M9400</guid>
      <dc:creator>FredSpataro</dc:creator>
      <dc:date>2016-06-30T16:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.sa.ExtractByMask fails for enterprise geodatabase raster</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-sa-extractbymask-fails-for-enterprise/m-p/119307#M9401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Fred,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you supply some more information such as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What version Enterprise Geodatabase you are utilizing?&lt;/P&gt;&lt;P&gt;What RDMS (oracle, sql) does the enterprise database built upon?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just to test out if I was experiencing the same type of error:&lt;/P&gt;&lt;P&gt;I downloaded "PAMAP_DEM_mosaic_Butler_3m.zip" from&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.pasda.psu.edu/data/LidarMosaics/CountyMosaics/county_DEM_3M/" title="http://www.pasda.psu.edu/data/LidarMosaics/CountyMosaics/county_DEM_3M/" rel="nofollow noopener noreferrer" target="_blank"&gt;www.pasda.psu.edu - /data/LidarMosaics/CountyMosaics/county_DEM_3M/&amp;nbsp; &lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I imported it into my SDE database and was able to successfully run that python command with no issues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Messages&lt;/P&gt;&lt;P&gt;Executing: ExtractByMask "Database Connections\Butler_County.sde\Butler.DBO.PAMAP_DEM_mosaic_Butler_3m" "Database Connections\Butler_County.sde\Butler.DBO.mask" C:\Users\alex8694\AppData\Local\Esri\Desktop10.4\SpatialAnalyst\Extract_PAMA1&lt;/P&gt;&lt;P&gt;Start Time: Tue Jul 05 12:18:34 2016&lt;/P&gt;&lt;P&gt;Succeeded at Tue Jul 05 12:18:36 2016 (Elapsed Time: 1.65 seconds)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;Looking at your messages information posted above, I would suggest trying to add the full path to your &lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;GIS.DATACREATOR.dem.&amp;nbsp; First you need to save a connection file under database connections to your database ( I assume you have one of these already?)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;I do not believe the tool can find your raster because you are not &lt;/SPAN&gt;&lt;SPAN style="font-size: 16px;"&gt;specifying&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt;"&gt; the entire path, such as:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;r'Database Connections\database_name.sde\&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;GIS.DATACREATOR.dem'&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code for sample run:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
arcpy.sa.ExtractByMask(r'Database Connections\Butler_County.sde\Butler.DBO.PAMAP_DEM_mosaic_Butler_3m', 'r'Database Connections\Butler_County.sde\Butler.DBO.mask')&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:58:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-sa-extractbymask-fails-for-enterprise/m-p/119307#M9401</guid>
      <dc:creator>AlexanderBrown5</dc:creator>
      <dc:date>2021-12-11T06:58:18Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.sa.ExtractByMask fails for enterprise geodatabase raster</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-sa-extractbymask-fails-for-enterprise/m-p/119308#M9402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the reply. &lt;/P&gt;&lt;P&gt;1. Yes I have a connection file, it's not stored in the normal 'Database Connections" folder since that points to a specific user's document directory.&amp;nbsp; We use a non-user specific folder for these.&amp;nbsp; I edited the full path to the connection .sde file in the message details so it was easier to read and hid details of our setup.&amp;nbsp; The connection file correctly finds the raster for other tools.&lt;/P&gt;&lt;P&gt;2. The database is SQLServer, ArcGIS 10.3.1&lt;/P&gt;&lt;P&gt;3. Esri support has verified the bug: &lt;SPAN style="font-size: 12.0pt; font-family: 'Times New Roman',serif;"&gt;BUG-000097536 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Turns out it's very specific to the database name and connection setup but is easy to reproduce:&lt;/P&gt;&lt;P&gt;1. The database name has to be less than 4 characters. In my case the database name is GIS&lt;/P&gt;&lt;P&gt;2. The database connection user has to be a SQL account not an OS account and probably one that is NOT the table owner.&amp;nbsp; Is my case, the connection user is a read-only SQLServer account that doesn't own the table schema. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The combination of these two causes the default name for output to be "Extract_GIS.1" which is an invalid raster name and thus the tool can't complete. You'll notice in your test, neither of the two conditions are met and the tool produces a valid raster name: &lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; font-size: 14px;"&gt;Extract_PAMA1. &lt;/SPAN&gt;The connection user is able to "read" the specific table name, and use "PAMA" in the default name. If the connection user is not the table owner, the fragment used starts at the database name (probably makes sense, the table name is fully qualified if not the owner) and grabs the first 4 characters.&amp;nbsp; In your case that would be "BUTL" and still produce a valid name. In my case it grabs "GIS.", the dot character being invalid.&amp;nbsp; Seems like a simple oversight to exclude invalid characters or at the very least validate the default name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; font-size: 14px;"&gt;Fred&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jul 2016 16:59:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-sa-extractbymask-fails-for-enterprise/m-p/119308#M9402</guid>
      <dc:creator>FredSpataro</dc:creator>
      <dc:date>2016-07-05T16:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.sa.ExtractByMask fails for enterprise geodatabase raster</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-sa-extractbymask-fails-for-enterprise/m-p/119309#M9403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Fred,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the clarification.&amp;nbsp; I was not able to get the exact error you have, but was able to produce:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ERROR 000876: Output raster:&amp;nbsp; Extract_TE.D1's extension is invalid for the output raster format.&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My database name: TE&lt;/P&gt;&lt;P&gt;Raster name: dem&lt;/P&gt;&lt;P&gt;Full Raster name: TE.DBO.dem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I read through the support case to gain more of an understanding of the issue--I will not do any further testing at this time, as to not replicate testing already completed by technical support.&amp;nbsp; I am glad you have worked with ESRI technical support to verify that this problem is a bug, and have it officially logged.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Keep checking regarding updates to the bug through the Customer Care website (myesri.com).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jul 2016 18:45:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-sa-extractbymask-fails-for-enterprise/m-p/119309#M9403</guid>
      <dc:creator>AlexanderBrown5</dc:creator>
      <dc:date>2016-07-05T18:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.sa.ExtractByMask fails for enterprise geodatabase raster</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-sa-extractbymask-fails-for-enterprise/m-p/119310#M9404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Alex,&lt;/P&gt;&lt;P&gt;Thanks for following up.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get that error message if I set the "scratch workspace" to a folder.&amp;nbsp; I get the other error when the scratch workspace is a file geodatabase.&amp;nbsp; But both are about the same: the default output name is not valid for either workspace type. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suspect all the other "arcpy.sa.Extract..." methods will fail in the same way.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Current workarounds are:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. don't use a database with less than 4 characters&lt;/P&gt;&lt;P&gt;2. connect with an os account or schema owned account&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Neither of these were possible for me, given the production environment already exists.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: renaming the database at the SQL level causes lots more issues.&amp;nbsp; I can't connect from any ArcGIS client after renaming the DB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There might be some tweak that makes the read-only SQL account default to the data owner schema but I haven't figured it out. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying this now...&lt;/P&gt;&lt;P&gt;3. use the data management tool to "clip" the raster down to temporary location then use the extract function.&amp;nbsp; This one adds some extra processing time and there are few settings that need to be tweaked to get the exact pixel size and orientation as the original but should get thru. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jul 2016 18:57:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-sa-extractbymask-fails-for-enterprise/m-p/119310#M9404</guid>
      <dc:creator>FredSpataro</dc:creator>
      <dc:date>2016-07-05T18:57:57Z</dc:date>
    </item>
  </channel>
</rss>

