Select to view content in your preferred language

ArcGIS Enterprise 10.9 Datetime Handling for Dynamic Query Layer

3521
17
Jump to solution
10-13-2021 03:58 PM
cle444
by
Regular Contributor

Call for ArcGIS Enterprise experts! This is a queston about UTC and local time handling when publishing registered dynamic query layers to Enterprise.

Use case:
Publish a map image service that contains XY event layer that is based on a referenced SQL query table. The SQL query table is a simple SELECT query with a field of datetime data type. The datetime value is stored as a plain local time value without timezone and daylight saving information.

When pulishing to ArcGIS Enterprise via ArcGIS Pro Share as Web Layer, the local time zone and daylight saving option are configured in the sharing wizard.

The issue:
ArcGIS Enterprise doesn't respect the time zone and daylight saving configuration for such dynamic layers. Instead, it treats the value as UTC and convert it to local e.g. adding 13hours for NZ daylight saving time.

However, there is no issue if published from a static feature class from a file gdb. Extactly same data and same publish process.

Software:
Client - ArcGIS Pro 2.8
Server - ArcGIS Enterprise 10.9

Test: Publish a map with two layers of exactly same data, one from registered feature class and one based on a SQL query table.

1. Prepare workspace as below. Both layers are registered on the target ArcGIS Server.

cle444_0-1634164994882.png

2. Check value from local ArcGIS Pro using identify and popup. Same value 13/10/2021, 12:33pm for both layers.

cle444_1-1634165044760.png

3. Publish as map image layer.

cle444_2-1634165173060.png

configure timezone and daylight saving

cle444_3-1634165222309.png

4. Publish to Enterprise is successful. Check on map viewer from Portal.

cle444_4-1634165375946.png

Question:
With timezone and daylight saving configured during publish process, why Enterprise treats feature class layer correctly but not Event layer based on SQL query table?

For the query table and XY event layer, no matter what timezone you choose during the publish stage, NZ+12:00 or UTC or <None> or any other, Enterprise always treats it as UTC and converts it to local time, in my case, +1300.

Any ideas and insights would be much appreciated!

Thanks,
Hua

0 Kudos
2 Solutions

Accepted Solutions
TanuHoque
Esri Regular Contributor

@cle444 

I was able to reproduce this issue. As I mentioned before, it appears to me as a bug. I will log a bug for us internally.

 

As a workaround, may I suggest the following. In fact, in some case, I don't consider that as a workaround rather a solution.

  • use this sql query (or similar query depending on your underlying database flavor) to generate geometries on the fly from x,y coordinates.
    • as you know it is functionally equivalent to XY Event Layer in many cases. It is just that geometries are generated at the database level, instead of in Pro.

 

 

-- SQL Server
select 
   objectid, 
   geometry::Point(x_coord, y_coord, 3857) as shape_derived,
   date_time_field 
from myTable 
WHERE aFld = 'value'

 

 

 

Please let me if this is acceptable to you.

View solution in original post

TanuHoque
Esri Regular Contributor

Thanks @cle444 . I'm glad it worked for you.

I don't have answers for all the questions you have asked at least not at the detail level you hoped for. Let me try.

is it a Pro issue rather than the Enterprise issue?

The bug you ran into is a map service bug on the Enterprise side.

Is the 'Make XY Event Layer' a helper method that can handle different database technologies?

If I recall correctly, it is not.

For the SQL server, what you provided is how 'Make XY Event Layer' works behind the scene?

No, it doesn't. 'Make XY Event Layer' is a complete different implementation.

What is the main difference between the two layer types?

If I understands correctly, a 'XY Event Layer' reads rows from the table and generates geometries using x/y coordinates on the client side. Whereas the approach that I provided generates the geometries at the database level. Pro/map service simply gets the geometries (just like for any other query layer or feature class) and draws them.

In what scenarios you would use a query feature class layer instead of an XY Event layer, and vice versa?

Unfortunately I don't have any answer for this 😞 I need to think through, if I find any I will reply back here.

