I created an ArcMap Python add-in using ArcGIS 10.1 to open a webpage after the map is clicked. It opens the page but then ArcGIS crashes.
import arcpy
import pythonaddins
import webbrowser
class ToolClass2(object):
"""Implementation for TEST_addin.tool (Tool)"""
def __init__(self):
self.enabled = True
self.cursor=3
def onMouseDownMap(self, x, y, button, shift):
mxd=arcpy.mapping.MapDocument("current")
df = arcpy.mapping.ListDataFrames(mxd)[0]
pt=arcpy.PointGeometry(arcpy.Point(x,y))
pythonaddins.MessageBox("Long" + " " + str(x) + '\n'+ "Lat"+ " " + str(y), 'Coordinates', 0)
path = 'http://pol.pictometry.com/en-us/php/default.php?lat=' +str(x) +'&lon=' + str(y)+'&v=p&o=n&type=or&level=n'
webbrowser.open(path)
pass
No comments:
Post a Comment