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?

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

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
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

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.