openlayers / ol-cesium

OpenLayers - Cesium integration
http://openlayers.org/ol-cesium/
BSD 2-Clause "Simplified" License
1k stars 328 forks source link

KML Layers not being displayed when loaded while in 3D view #619

Open dandoteverest opened 6 years ago

dandoteverest commented 6 years ago

When I load a KML source when in 2D mode, the file data displays fine if I switch back & forth between 2D and 3D. However, when I load the file while in 3D mode, it is not displayed until I return to 2D. Switching back to 3D again, it is displayed correctly.

I'm using OLCesium v1.37, mainly because I cannot get the latest version to work (issues have already been posted about this). I can 'fake' it by:

  1. detecting if I'm in 3D mode
  2. if I am, switch to 2D and load the KML
  3. return to 3D upon successful load if I was in 3D at the start.

However, that seems like a bit of a hack. You can see my fiddle at: https://fiddle.sencha.com/#fiddle/2ji3

Basically, select 'Load KML', then 'Change View'. You will see the KML data displayed correctly in both views. Then, select 'Clear Layers', and repeat the previous 2 steps in reverse order (e.g., Change View, then Load KML). The KML data will NOT display until to return to 2D ('Change View'). From there on, it works as expected.

gberaudo commented 6 years ago

In stacked mode the OL map is not rendered. As a consequence the KML is not downloaded and OL-Cesium has nothing to transform.

You may try to call the loadFeatures method of the KML vector source with an extent the one of the projection), a resolution (the minimal one for your view) and the projection of the view.

SCKgithub commented 6 years ago

But I am facing an issue where, I load KML in openlayers, but it doesn't get displayed on Cesium when I changeview

SCKgithub commented 6 years ago

I am still not able to get the installation of packages right. Can you please provide detailed procedure. Like download and install ol-cesium Copy ol 5 to ol directory etc....

When I provide all required library, the map doesn't appear from examples. I tried kml.html and kml.js No errors

gberaudo commented 6 years ago

Currently there are 2 possibilities:

SCKgithub commented 6 years ago

I am using ol-cesium in Angular 6 framework.

I am able to get map and all functionalities, but the problem is when I load kml on Openlayers, and when I switch to 3D view on Cesium, I can see the globe but not the kml file Please help

On Thu, Aug 30, 2018 at 12:14 PM gberaudo notifications@github.com wrote:

Currently there are 2 possibilities:

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/openlayers/ol-cesium/issues/619#issuecomment-417207715, or mute the thread https://github.com/notifications/unsubscribe-auth/AkJOkPZAoklPgFMohKzbKOzIQsd5ecp5ks5uV4nJgaJpZM4Vprv0 .

SCKgithub commented 6 years ago

since I am not using the webpack, I was using olcesium.js from src/olcs import olcesium from 'ol-cesium/src/olcs/olcesium'; Then the project runs well in OL but the kml is not displayed in Cesium

But if I use olcesium.js from the dist directory, it throws following error :

AppComponent.html:3 ERROR TypeError: ol_cesium_dist_olcesiumWEBPACK_IMPORTED_MODULE1default.a is not a constructor at MapComponent.push../src/app/map/map.component.ts.MapComponent.ngOnInit (map.component.ts:72) at checkAndUpdateDirectiveInline (core.js:9250) at checkAndUpdateNodeInline (core.js:10514) at checkAndUpdateNode (core.js:10476) at debugCheckAndUpdateNode (core.js:11109) at debugCheckDirectivesFn (core.js:11069) at Object.eval [as updateDirectives] (AppComponent.html:4) at Object.debugUpdateDirectives [as updateDirectives] (core.js:11061) at checkAndUpdateView (core.js:10458) at callViewAction (core.js:10699) View_AppComponent_0 @ AppComponent.html:3 proxyClass @ compiler.js:10168 push../nodemodules/@angular/core/fesm5/core.js.DebugContext.logError @ core.js:11313 push../node_modules/@angular/core/fesm5/core.js.ErrorHandler.handleError @ core.js:1719 (anonymous) @ core.js:4588 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:388 push../node_modules/zone.js/dist/zone.js.Zone.run @ zone.js:138 push../node_modules/@angular/core/fesm5/core.js.NgZone.runOutsideAngular @ core.js:3783 push../node_modules/@angular/core/fesm5/core.js.ApplicationRef.tick @ core.js:4588 push../node_modules/@angular/core/fesm5/core.js.ApplicationRef._loadComponent @ core.js:4615 push../node_modules/@angular/core/fesm5/core.js.ApplicationRef.bootstrap @ core.js:4557 (anonymous) @ core.js:4358 push../node_modules/@angular/core/fesm5/core.js.PlatformRef._moduleDoBootstrap @ core.js:4358 (anonymous) @ core.js:4324 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:388 onInvoke @ core.js:3824 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:387 push../node_modules/zone.js/dist/zone.js.Zone.run @ zone.js:138 (anonymous) @ zone.js:872 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:421 onInvokeTask @ core.js:3815 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:420 push../node_modules/zone.js/dist/zone.js.Zone.runTask @ zone.js:188 drainMicroTaskQueue @ zone.js:595 Promise.then (async) scheduleMicroTask @ zone.js:578 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ zone.js:410 push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask @ zone.js:232 push../node_modules/zone.js/dist/zone.js.Zone.scheduleMicroTask @ zone.js:252 scheduleResolveOrReject @ zone.js:862 ZoneAwarePromise.then @ zone.js:962 push../node_modules/@angular/core/fesm5/core.js.PlatformRef.bootstrapModule @ core.js:4353 ./src/main.ts @ main.ts:11 webpack_require @ bootstrap:76 0 @ main.ts:12 webpack_require @ bootstrap:76 checkDeferredModules @ bootstrap:43 webpackJsonpCallback @ bootstrap:30 (anonymous) @ main.js:1 15:19:16.208 AppComponent.html:3 ERROR CONTEXT DebugContext_ {view: {…}, nodeIndex: 0, nodeDef: {…}, elDef: {…}, elView: {…}}

