3

I have an Oracle database table with columns for 'X' and 'Y' coordinates. Now I want to display these points in ArcMap. I can use the 'Display XY data' tool for that.

My table in the database with XY coordinates will be updated every day, so I have to update my points in ArcMap with the new coordinates, too.

Is there any way to automatically update my points in ArcMap based on my table in database?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
user28840
  • 49
  • 1
  • 6
  • 1
    Instead of relying on an event layer, you could add an SDE.ST_GEOMETRY or MDSYS.SDO_GEOMETRY column to the table, which would allow a spatial index and update of the geometry with a trigger, based on update of the X and Y columns. – Vince Nov 03 '19 at 11:50

3 Answers3

2

You can schedule arcpy to overwrite the existing featureclass/shapefile and re-create the points with Make XY Layer

be sure in the code to set arcpy.env.overwriteOutput = True

schedule to run nightly, daily, hourly whatever meets your needs

NULL.Dude
  • 2,131
  • 2
  • 14
  • 32
2

Another option would be to create a python add-in extension for this that runs (when the extension is enabled) when a certain map document is opened calling the openDocument() function which has the Make XY Layer method/logic that @Geo.Dude suggested. Each time the user opens a predefined (saved) map doc that has has a certain name (eg. map doc name "makeXY") it will check for this map name and if found will call the "make xy point" method within the openDocument() function. For a python add-in tutorial of how to create this extension see:

Creating a Python add-in application extension

Here is a class example with the map name check:

class ExtensionClass1(object):
    """Implementation for test2_addin.extension2 (Extension)"""
    def __init__(self):
        # For performance considerations, please remove all unused methods in this class.
        self.enabled = True
    def openDocument(self):
        mxd = arcpy.mapping.MapDocument("CURRENT")  
        mapPath = mxd.filePath  
        fileName = os.path.basename(mapPath)
        if fileName == 'makeXY.mxd':
            # put Make XY Layer method/logic here
artwork21
  • 35,114
  • 8
  • 66
  • 134
2

Depending on your Python abilities you can update the shape values of your points using the getValue and getPart functions inside an UpdateCursor. If you want, I can edit this answer and provide some code that could help get you part way there (although my use case is a little different from yours in that I am updating locations in one layer based on coordinates in a 2nd layer using a field that is common to both). This is also very similar to what is being done at this link Update the Location of a Point Feature and Its XY Fields

jbchurchill
  • 4,489
  • 21
  • 41