Data shift when returning data from FeatureLayer query in a different spatial reference

510
2
08-08-2022 05:01 AM
LanceCole
MVP Regular Contributor

Good Morning All,

I am updating a few backend scripts to ArcGIS Pro 3.0, and I am having an issue with a slight data shift in returned data from a third-party map service when requesting data to be returned in a different spatial reference. I believe the data is hosted on a 10.6 server using the WKID: 3857 (WGS 1984 Web Mercator). When I run the following code, I get back a feature class reprojected to WKID: 3734 (NAD 1983 StatePlane Ohio North (US Feet)), but there is a slight shift in the data - blue lines.

FeatureLayer(url).query(out_sr=3734, datum_transformation=None, return_true_curves=True).save(fgdb, 'data_fc1')

I experimented with omitting the datum_transformation parameter and also using many of the common WKID geographic transformation values between 3857 and 3734, but the data does not appear to shift at all. It is always down and to the right slightly.

LanceCole_0-1659958023634.png

However, if I save the data in memory using the source coordinate system and then save the data to the local GDB using FeatureClass to FeatreClass or a similar tool, as shown in the code below, the data is returned correctly.   

outSR = arcpy.SpatialReference(3734) 
FeatureLayer(url).query(return_true_curves=True).save('in_memory', 'temp')
with arcpy.EnvManager(outputCoordinateSystem=outSR, geographicTransformations=None):
    arcpy.conversion.FeatureClassToFeatureClass(r'in_memory/temp', fgdb, 'data_fc2')

Any ideas why the first code block does not work correctly?

0 Kudos
2 Replies
by Anonymous User
Not applicable

In your first code block, you have datum_transformation=None.

Are you saying that you tried a transformation value here and it still didn't work?

0 Kudos
LanceCole
MVP Regular Contributor

Correct, even when specifying a datum_transformation such as WKID 108190 (WGS_1984_(ITRF00)_To_NAD_1983) the data is still offset.  

 

FeatureLayer(url).query(out_sr=3734, datum_transformation=108190, return_true_curves=True).save(fgdb, 'data_fc1')

 

The default is "None" for the datum_transformation but I believe when using FeatureLayer().query() and a transformation is not specified, the best transformation is selected by the system even when set to None. However, FeatureClassToFeatureClass, when the transformation is set to None, does not apply one or applies a different one.   Hence the difference between the two code block results.

0 Kudos