-2

Work in ArcGlobe and I want to calculate the coordinates of the globe latitude and longitude, but the coordinates from the mouse click is read from the screen, not the globe, because when I clicked on the corner of the screen it shows me the coordinates 0,0.

How can I make it so that coordinates read with globe and not with the screen?

import arcpy
import pythonaddins

class ToolClass2(object):
    """Implementation for coord_addin.tool (Tool)"""
    def __init__(self):
        self.enabled = True
        self.shape = "NONE" # Can set to "Line", "Circle" or "Rectangle" for interactive shape drawing and to activate the onLine/Polygon/Circle event sinks.
    def onMouseDown(self, x, y, button, shift):
        pythonaddins.MessageBox("Long" + " " + str(x) + '\n'+ "Lat"+ " " + str(y), 'Coordinates', 0)
        pass
    def onMouseDownMap(self, x, y, button, shift):
        #pythonaddins.MessageBox("Long" + " " + str(x) + '\n'+ "Lat"+ " " + str(y), 'Coordinates', 0)
        pass
    def onMouseUp(self, x, y, button, shift):
        pass
    def onMouseUpMap(self, x, y, button, shift):
        pass
    def onMouseMove(self, x, y, button, shift):
        pass
    def onMouseMoveMap(self, x, y, button, shift):
        pass
    def onDblClick(self):
        pass
    def onKeyDown(self, keycode, shift):
        pass
    def onKeyUp(self, keycode, shift):
        pass
    def deactivate(self):
        pass
    def onCircle(self, circle_geometry):
        pass
    def onLine(self, line_geometry):
        pass
    def onRectangle(self, rectangle_geometry):
        pass
 
8
  • Does it give the same results as onMouseDown...? desktop.arcgis.com/en/arcmap/latest/analyze/python-addins/…. What did you set as the coordinate system?
    – Dave X
    Nov 9 '20 at 16:31
  • no, I haven't tried onMouseDown, I'll try it now and tell you the results, I didn't set the coordinate system, it probably costs standard.
    – easyfreeze
    Nov 9 '20 at 16:40
  • I used onMouseDown and the same results are output
    – easyfreeze
    Nov 9 '20 at 16:45
  • If that was the case you probably would have noticed but could it be a missing decimal indicator or space ? (in arcglobe when I select "Degre decimal minute" as coordinate format the output look like that : 2 19,53 48 51,33 for a point near Paris France, with just a space between the degre and the decimal minute)
    – J.R
    Nov 9 '20 at 17:15
  • how to change coordinates in the add-in itself?
    – easyfreeze
    Nov 9 '20 at 18:06
1

Subsequent to this question you have asked what is effectively the same question multiple times as:

That question seems to distill to how to obtain 3D coordinates (or at least their X,Y values) using a Python AddIn in ArcGlobe.

Unfortunately, you are very limited in what you can do using Python AddIns in ArcGlobe because they seem to be designed with ArcMap principally in mind and I do not think what you are trying to do is possible using ArcPy with ArcGlobe.

If trying to meet your requirements using ArcGlobe is mandatory then you could try using ArcObjects instead. However, I claim no ArcObjects expertise so I think that will be difficult, even if possible.

If you are not planning to look at ArcObjects then I think you should switch your attention from ArcGlobe to the Global Scene view of ArcGIS Pro.

2
  • I'll try to go to ArcGIS Pro, I wanted to ask in advance if there are similar add-In like in desktop or a similar analog, so that I can also find out the results of the mouse click coordinates?
    – easyfreeze
    Feb 11 at 8:19
  • @easyfreeze that should be a new question but it's previously been asked as gis.stackexchange.com/questions/130220/…
    – PolyGeo
    Feb 11 at 9:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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