2 Replies Latest reply on Jul 28, 2010 7:29 AM by bharold-esristaff

    Convert feature to wkt

    bkoehl
      Hey there,

      I have a feature inside a gdb.
      For another project I need this feature as WKT.
      Is there a solution for doing this with Python?

      ben
        • Re: Convert feature to wkt
          bkoehl
          I found an additional package for python called shapely.
          It looks as if it could be helpful.
          has anyone made any experiences with it?

          ben
          • Re: Convert feature to wkt
            bharold-esristaff
            Hello Benjamin

            shapely together with the geojson module should get there for you.  Why geojson?
            You can convert arcpy geometry objects to and from GeoJSON representations:

            >>> arcpy.PointGeometry(arcpy.Point(5,5)).__geo_interface__
            {'coordinates': (5.0001220703125, 5.0001220703125), 'type': 'Point'}

            >>> arcpy.AsShape({'coordinates': (5.0001220703125, 5.0001220703125), 'type': 'Point'})
            <PointGeometry object at 0x14599fd0[0x145c2560]>

            Regards