I use ArcGIS 10.1 without Data Interoperability extension and I want to convert some feature classes (point, lines and polygons) contained in an .mdb. I read some posts but can't convert my file.
This is the code I have (that does not work):
import arcpy
cur=arcpy.da.SearchCursor("CESTINI",["SHAPE@WKT"])
for row in cur:
x,y = row[0]
print ("{0},{1}".format(x,y))
Some one can help me?
I saw this link:
Converting geometry to WKT using ArcPy?
http://resources.arcgis.com/en/help/main/10.1/index.html#//002z0000001t000000
I try with this but the result is:
import arcpy
infc = arcpy.GetParameterAsText(0)
for row in arcpy.da.SearchCursor(infc, ["OID@", "SHAPE@WKT"]):
print("feature {0}:".format(row[0]))
partnum = 0
for part in row[1]:
print("Part {0}:".format(partnum))
for pnt in part:
if pnt:
print("{0}, {1}".format(pnt.x, pnt.y))
else
print("Interior Ring:")
partnum+=1
Parsing error SyntaxError: invalid syntax (line 9)
I tried with what you suggested but the result is:
import arcpy
shp = r"C:\Lavoro\prova_arcpy\punt.shp" with arcpy.da.SearchCursor(shp,['SHAPE@WKT']) as cur: for row in cur: print row[0]
Runtime error Traceback (most recent call last): File "", line 2, in RuntimeError: unknown geometry token 'SHAPE@WKT' What do you recommend?
Someone can explain me the real difference between JSON and GeoJSON?
I was able to use this script to save in a .txt geometry but my problem is that I save only the geometry in 2D and I do not export attributes related to geometry.
import arcpy
shp = r"C:\Lavoro\prova_arcpy\lin.shp"
f= open ("C:/Lavoro/prova_arcpy/conv.wkt","w")
with arcpy.da.SearchCursor(shp,['SHAPE@WKT']) as cur:
for row in cur:
f.write("wkt_geom "+row[0])
f.close()
How can I do?