How do I transform Z coordinates between units during a feature query?

494
0
05-29-2019 06:42 PM
OrestHalustchak
New Contributor

I'm using feature table queryFeatures() where in my query parameters I set an output spatial reference system. In this case, the source feature layer has an SRS defined which also includes a vertical system. In my layer, the srs is defined like this:

"spatialReference" : {       "wkid" : 2223,        "latestWkid" : 2223,        "vcsWkid" : 115809,        "latestVcsWkid" : 115809     }

115809 gives me a vertical system where units are in International Feet.

For my query parameters, I defined a spatial reference as SpatialReference(3857, 115807). This should get Z values in meters.

I examined the wkt strings from both definitions and they looked correct, containing the expected VERTCS definitions.

However, my returned geometry does not have the Z values transformed from feet to meters even though the XY coordinates were transformed correctly.

Is there something else that I need to do to have the Z values converted from feet to meters?

Note that originally I did not have a vertical CS defined in either source or target. I added the vertical CS to both to try to get the unit conversion to work.

Currently, I'm using the C++ Qt Runtime 100.3.

Additional Notes:

I tried this using the Rest API directly with outSR as {"wkid" : 3857, "vcsWkid" : 115807} and applyVCSProjection = true. This had the same issue, no transformation of the Z value.

Then I tried using GeometryEngine::Project() directly in some test code.

    SpatialReference origSR = SpatialReference(2223, 115809);

    Point orig = Point(4266440.55, 3175667.19, 100.0, origSR);

    SpatialReference sr4326 = SpatialReference(4326, 115807);
    SpatialReference sr3857 = SpatialReference(3857, 115807);

    qDebug() << "Original point =" << orig.toJson();
    Geometry pt1 = GeometryEngine::project(orig, sr4326);
    qDebug() << "Original point to 4326 =" << pt1.toJson();
    Geometry pt2 = GeometryEngine::project(orig, sr3857);
    qDebug() << "Original point to 3857 =" << pt2.toJson();

So, this code actually transformed the Z value from feet to meters.

Original point = "{\"x\":4266440.5499999998,\"y\":3175667.1899999999,\"z\":100,\"spatialReference\":{\"wkid\":2223,\"vcsWkid\":115809}}"

Original point to 4326 = "{\"x\":-99.379177961421789,\"y\":39.044250712477478,\"z\":30.48,\"spatialReference\":{\"wkid\":4326,\"vcsWkid\":115807}}"

Original point to 3857 = "{\"x\":-11062839.486119589,\"y\":4728012.0910140648,\"z\":30.48,\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857,\"vcsWkid\":115807}}"

This leads me to believe that the low level transformation engine should handle this but that for some reason the feature query operation either is not recognizing that there are vertical coordinate systems defined or is not applying them for some reason. Am I missing something in the specification of my online layer or in my query parameters?

Regards,

Orest.

z coordinate‌

spatialreference‌

0 Kudos
0 Replies