5

Problem to enable 3d map of openlayers. 2D map works great. Using parcel and all dependencies are added.

Once importing cesium on js file i got SyntaxError: private fields are not currently supported.

In package json file added "cesium": "^1.62.0".

<html>
    <head></head>
    <body>
        <div id="map" style="height: 400px;"></div>
        <script src="index.js"></script>
    </body>
</html>
import 'ol/ol.css';
import Cesium from 'cesium'; // --> THIS LINE MAKES ERROR
import Map from 'ol/Map';
import View from 'ol/View';
import TileLayer from 'ol/layer/Tile';
import OSM from 'ol/source/OSM';
import {defaults as defaultControls} from 'ol/control';
import ZoomSlider from 'ol/control/ZoomSlider';
import OLCesium from 'olcs/OLCesium.js';

var view = new View({
    center: [328627.563458, 5921296.662223],
    zoom: 8,
    extent: [-572513.341856, 5211017.966314,
      916327.095083, 6636950.728974]
  });

 new Map({
    layers: [
      new TileLayer({
        source: new OSM()
      })
    ],
    keyboardEventTarget: document,
    target: 'map',
    view: view,
    controls: defaultControls().extend([new ZoomSlider()])
  });

const ol3d = new OLCesium({map: map}); // ol2dMap is the ol.Map instance
ol3d.setEnabled(true);
Niru
  • 221
  • 1
  • 4
  • 12

3 Answers3

2

I received this error when I forgot quotes around ID. $(#fail) $("#works")

1

I received this error for mis-matching opening and closing signs for a string in JavaScript:

(!!(v)) ? $('#is_err_" + j + "_ALARM").show() : $('#is_err_" + j + "_ALARM").hide();

(some of these strings are opened with ' sign, but closed with " sign)

Atara
  • 3,523
  • 6
  • 37
  • 56
1

you are mixing up " and '. Try this:

(!!(v)) ? $("#is_err_" + j + "_ALARM").show() : $("#is_err_" + j + "_ALARM").hide();
DuDa
  • 3,718
  • 4
  • 16
  • 36
Remooz
  • 11
  • 1