On Thu, Aug 30, 2018 at 12:14 PM gberaudo notifications@github.com wrote:

Currently there are 2 possibilities:

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/openlayers/ol-cesium/issues/619#issuecomment-417207715, or mute the thread https://github.com/notifications/unsubscribe-auth/AkJOkPZAoklPgFMohKzbKOzIQsd5ecp5ks5uV4nJgaJpZM4Vprv0 .

gberaudo commented 6 years ago

From your description, since you have no problem with the other OL-Cesium features, then it must be an issue in the KML support in OL-Cesium and not with the packaging.

SCKgithub commented 6 years ago

Yes you are right. But the whole purpose of ol-cesium will be defeated if I can't see any vectors rendered on openlayers not visible in Cesium. We actually want to select 2 points and render the result which is a KML file or a gif/png

Can you please check the issue on why the drawn point/line /Polygon and KML doesn't get rendered in Cesium when we switch from 2D to 3D

On Thu, Aug 30, 2018 at 4:40 PM gberaudo notifications@github.com wrote:

From your description, since you have no problem with the other OL-Cesium features, then it must be an issue in the KML support in OL-Cesium and not with the packaging.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/openlayers/ol-cesium/issues/619#issuecomment-417281655, or mute the thread https://github.com/notifications/unsubscribe-auth/AkJOkOLzU4bkpYDSPm-zh0yYTfoOojYUks5uV8gMgaJpZM4Vprv0 .

SCKgithub commented 6 years ago

Is it to do something with vector and raster synchronization ?

On Thu, Aug 30, 2018 at 6:07 PM SOWJANYA C K sowjck@gmail.com wrote:

Yes you are right. But the whole purpose of ol-cesium will be defeated if I can't see any vectors rendered on openlayers not visible in Cesium. We actually want to select 2 points and render the result which is a KML file or a gif/png

Can you please check the issue on why the drawn point/line /Polygon and KML doesn't get rendered in Cesium when we switch from 2D to 3D

On Thu, Aug 30, 2018 at 4:40 PM gberaudo notifications@github.com wrote:

From your description, since you have no problem with the other OL-Cesium features, then it must be an issue in the KML support in OL-Cesium and not with the packaging.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/openlayers/ol-cesium/issues/619#issuecomment-417281655, or mute the thread https://github.com/notifications/unsubscribe-auth/AkJOkOLzU4bkpYDSPm-zh0yYTfoOojYUks5uV8gMgaJpZM4Vprv0 .

SCKgithub commented 6 years ago

import { Component, OnInit } from '@angular/core'; import olcesium from 'ol-cesium/src/olcs/OLCesium'; import map from 'ol-cesium/dist/node_modules/ol/Map'; import view from 'ol-cesium/dist/node_modules/ol/View'; import OSM from 'ol-cesium/dist/node_modules/ol/source/OSM'; import tile from 'ol-cesium/dist/node_modules/ol/layer/Tile'; import { MapserviceService } from '../utility-services/mapservice.service'; import {defaults} from 'ol-cesium/dist/node_modules/ol/control'; import { Vector as VectorLayer } from 'ol-cesium/dist/node_modules/ol/layer.js'; import { Vector as VectorSource } from 'ol-cesium/dist/node_modules/ol/source.js';

Is the location from where I import right ? We are using angular 6

On Thu, Aug 30, 2018 at 6:09 PM SOWJANYA C K sowjck@gmail.com wrote:

Is it to do something with vector and raster synchronization ?

On Thu, Aug 30, 2018 at 6:07 PM SOWJANYA C K sowjck@gmail.com wrote:

Yes you are right. But the whole purpose of ol-cesium will be defeated if I can't see any vectors rendered on openlayers not visible in Cesium. We actually want to select 2 points and render the result which is a KML file or a gif/png

Can you please check the issue on why the drawn point/line /Polygon and KML doesn't get rendered in Cesium when we switch from 2D to 3D

On Thu, Aug 30, 2018 at 4:40 PM gberaudo notifications@github.com wrote:

From your description, since you have no problem with the other OL-Cesium features, then it must be an issue in the KML support in OL-Cesium and not with the packaging.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/openlayers/ol-cesium/issues/619#issuecomment-417281655, or mute the thread https://github.com/notifications/unsubscribe-auth/AkJOkOLzU4bkpYDSPm-zh0yYTfoOojYUks5uV8gMgaJpZM4Vprv0 .

SCKgithub commented 6 years ago

Can I expect resolution to this in your coming versions ? We had done good progress with ol-cesium 1.37, but with ol-cesium 2.2, we are facing lot of issues on Cesium 3D rendering Request your kind help.

On Thu, Aug 30, 2018 at 4:40 PM gberaudo notifications@github.com wrote:

From your description, since you have no problem with the other OL-Cesium features, then it must be an issue in the KML support in OL-Cesium and not with the packaging.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/openlayers/ol-cesium/issues/619#issuecomment-417281655, or mute the thread https://github.com/notifications/unsubscribe-auth/AkJOkOLzU4bkpYDSPm-zh0yYTfoOojYUks5uV8gMgaJpZM4Vprv0 .