As you might have figured already, functionaly they are pretty similar. Of course one draw back for the query-layer approach is that you need to know sql and database specific spatial functions. Itonly works when your data are stored in an enterprise database. This approach wouldn't work for file gdb or shape files etc.

 

hope you will find this helpful!

View solution in original post

17 Replies
cle444
by
Regular Contributor

To extend my original question.

I am aware of a workaround to solve the popup issue by configuring a custom expression like below

cle444_0-1634166029292.png

However, it doesn't solve the problem of using other widgets e.g. the export csv from attribute table widget, the filter widget etc. Those widgets are all based on the 'converted' datetime.

Ideally, when specifying the timezone and daylight saving options during the publish process, ArcGIS should handle it as suggested.

0 Kudos
TanuHoque
Esri Regular Contributor

@cle444 

It appears a bug to me.

Would you mind give me a bit more details on the xy event layer?
Is this how you created that layer:

  • add a non-spatial table (non-registered to a geodatabase) from an enterprise database to a map.
    • that makes the source of this table a query layer
  • then you used Make XY Event Layer geoprocessing tool to create a xy event layer

 

 

0 Kudos
cle444
by
Regular Contributor

@TanuHoque That's correct. I suspect it is a bug too.

Steps for making the non-spatial query table as per below. 

cle444_0-1634176104090.png

cle444_1-1634176119801.png

Table added

cle444_2-1634176167496.png

The last step is to create layer using Make XY Event Layer geoprocesssing tool (NOT add XY point data or XY table to point), just to confirm.

cle444_0-1634181591914.png

 

0 Kudos
cle444
by
Regular Contributor

Any chance that the ESRI ArcGIS Enterprise team can comment on this, please?

0 Kudos
TanuHoque
Esri Regular Contributor

@cle444 

I was able to reproduce this issue. As I mentioned before, it appears to me as a bug. I will log a bug for us internally.

 

As a workaround, may I suggest the following. In fact, in some case, I don't consider that as a workaround rather a solution.

  • use this sql query (or similar query depending on your underlying database flavor) to generate geometries on the fly from x,y coordinates.
    • as you know it is functionally equivalent to XY Event Layer in many cases. It is just that geometries are generated at the database level, instead of in Pro.

 

 

-- SQL Server
select 
   objectid, 
   geometry::Point(x_coord, y_coord, 3857) as shape_derived,
   date_time_field 
from myTable 
WHERE aFld = 'value'

 

 

 

Please let me if this is acceptable to you.

cle444
by
Regular Contributor

@TanuHoque Tested, and I can confirm it is working for us. Much appreciated the solution.

It would be great to share a little more insight about this, e.g. is it a Pro issue rather than the Enterprise issue? Is the 'Make XY Event Layer' a helper method that can handle different database technologies? For the SQL server, what you provided is how 'Make XY Event Layer' works behind the scene?

Generating geometries on the fly at the DB level creates a layer of a query feature class. Using the 'Make XY Event Layer' in the ArcGIS Pro geoprocessing tool creates a layer of XY Event type. What is the main difference between the two layer types? In what scenarios you would use a query feature class layer instead of an XY Event layer, and vice versa?

Thanks!

0 Kudos
LSaunders
Regular Contributor

Have you had any success with doing this type of query on Oracle?  

0 Kudos
TanuHoque
Esri Regular Contributor

@LSaunders 
yes you should be able to do this type of query layer with parameters against any enterprise database.

0 Kudos
LSaunders
Regular Contributor

I haven't had any luck.  I'm having serious issues with being able to use xy event layers in a service to feed into a Dashboard that has to show up-to-date data.  A table has no refresh ability yet, and the xy event layer data throws a data access error in the indicator widget.  I previously got around this by publishing an msd in json to ArcGIS Server, but in prep for an eventual upgrade to 11, it seems that I've lost all ability to do this.  So I wanted to test with the method that you suggested, but Oracle is quite different than SQL and they have what seems to be no easy way to create geometry on the fly with sdo_geometry...I hope that I'm just missing something as I'm grasping at straws and will be forced to stay on 10.9.1 and ArcMap Runtime services for the unforeseeable future.

0 Kudos