Converting shape to kml, coordinates mix up


#1

I’m using the trial version in order to verify, that aspose.gis meets our needs.
I have problems converting as shape file into a kml file. The conversion works, but I think there is somethinw worng with the coordinates, that are written to the kml file.
To convert I did:

VectorLayer.Convert(ShapeFilename, Drivers.Shapefile, kmlpath, Drivers.Kml);

In the kml file the coordinates entry looks like:

13.8462224763658,51.6104028138417,0 13.8458616656399,51.6108146062704,0 13.8458614080007,51.6108247646665,0 …

Why do some values end with “,0” ? This is not correct, I think or am I wrong?
The coordianates itself are different from what I get from other products and they are different from what I get, when I use the Transform-Method of aspose.gis like this:
(I just noticed, that I missed some lines, when copying my code):
Edit:

      var coord= SpatialReferenceSystem.CreateFromEpsg(25833);
      var latLong = SpatialReferenceSystem.CreateFromEpsg(4326); 
      var transformation = coord.CreateTransformationTo(latLong);
var coordPoint = new Aspose.Gis.Geometries.Point(420109.34, 5718338.08); 
var geoPoint = transformation.Transform(coordPoint) as Aspose.Gis.Geometries.Point;
// Write result 
WriteLog("Longitude: " + geoPoint.X); 
WriteLog("Latitude: " + geoPoint.Y);

Here the output is:

Longitude: 13,8462415352727
Latitude: 51,6104030011617

The coordinates are different from the highlighted one from above.

Is here something wrong or did I something wrong?
Thanks in advance.
Regards.
Alex

[attachment removed]


#2

@gustavg

Thank you for your interest in the Aspose.GIS product!

I will ask the developers to examine your issue and we will give you an answer on Monday. Thanks.


#3

@gustavg,

Zeros at the end of coordinates are altitudes. Aspose.GIS adds altitudes (or Z coordinates) during transformation from UTM to WGS84. Even though they are not required in your case, they are perfectly valid in KML files and should not cause any issues.

Regards coordinates. KML specification requires coordinates of polygons to be in counter-clockwise order, while they are in clockwise order in the shapefile. Aspose.GIS ensures correct winding order, so it reverts coordinates order during the conversion. So, the coordinate “13.8462415352727,51.6104030011617” is present in the output KML file, but it’s last coordinate rather then the first one. This behaviour should not cause any issues.
We’ve tested how various GIS programs open the output KML and it looks O.K. Moreover, polygons from the output KML file overlap perfectly with polygons from the input shapefile, so I believe that conversion works fine and output coordinates are correct.

Hope it helps!


#4

That’s good know.

Thanks a lot.