Groovy script to update a geometry in SDE
import com.esri.sde.sdk.client.*
layer = "jon_test_1"
connection = new SeConnection("mofdevsde01", 5151, "", "scott", "tiger")
try {
shape = new SeShape(new SeLayer(connection, layer, "geometry") .getCoordRef())
shape .generatePoint(1, new com .esri .sde .sdk .client .SDEPoint[]{new SDEPoint(1000000 .0, 1000000 .0)})
update = new SeUpdate(connection)
try {
update .toTable(layer, new String[]{"geometry"}, "x = 'bloo'")
destinationRow = update .getRowToSet()
destinationRow .setShape(0, shape)
update .execute()
}
finally {
update .close()
}
connection .commitTransaction()
} finally {
connection .close()
}
layer = "jon_test_1"
connection = new SeConnection("mofdevsde01", 5151, "", "scott", "tiger")
try {
shape = new SeShape(new SeLayer(connection, layer, "geometry") .getCoordRef())
shape .generatePoint(1, new com .esri .sde .sdk .client .SDEPoint[]{new SDEPoint(1000000 .0, 1000000 .0)})
update = new SeUpdate(connection)
try {
update .toTable(layer, new String[]{"geometry"}, "x = 'bloo'")
destinationRow = update .getRowToSet()
destinationRow .setShape(0, shape)
update .execute()
}
finally {
update .close()
}
connection .commitTransaction()
} finally {
connection .close()
}
0 Comments:
Post a Comment
<< Home