insert records

1188
1
12-20-2016 12:27 AM
jayasudha
New Contributor III

The following code returns records from polygon shape file. The shape is returned as object.
How this object can be converted to array or list of coordinates so that it can be inserted into
oracle spatial table in MDSYS.SDO_ORDINATE_ARRAY


import arcpy
fc = "C:\\roads.shp"
fields = ["idnumber", "shape@"]

with arcpy.da.SearchCursor(fc, fields) as cursor:
for row in cursor:
print ("{0},{1}".format(row[0], row[1]))

pms,<geoprocessing describe geometry object object at 0x028D1FC0>
xrz,<geoprocessing describe geometry object object at 0x028D4100>
avx,<geoprocessing describe geometry object object at 0x028D1FC0>
cbm,<geoprocessing describe geometry object object at 0x028D4100>

0 Kudos
1 Reply
JoshuaBixby
MVP Esteemed Contributor

The ArcPy Geometry class supports several data interchange formats (WKT, WKB, JSON/GeoJSON), and the SDO_UTIL Package also works with some of those formats.  Instead of trying to dump coordinates and build arrays, I would explore dumping WKT/WKB and importing it that way into Oracle.

0 Kudos