Select to view content in your preferred language

Dynamically Updated Coordinates

2606
6
04-05-2017 09:10 AM
by Anonymous User
Not applicable

I'm trying to figure out if you can configure a feature class stored in an SQL geodatabase to dynamically update latitude and longitude values based on current locations rather than the last time the values were manually calculated.  I found one resource that referenced a Dynamic Update XY and Toggle Automatic Update XY tools, but they seem to be specific to the Aviation solutions in ArcGIS, which we do not use. 

Defining settings to update X,Y coordinates and geometry dynamically—Help | ArcGIS Desktop 

Is there a way to configure something very similar to this in the normal ArcMap environment when referencing a point feature class stored in an SQL geodatabase?

0 Kudos
6 Replies
George_Thompson
Esri Notable Contributor

Sounds like you may need to create a SQL Server database trigger to complete that task or schedule a Python script to run at a certain interval.

You also may want to move this question to another group like Geodatabase‌ and not GeoNet Help. Please see https://community.esri.com/docs/DOC-2258 for more information.

--- George T.
by Anonymous User
Not applicable

I'll have to look at the SQL triggers.  I'm not very server or SQL savvy, so that stuff is beyond my grasp as of right now.

I wasn't real sure what the appropriate location would be.  I'll take a look at the link that you provided and move the thread to the Geodatabase group. 

Thanks!

0 Kudos
ThomasColson
MVP Frequent Contributor
CREATE TRIGGER [dbo].[LAT_LON]  
ON  [dbo].[SOME_FEATURE_CLASS]
after INSERT,UPDATE NOT FOR REPLICATION

AS   
BEGIN  
  SET NOCOUNT ON;  

  UPDATE p SET  
         SHAPE = CASE WHEN i.SHAPE IS NOT NULL   
        THEN p.SHAPE ELSE Geography::STPointFromText('POINT('  
          + CAST(p.LON AS VARCHAR(20)) + ' '   
          + CAST(p.LAT AS VARCHAR(20)) + ')', 4269) END,  
      LON = CASE WHEN p.SHAPE IS NULL THEN p.LON ELSE p.SHAPE.Long END,  
      LAT = CASE WHEN p.SHAPE IS NULL THEN p.LAT ELSE p.SHAPE.Lat END
END


by Anonymous User
Not applicable

Thomas, thank you for this example.  I appreciate your recommendation.

0 Kudos
AbdullahAnter
Honored Contributor

Same question was been asked in this link:

VBA Code For Calculate Field Automatically and the correct answer by Ben Nadler Employee  is  Attribute Assistant add-in

0 Kudos
by Anonymous User
Not applicable

Abdullah, thank you for this resource.  I believe this will be our best option.  I'll have to review situations where users "load" data into the feature classes, and in our Online environment, but this will definitely help in our desktop editing environment. 

0 Kudos