Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

olcs.FeatureConverter is not a constructor #1165

Open
measman opened this issue Feb 14, 2024 · 5 comments
Open

olcs.FeatureConverter is not a constructor #1165

measman opened this issue Feb 14, 2024 · 5 comments

Comments

@measman
Copy link

measman commented Feb 14, 2024

I am new in Cesium and also olcesium but I have done my projects in openlayers but in "oldfashioned". Now I am traying to add 3d functionality to my old openlayers project using olcesium.

My code is like:

    let layerss = this.olMap.getAllLayers();
    // console.log(this.olMap.getView().getProjection());
    this.ol3d = new olcs.OLCesium({map: this.olMap}); // ol2dMap is the ol.Map instance
    const scene = this.ol3d.getCesiumScene();
    var featureConverter = new olcs.FeatureConverter(scene);
    featureConverter.olVectorLayerToCesium(layerss[5], this.olMap.getView(),scene.primitives);
    var vectorSync = new olcs.VectorSynchronizer(this.olMap, scene, featureConverter);
    vectorSync.synchronize();

but it thows error like:
Uncaught TypeError: olcs.FeatureConverter is not a constructor
at p.Cesium (cross_section.js?q=1.4.0_20240214_130102:134:32)
at p.Start_3D (cross_section.js?q=1.4.0_20240214_130102:165:18)
at crosssection_3d_enable (cross_section.js?q=1.4.0_20240214_130102:22:34)

Can you help me please. Thanks in advance.

@gberaudo
Copy link
Member

Hi @measman , the "oldfashioned" way has been removed from OpenLayers documentation.
For example, https://openlayers.org/doc/quickstart.html only mentions using a bundler.

Are you using a bundler?

@measman
Copy link
Author

measman commented Feb 27, 2024

Hi @gberaudo , thank you for your reply.

No, I am not using bundler.

isn't it possible to use "oldfashioned" way now?
Can you give me some example or link of any document from which I can learn how to mix these new ES modules and oldfashioned code together and run smoothly.

Thank you for you help.

@gberaudo
Copy link
Member

We removed the oldfashioned build in newer versions of Ol-Cesium.
The goal was to simplify the build system by focusing on modern usages.

Have you tried using a bundler?
Did you encountered issues?

@measman
Copy link
Author

measman commented Feb 29, 2024

Yes, I have tried using Vite bundler, there is no issue.
But I wanted to use Ol-Cesium in my old application, I don't want to rebuild entire application again but want to add 3D capabilities with Ol-Cesium.
is there any step by step tutorial to learn Ol-Cesium?
Thank you for your help.

@gberaudo
Copy link
Member

There is no tutorial at the moment.
I agree it would be great to go beyond the getting started we currently have.
This tutorial would:

  • start from an existing OpenLayers application;
  • add ol-cesium (how to add dependency, bundlers, lazy loading of CesiumJS);
  • how to directly manipulate CesiumJS (adding 3d tilesets, models, ...)
  • improve on the default synchronization (how to deal with projections, customizing transformation with PROPERTIES.md)
  • a bit about common issues

If someone wants to participate to such a task please add a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants