-1

I have a code that should read the mouse coordinates, but it only works in ArcMap, can I somehow translate it into code for ArcGlobe, otherwise it gives an error: CreateObject cannot open map document.

def onMouseDownMap(self, x, y, button, shift):
        mxd = arcpy.mapping.MapDocument("CURRENT")
        df = mxd.activeDataFrame
        sr = df.spatialReference
        point = arcpy.Point(X=x, Y=y)
        pointGeometry = arcpy.PointGeometry(point,sr).projecntAs(arcpy.SpatialReference(4326))
        X=pointGeometry.firstPoint.X
        Y=pointGeometry.firstPoint.Y
        pythonaddins.MessageBox("Your mouse clicked at " + str(X) + " , " + str(Y),"My Coordinates:")
0

1 Answer 1

0

The arcpy.mapping module allows you to create a MapDocument object.

However, neither it or any other arcpy module will allow you to create the "GlobeDocument" that you seem to be seeking.

I think you may be better exploring ArcGIS Pro for 3D work like this.

2
  • Is there no other way to read coordinates from a mouse click so that they are displayed in lat long?
    – easyfreeze
    Nov 12, 2020 at 9:35
  • If you must use ArcGlobe then you may need to investigate ArcObjects rather than ArcPy. I don't think you can do this using ArcPy (which I use) but I don't code with ArcObjects.
    – PolyGeo
    Nov 12, 2020 at 10:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.