arcgis 属性 python_读取独立点属性的ArcGIS Python工具

对不起。我意识到,要实现这一点,必须选择特性。如果选择了要素/点,则脚本只读取该点的属性。我设法写了一个剧本,我相信应该是我希望的。但问题是每当我运行插件ArcGIS时总是崩溃。。。在

我将把脚本附在这里给任何想要使用它的人….:import arcpy

import pythonaddins

import PyQt4

import sys

from PyQt4 import QtGui

from PyQt4 import QtCore

import Image

import os, sys

import webbrowser

class HyperlinkWindow(QtGui.QMainWindow, HyperlinkXAButton):

def __init__(self, win_parent = None):

#Init the base class

QtGui.QMainWindow.__init__(self, win_parent)

self.create_widgets()

def create_widgets(self):

#Widgets

self.panorama_button = QtGui.QPushButton("Panorama")

self.photo_button = QtGui.QPushButton("Photo")

#connect signal

QtCore.QObject.connect(self.panorama_button

, QtCore.SIGNAL("clicked()")

, self.on_hello_clicked)

QtCore.QObject.connect(self.photo_button

, QtCore.SIGNAL("clicked()")

, self.on_photo_clicked)

#Horizontal layout

h_box = QtGui.QHBoxLayout()

h_box.addWidget(self.panorama_button)

h_box.addWidget(self.photo_button)

#Create central widget, add layout and set

central_widget = QtGui.QWidget()

central_widget.setLayout(h_box)

self.setCentralWidget(central_widget)

def on_hello_clicked(x):

#x = "Push Me!"

if x:

arcpy.env.workspace = "MyDatabase"

featureClass = arcpy.MakeFeatureLayer_management("MyFeatureClass","q")

fld = "Panorama"

rows = arcpy.SearchCursor(featureClass)

for row in rows:

webbrowser.open (row.getValue(fld))

def on_photo_clicked(y):

if y:

arcpy.env.workspace = "MyDatabase"

featureClass = arcpy.MakeFeatureLayer_management(MyFeatureClass","u")

fld = "Photo"

rows = arcpy.SearchCursor(featureClass)

for row in rows:

webbrowser.open (row.getValue(fld))

if __name__ == "__main__":

# Someone is launching this directly

# Create the QApplication

app = QtGui.QApplication(sys.argv)

#The Main window

main_window = HyperlinkWindow()

main_window.show()

# Enter the main loop

app.exec_()

class HyperlinkButton(object):

"""Implementation for HyperlinkButton_addin.button (Button)"""

def __init__(self):

self.enabled = True

self.checked = False

def onClick(self):

self.w = HyperlinkWindow()

self.w.show()

return

或者可以使用插件工具代替按钮。。。在

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值