Polygon in XSLT transformation - geography data type

Hello,
I’ve a XSLT transformation with AS:HttpRequest, which returns XML a with a polygon data in one element like this:

 <ns2:GEOMETRIE>POLYGON ((-740614.4101 -1030989.305, -741540.4803 -1030921.8493, -741540.4149 -1030920.9517, -741542.3916 -1030936.2522, -741555.0577 -1031034.2896, -741583.5733 -1031255.006, -741589.2724 -1031299.1183, -741588.2768 -1031299.2164, -740960.9255 -1031344.9745, -740959.4536 -1031345.103, -740897.274 -1031297.208, -740851.0788 -1031262.415, -740803.977 -1031228.374, -740769.1989 -1031197.8036, -740738.9305 -1031169.0874, -740729.4307 -1031158, -740720.3038 -1031147.3563, -740682.2743 -1031090.7, -740643.6627 -1031028.611, -740623.6778 -1031000.671, -740614.4101 -1030989.305))</ns2:GEOMETRIE>
            

Is there any way I can pass this polygon value to attribute/element in correct format so it is saved in SQL database column with geography data type? I know there is an undocumented function AS:PointFromJtsk, which creates a point. Is there similar function for polygons?

No there’s no such function in our codebase.

@washi
Approximately how much would it cost to implement this feature?

The estimated effort is between 1-4 hours.

On the other hand it should be enough to take the string and store it in the geography column. It is supposed to work out of box. The format looks valid to me.

The input polygon coordinates are in JTSK format. So as a first step it is necessary to convert it to WGS-84 format. So it would be better to create XSL function PolygonFromJtsk - you can reuse Origam.Geo functions. There is a web, where you can test the conversion - https://martin.hinner.info/geo/.
When you insert this coordinates

-740614.4101 -1030989.305
-741540.4803 -1030921.8493
-741540.4149 -1030920.9517
-741542.3916 -1030936.2522
-741555.0577 -1031034.2896
-741583.5733 -1031255.006
-741589.2724 -1031299.1183
-741588.2768 -1031299.2164
-740960.9255 -1031344.9745
-740959.4536 -1031345.103
-740897.274 -1031297.208
-740851.0788 -1031262.415
-740803.977 -1031228.374
-740769.1989 -1031197.8036
-740738.9305 -1031169.0874
-740729.4307 -1031158
-740720.3038 -1031147.3563
-740682.2743 -1031090.7
-740643.6627 -1031028.611
-740623.6778 -1031000.671
-740614.4101 -1030989.305

you should see the following polygon on the map:

@washi Our customer agrees with the estimated effort to implement this feature. Please provide me with an estimated implementation date - we are actually in a time pressure from a customer.

Thank you.

This function would be available with 25.5 release, that should be available in the week starting from 5th of May. If this would be an issue, there is still possibility to create separate library that is not dependent on Origam release cycle. It would mean some extra overhead (1-4 hrs) and it wouldn’t be part of the main Origam relaease. It would also have more complicated deployment. You would need to deploy the extra dll and also the extra model package with the definition of the namespace.

Let’s do it standard way and wait for 25.5 release.

I’m confused by the output from S-JTSK->WGS84. After I input the coordinate pairs I get a table with six columns… How exactly should I map that to the polygon coordinates for the given example?

POLYGON ((-740614.4101 -1030989.305, -741540.4803 -1030921.8493, -741540.4149 -1030920.9517, -741542.3916 -1030936.2522, -741555.0577 -1031034.2896, -741583.5733 -1031255.006, -741589.2724 -1031299.1183, -741588.2768 -1031299.2164, -740960.9255 -1031344.9745, -740959.4536 -1031345.103, -740897.274 -1031297.208, -740851.0788 -1031262.415, -740803.977 -1031228.374, -740769.1989 -1031197.8036, -740738.9305 -1031169.0874, -740729.4307 -1031158, -740720.3038 -1031147.3563, -740682.2743 -1031090.7, -740643.6627 -1031028.611, -740623.6778 -1031000.671, -740614.4101 -1030989.305))

Thanks

The coordinate transformation can be verified here as well.

@washi Thank you! Could you please push it to the master, so we can test it?