Skip to content
Advertisement

Difference between wkt and str

I have a shapely Polygon. What is the difference between converting it to wkt and converting it to string:

JavaScript

Is the result always the same? And can these two be used interchangeably?

Advertisement

Answer

They are the same. Looking at the source code BaseGeometry.__str__() method returns self.wkt.

So with P.wkt or str(P) you get the same Well Known Text (WKT) representation.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement