osmbuildings icon indicating copy to clipboard operation
osmbuildings copied to clipboard

openlayers-5.3.0 create react app

Open All4Gis opened this issue 4 years ago • 7 comments

Hi.

I'm trying to integrate this js into a project but when I import the library I get a lot of errors like:

./src/OSMBuildings-OL5.js
  Line 272:9:    Expected an assignment or function call and instead saw an expression  no-unused-expressions
  Line 859:9:    Expected an assignment or function call and instead saw an expression  no-unused-expressions
  Line 1370:32:  'getGeometries' is not defined                                         no-undef
  Line 1380:32:  'getGeometries' is not defined                                         no-undef
  Line 1652:9:   Expected an assignment or function call and instead saw an expression  no-unused-expressions
  Line 2015:9:   '_ring' is not defined                                                 no-undef
  Line 2137:9:   Expected an assignment or function call and instead saw an expression  no-unused-expressions
  Line 2138:9:   Expected an assignment or function call and instead saw an expression  no-unused-expressions
  Line 2342:9:   Expected an assignment or function call and instead saw an expression  no-unused-expressions
  Line 2421:9:   Expected an assignment or function call and instead saw an expression  no-unused-expressions
  Line 2565:9:   'setSize' is not defined                                               no-undef
  Line 2584:9:   'setZoom' is not defined                                               no-undef

Search for the keywords to learn more about each error.

It's a create react app project, but it should work I think.

thanks

All4Gis avatar Mar 12 '20 10:03 All4Gis

Sounds familiar. Can you confirm the library works standalone? Also, could you provide a running sample with your setup? Demo URL, CodePen etc.

kekscom avatar Mar 12 '20 16:03 kekscom

It works perfectly in standalone app.I'm going to make an example

All4Gis avatar Mar 12 '20 19:03 All4Gis

I created a sample repository

npm install and npm start

https://github.com/All4Gis/OSMSample/tree/OSMBuildings

All4Gis avatar Mar 12 '20 20:03 All4Gis

git checkout OSMBuildings

kekscom avatar Mar 19 '20 07:03 kekscom

From what I see code did not get properly transpiled into ES6. Ideally you could fine tune this process.

Resulting tasks would be refactoring to a modern code base + providing an npm module.

kekscom avatar Mar 19 '20 07:03 kekscom

Okay, I shall enquire and I'll try to make a working example. thanks

All4Gis avatar Mar 19 '20 07:03 All4Gis

I've finally had time to make some changes. It's working. Here is a link to the example.

https://github.com/All4Gis/OSMSample/tree/OSMBuildings

And live demo https://all4gis.github.io/OSMSample/

All4Gis avatar Apr 21 '20 10:04 All4Gis