Select to view content in your preferred language

Add a Feature to the ShapefileFeatureTable, how do I get it to show up on the map?

491
1
11-05-2023 01:50 AM
jokerjoker
Occasional Contributor
Here is my code, the problem now is that if the shp originally has Feature in it it will show up properly, but if the shp is empty it won't show up and has to be restarted.


shapefileFeatureTable.load().onSuccess {
val feature =
shapefileFeatureTable.createFeature(attr, lastPatchSurfaceGraphic!!.geometry)
shapefileFeatureTable.addFeature(feature).onSuccess {
val featureLayer = FeatureLayer.createWithFeatureTable(shapefileFeatureTable)
if (patchType == 1) {
featureLayer.renderer = Config.defaultPointerRender
} else {
featureLayer.renderer = Config.defaultPatchRender
}
map!!.operationalLayers.add(featureLayer)
}.onFailure {
it.printStackTrace()
ToastUtils.show("添加失败,${it.message}")
}
}
0 Kudos
1 Reply
jokerjoker
Occasional Contributor

If there was a feature in the shp, it will be shown, if not, you need to reboot

0 Kudos