dear cesium team,
i added a kml datasource that containes only polylines, when i zoom in to the line it disappears suddenly.
i removed the kml then i added a polyline as entity, same result, the polyline disappears on zooming in.
on zooming out it appears again.
after many trials, i noticed that if the polyline contains many and many points it does not disappear. but if it has 4 or 5 points it disappears.
can you help me here?
Welcome to the Cesium community!
It sounds like you may need to clamp the line to the ground. See the discussion in this thread: Label is gone when it is zoomed out
Thank you very much.
i have put this property already.
clampToGround : true, and the lines are clamping, but the problem is not solved.
Can you reproduce the issue in a Sandcastle? See: How to share custom Sandcastle examples.
something weird is happening here,
the problem is with the tessellate tag,
i created a kml with 2 lines, both clampToGround is true.
first line is tessellate true, and second one is tessellate false.
when i add the kml from viewer,.datasources.add(datasourceKML)
the second line appears immediately and it does not disappear when zooming in, but the first line which has tesselate true, it took time to appear on the globe, then when i zoom in it disappear.
this video will show you what is happening with me.
1 kml contains 2 lines with tessellate true and clampedToGround true.
That does look like it could be a bug. Can you put together a code example for us to reproduce this? You can share your KML by uploading it to your Cesium ion account and using it in a code example.
line.kml (1.3 KB)
i attached the kml file.
and this is the code :
var kmlds = KmlDataSource.load(‘PathToKML’,{
camera : viewer.scene.camera,
canvas: viewer.scene.canvas,
clampToGround: true});
viewer.dataSources.add(kmlds);
I’m not able to reproduce this. Here’s my Sandcastle.
You can modify this to move the camera to the spot where this issue happens if you can reproduce it. Use the “get camera” button and copy the output into the viewer.camera.flyTo
line.
i found in cesium issues on github an issue considering polylines clam to ground with kml.
and you answered in that issue that the problem was with the tessellate tag. also in that issue you gave a link to a sandcastle. i entered the link and i have put my kml instead of yours. but i kept the same coordinates of your kml(only the coordinates) but i removed heights.
this is the code. just copy it to the sandcastle example and run it:
var viewer = new Cesium.Viewer('cesiumContainer', {
terrainProvider: Cesium.createWorldTerrain()
});
var options = {
camera : viewer.scene.camera,
canvas : viewer.scene.canvas,
clampToGround: true
};
var kmlContent = `<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Style id="0LineStyle">
<LineStyle>
<color>ff00ff00</color>
<width>3</width>
</LineStyle>
</Style>
<Placemark id="Line0">
<name>aaa</name>
<styleUrl>#0LineStyle</styleUrl>
<LineString>
<tessellate>true</tessellate>
<altitudeMode>clampToGround</altitudeMode>
<coordinates>-112.2550785337791,36.07954952145647
-112.2549277039738,36.08117083492122
-112.2552505069063,36.08260761307279
-112.2564540158376,36.08395660588506
-112.2580238976449,36.08511401044813
-112.2595218489022,36.08584355239394
-112.2608216347552,36.08612634548589
-112.262073428656,36.08626019085147
-112.2633204928495,36.08621519860091
-112.2644963846444,36.08627897945274
-112.2656969554589,36.08649599090644 </coordinates>
</LineString>
</Placemark>
</Document>
</kml>`;
var parser = new DOMParser();
var kmlDoc = parser.parseFromString(kmlContent, "text/xml");
viewer.zoomTo(viewer.dataSources.add(Cesium.KmlDataSource.load(kmlDoc, options)));
this is the link : link to sandCastle
please try it and you will see what i am talking about.
you cannot see the polyline unless you zoom out. if you zoom in a lot the polyline will disappear.
dear @omar, still didn’t found any solution?
Hi Marto,
I looked at the Sandcastle you shared and tried zooming in but the line didn’t disappear for me.
hi Dzung,
yes because you did not caopyy and paste the code that i posted it.
please try this one
this sandcastle will show the problem
you have to zoom out a lot so you can see the line.
Hi Marto,
I’m still unable to reproduce the issue. Here is what I see with the new Sandcastle you included:
If I’m missing anything please let me know.
Try This… Placemarks have problems.
var viewer = new Cesium.Viewer(“cesiumContainer”,
{terrainProvider : Cesium.createWorldTerrain(),
});
var options = {
camera: viewer.scene.camera,
canvas: viewer.scene.canvas,
};
Sandcastle.addToolbarMenu(
[
{
text: “KML - Global Science Facilities”,
onselect: function () {
viewer.camera.flyHome(0);
viewer.dataSources.add(
Cesium.KmlDataSource.load(
“…/SampleData/kml/facilities/facilities.kml”,
options
)
);
},
},
{
text: “KMZ with embedded data - GDP per capita”,
onselect: function () {
viewer.camera.flyHome(0);
viewer.dataSources.add(
Cesium.KmlDataSource.load(
“…/SampleData/kml/gdpPerCapita2008.kmz”,
options
)
);
},
},
{
text: “gx KML extensions - Bike Ride”,
onselect: function () {
viewer.dataSources
.add(
Cesium.KmlDataSource.load(
“…/SampleData/kml/bikeRide.kml”,
options
)
)
.then(function (dataSource) {
viewer.clock.shouldAnimate = false;
var rider = dataSource.entities.getById(“tour”);
viewer.flyTo(rider).then(function () {
viewer.trackedEntity = rider;
viewer.selectedEntity = viewer.trackedEntity;
viewer.clock.multiplier = 30;
viewer.clock.shouldAnimate = true;
});
});
},
},
],
“toolbar”
);
Sandcastle.reset = function () {
viewer.dataSources.removeAll();
viewer.clock.clockRange = Cesium.ClockRange.UNBOUNDED;
viewer.clock.clockStep = Cesium.ClockStep.SYSTEM_CLOCK;
};
Try This… Placemarks have problems.
var viewer = new Cesium.Viewer(“cesiumContainer”,
{terrainProvider : Cesium.createWorldTerrain(),
});
var options = {
camera: viewer.scene.camera,
canvas: viewer.scene.canvas,
};
Sandcastle.addToolbarMenu(
[
{
text: “KML - Global Science Facilities”,
onselect: function () {
viewer.camera.flyHome(0);
viewer.dataSources.add(
Cesium.KmlDataSource.load(
“…/SampleData/kml/facilities/facilities.kml”,
options
)
);
},
},
{
text: “KMZ with embedded data - GDP per capita”,
onselect: function () {
viewer.camera.flyHome(0);
viewer.dataSources.add(
Cesium.KmlDataSource.load(
“…/SampleData/kml/gdpPerCapita2008.kmz”,
options
)
);
},
},
{
text: “gx KML extensions - Bike Ride”,
onselect: function () {
viewer.dataSources
.add(
Cesium.KmlDataSource.load(
“…/SampleData/kml/bikeRide.kml”,
options
)
)
.then(function (dataSource) {
viewer.clock.shouldAnimate = false;
var rider = dataSource.entities.getById(“tour”);
viewer.flyTo(rider).then(function () {
viewer.trackedEntity = rider;
viewer.selectedEntity = viewer.trackedEntity;
viewer.clock.multiplier = 30;
viewer.clock.shouldAnimate = true;
});
});
},
},
],
“toolbar”
);
Sandcastle.reset = function () {
viewer.dataSources.removeAll();
viewer.clock.clockRange = Cesium.ClockRange.UNBOUNDED;
viewer.clock.clockStep = Cesium.ClockStep.SYSTEM_CLOCK;
};
Line around Penn and other Icons disappear as you zoom in.
var viewer = new Cesium.Viewer(“cesiumContainer”,
{terrainProvider : Cesium.createWorldTerrain()});
Sandcastle.addDefaultToolbarButton(“Satellites”, function () {
viewer.dataSources.add(
Cesium.CzmlDataSource.load("…/SampleData/simple.czml")
);
viewer.camera.flyHome(0);
});
Sandcastle.addToolbarButton(“Vehicle”, function () {
viewer.dataSources.add(
Cesium.CzmlDataSource.load("…/SampleData/Vehicle.czml")
);
viewer.scene.camera.setView({
destination: Cesium.Cartesian3.fromDegrees(-116.52, 35.02, 95000),
orientation: {
heading: 6,
},
});
});
Sandcastle.reset = function () {
viewer.dataSources.removeAll();
};
Hi Sam,
Not sure what you mean by suggestion… but showing you all a problem that exists with KML/CZML 3D map. I am trying to show my customer a 3D map with KML points but they disappear as I zoom in. Can you help ?
Thanks
Carlo
Apologies, it seemed to me like you were giving @marto_salata a code snippet to try. Can you please share a sandcastle demo that showcases the error that you are seeing? I am curious to see how you are initializing the KML data.
-Sam