ArcGIS for python (arcpy)

Source: Internet
Author: User

A gp tool needs to be released today, but some logic needs to be processed. So I plan to write a py script and put it in the model.

I have studied the py library of arcpy ArcGIS.

First, open the IDE of Py

Introduce arcpy Library

Test the call permit settings to allow access to the spatial database.

Note that SDE. Sde is the service name you configured in catalog.

Py is case sensitive.

 

The following describes how to set up the arcpy environment env for a spatial database.

Then perform operations through several interface methods

The main point is to directly write the absolute path to the local file path when setting the workspace.

If you want to connect to SDE, you must specify the location of the. Sde file.

(4) SDE is configured in catalog, so it points to the SDE under the database connections path. the SDE file database connections is the default storage of ArcGIS. you can also create a path for the SDE connection file. SDE File

Here, I picked up a section of my brother-in-law.CodeTransfer door http://www.cnblogs.com/mingkof/archive/2013/02/04/2891525.html

#. Sde file path
Sdefilepath_sde = sdefilepath +"\\"+ Sdefilename +". Sde"
IfOS. Path. isfile (sdefilepath_sde ):
OS. Remove (sdefilepath_sde)
Print 'Deleting an existing SDE file ends.'

# Create an SDE File
Arcpy. createarcsdeconnectionfile_management (sdefilepath, sdefilename, sdeserver, sdeservice, "" , " Database_auth " ,
Sdeusername, sdepassword, " Save_username " , " SDE. Default " , " Save_version " )
Print ' SDE File Created '

 

Figure 4

Come here first

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.