1

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

import shapely.wkt

P = shapely.wkt.loads('POLYGON ((8.0 3.0, 8.3 3.3, 8.3 3.0, 8.0
3.0))')

print(P.wkt)

print(str(P))

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

GStav
  • 1,066
  • 12
  • 20

1 Answers1

1

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.

buran
  • 13,682
  • 10
  • 36
  • 61