It’s not work but when i change [${newStr}] to [105.49979221347314, 20.994954320132283, 105.49955269297402, 20.99498788234124, 105.4994677940948, 20.99493045303432, 105.49942320801233, 20.994716751005587, 105.49937204716026, 20.994504336884123, 105.49931435465778, 20.9942933859599] it work, actually [${newStr}] is geometry from geocode features
Remember that what you add is a JSON blob of configuration data, there’s no inherit parser for any internal variables you might think of. Not sure where your ${newStr} comes from, nor what’s in it? Nor what you’re trying to achieve as such?
I’m sorry, but I’m having a hard time understanding what you’re after and doing. You got a GeoJSON, you pull out some coordinates, and then convert it to a string to inject into a JSON blob for entity creation?
A quick look at your code, I think you’ve got a few misconceptions about what is a string and what is JS. You pull out the coordinates into bboxDegrees, and as long as you’re happy they are WGS84 in degrees, all you have to do is;
but i have another question, viewer.geocoder.viewModel.destinationFound = function flyToDestination(viewModel, toado) { console.log("He", toado); // copy code zoom to console.log("He", toado[0][0]); viewer.camera.flyTo({ destination: Cesium.Cartesian3.fromDegrees( toado[0][0], toado[0][1], 50, ), }); var redPolygon = viewer.entities.add({ polygon: { hierarchy: Cesium.Cartesian3.fromDegreesArray(toado.flat()), material: Cesium.Color.ORANGE.withAlpha(0.5), }, }); };
i want to remove older polygon when i create a new polygon from toado, can you help me?