Check Out File (Production Mapping)
Récapitulatif
Checks out a file from a Product Library.
A product library stores information and data required for cartographic and digital data production in a geodatabase. Solutions Esri Mapping and Charting store business rules, documents, and spatial information inside a product library.
You must check out a file to edit it.
Utilisation
Check out locks a file. A file can only be checked out by one person.
The Product Library Workspace must be a geodatabase.
The Product Library File Path is the path to the particular Product Library tree node. A product library path is a double colon-delimited string (::) in this format: Solution Name::Product Class Name::Series Name::Product Name::Instance Name::AOI Name::File Name.
To determine a product library path, browse to an item in the Product Library window, right-click it, and click Copy As Path. The product library path will be placed on the clipboard. You can paste it into any parameter that requires a product library path.
Check out creates a local copy of the file in the location indicated by Checkout path. Checkout path must be a folder.
This tool returns a path as a string to the checked out file. If you are going to check out a file or personal geodatabase (an instance database) by executing tools in ModelBuilder, use the Check Out File As File tool instead of this tool. Check Out File As File returns a file while this tool returns a string.
If you use this tool in ModelBuilder, insert the Calculate Value tool to convert the returned string to another data type. For example, given a model that checks out an instance database, executes Upgrade Production Database, then checks the instance database back into a product library, you need to connect Check Out File to Calculate Value through a precondition. Calculate Value can convert the string returned by Check Out File to a workspace. The model would look similar to the following image:
The expression r"%Path to checked out file%" is the output data variable of Check Out File. Calculate Value converts this string into the data type listed in the Data type field. The dashed line connecting the output data variable to Calculate Value indicates that Path to checked out file is a precondition in Calculate Value. You can then connect the Calculate Value output data variable (workspace) to the Upgrade Production Database tool.
Syntaxe
Paramètre | Explication | Type de données |
product_library_workspace |
Path to the product library workspace. | Workspace |
product_library_itempath |
The product library path to the item. This is specified as Solution Name::Product Class Name::Series Name::Product Name::Instance Name::AOI Name::File Name. | String |
checkout_location |
The folder that will contain the checked out file. | Folder |
overwrite_flag (Facultatif) | Indicates whether the checkout process overwrites a local copy of the file if it exists.
| Boolean |
product_library_ownername (Facultatif) | Product library schema owner name. Set this parameter if the user account specified in product_library_workspace is not the schema owner. This applies only to product libraries stored in enterprise geodatabases. | String |
Exemple de code
The following stand-alone script demonstrates how to check out a file from a Product Library.
# Name: CheckOutFile_Example.py
# Description: Checks out a file from a Product Library
# Requirements: Production Mapping extension
# import arcpy and checkout a Production Mapping license
import arcpy
arcpy.CheckOutExtension("foundation")
#Set local variables
product_library_workspace = "C:\\Data\\ProductLibrary.gdb"
product_library_itempath = "Products::Topographic Maps::QA_QC_carto_checklist.rtf"
checkout_location = "C:\\Data"
overwrite_flag = "OVERWRITE"
# create a production database
arcpy.PLCheckoutFile_production(product_library_workspace, product_library_itempath, checkout_location, overwrite_flag)
print "Script completed successfully."
# Check in the extension
arcpy.CheckInExtension("foundation")
The following Python window script checks out a database .mdf and attaches it to an instance of SQLExpress.
import arcpy, os
# variables for PLCheckOutFile params
productLibrary="c:\\data\\ProductLibrary.gdb"
plPath="Products::Topographic Maps::QA_QC_carto.mdf"
checkOutFolder="c:\\data"
# variable for AttachDatabase tool
sqlExpress="YOUR_SERVER_NAME\\SQLEXPRESS"
# exec PLCheckOutFile
result=arcpy.PLCheckoutFile_production(productLibrary, plPath, checkOutFolder)
# result[0] contains the path to the checked out file
mdf=result[0]
if os.path.exists(mdf):
print mdf
# use mdf in Attach Database
result=arcpy.AttachDatabase_production(sqlExpress,mdf)
# print out the database name
print result[0]
print "Script completed successfully"