Available with Standard or Advanced license.
ST_Raster is a data type that allows you to store raster data directly in a geodatabase table. Use the ST_Raster type if you need to access your geodatabase raster data using SQL.
Follow these instructions to do the following:
- Configure the SQL Server instance.
- Install ST_Raster and confirm the type is present in the database.
- Change the geodatabase configuration so users can create ST_Raster data.
Configure SQL Server instance
- Log in to the SQL Server remote host machine.
- Create a folder on the SQL Server server to hold the ST_Raster library.
Be sure SQL Server has access to the folder.
- Add the absolute path of the folder to the system path.
- Copy the libst_raster_sql.dll file from the <ArcGIS client installation directory>\DatabaseSupport\SQLServer directory and paste it into the SQL Server folder you created in step 3.
- Copy the createAssembly.sql file from the <ArcGIS client installation directory>\DatabaseSupport\SQLServer directory and paste it into the folder you created in step 3.
- From an MS-DOS prompt, browse to the location of the createAssembly.sql file you copied in the previous step and run sqlcmd to execute it.
The assembly must be created by a sysadmin user.
The following is the syntax to execute the script:
sqlcmd -E -S <SQL Server instance> -d <database name> -v st_raster_path="<full path to folder created in step 3>\libst_raster_sql.dll" -v admindb=<database name> -i createAssembly.sql
For example:
sqlcmd -E -S instance1 -d ssgdb -v st_raster_path="c:\mygdblibraries\libst_raster_sql.dll" -v admindb=ssgdb -i createAssembly.sql
See Microsoft SQL Server documentation to learn about the sqlcmd utility and its uses.
Once the SQL Server instance is configured, proceed with installing ST_Raster and altering the geodatabase configuration.
Install ST_Raster
You can either run the Create Raster Type tool from ArcGIS for Desktop (Standard or Advanced), or run a Python script from an ArcGIS for Server or ArcGIS for Desktop (Standard or Advanced) client to install the ST_Raster type.
Run the Create Raster Type tool
If you have access to ArcGIS for Desktop (Standard or Advanced), you can run the Create Raster Type tool to install the ST_Raster type.
- Start ArcCatalog or ArcMap.
- Connect to the geodatabase as the geodatabase administrator.
- Open the Create Raster Type tool.
This tool is in the Geodatabase Administration toolset of the Data Management toolbox.
- Specify the database connection you created in step 2 as the Input Database Connection.
- Click OK to run the tool.
Use Python
You can run a Python script to create a database connection (.sde) file that connects to the geodatabase as the geodatabase administrator and install the ST_Raster type in the geodatabase.
- Open a command window, import the ArcPy module, and use the CreateDatabaseConnection_management function to create a database connection (.sde) file that connects to the geodatabase as the geodatabase administrator. If you connect using database authentication, be sure to save the user name and password with the connection file.
In this example, a connection file (adminconnect.sde) is created in C:\temp. The connection is made to the projects geodatabase on the teamdata SQL Server instance as the sde user.
import arcpy arcpy.CreateDatabaseConnection_management (r'c:/temp',"adminconnect.sde", "SQL_SERVER", "teamdata", "DATABASE_AUTH", "sde", "Cky00r", "SAVE_USERNAME", "projects")
- Install the ST_Raster type.
Here, the adminconnect.sde file is used by the CreateRasterType_management function to connect to the geodatabase and install the ST_Raster type:
arcpy.CreateRasterType_management (r'c:/temp/adminconnect.sde')
Confirm installation
Using SQL Server Management Studio, connect as any user that has access to the database where you installed ST_Raster, and test the installation of the ST_Raster type by executing the following SELECT statement against that database:
SELECT <dbo or sde>.st_raster_util_getVersion();
The query should return at least 1,000.
Now that you have confirmed that ST_Raster is installed, alter configuration keyword settings.
Alter geodatabase configuration
After the ST_Raster is installed in the geodatabase, you must alter the geodatabase configuration to make ST_Raster available for people to use when they create raster datasets and raster catalogs. You can either connect from ArcGIS for Desktop (Standard or Advanced) and run geoprocessing tools to accomplish this, or you can use a Python script run from an ArcGIS for Server or ArcGIS for Desktop (Standard or Advanced) client.
Run geoprocessing tools
If you have access to ArcGIS for Desktop, you can use the Export Geodatabase Configuration Keyword tool to export the geodatabase's current configuration settings to a text file, set the RASTER_STORAGE parameter to ST_Raster in the text file, and import the changed text file using the Import Geodatabase Configuration Keyword tool.
- Open the Export Geodatabase Configuration Keyword tool in ArcGIS for Desktop.
- Use the database connection you created for installing ST_Raster as the Input Database Connection.
- Specify a location and file name for the text file to be created.
- Open the text file in a text editor and set RASTER_STORAGE to ST_Raster.
- If you want all raster datasets and raster catalogs to use the ST_Raster type without people having to specify a keyword, alter the RASTER_STORAGE parameter under the DEFAULTS keyword.
- If only some of the raster datasets and raster catalogs should use the ST_Raster type, create a custom keyword and set the RASTER_STORAGE parameter for that keyword to ST_Raster.
- Save and close the text file.
- Import the altered text file to the geodatabase using the Import Geodatabase Configuration Keyword tool.
Use Python
You use the ArcPy function ExportGeodatabsaeConfigurationKeyword_management to export the current geodatabase configuration settings to a text file, edit and save the text file, then use the ImportGeodatabaseConfigurationKeyword_management function to import changes to the geodatabase.
Use the database connection file you created when you installed ST_Raster for the input_database when you run both the ExportGeodatabsaeConfigurationKeyword_management and ImportGeodatabaseConfigurationKeyword_management functions.
- Export the current geodatabase configuration.
In this example, the gdbconfig file is exported to the C:\temp folder.
arcpy.ExportGeodatabaseConfigurationKeyword_management (r'c:/temp/adminconnect.sde', r'c:/temp/gdbconfig.txt')
- Open the text file in a text editor and set RASTER_STORAGE to ST_Raster.
- If you want all raster datasets and raster catalogs to use the ST_Raster type without people having to specify a keyword, alter the RASTER_STORAGE parameter under the DEFAULTS keyword.
- If only some of the raster datasets and raster catalogs should use the ST_Raster type, create a custom keyword and set the RASTER_STORAGE parameter for that keyword to ST_Raster.
- Save and close the text file.
- Import the edited file.
arcpy.ImportGeodatabaseConfigurationKeyword_management (r'c:/temp/adminconnect.sde', r'c:/temp/gdbconfig.txt')
Your new configuration settings are now available for use when data is created.