kekscom / osmbuildings

OSM Buildings Classic 2.5D
http://osmbuildings.org
BSD 2-Clause "Simplified" License
505 stars 140 forks source link

openlayers-5.3.0 create react app #120

Open All4Gis opened 4 years ago

All4Gis commented 4 years ago

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

kekscom commented 4 years ago

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

All4Gis commented 4 years ago

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

All4Gis commented 4 years ago

I created a sample repository

npm install and npm start

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

kekscom commented 4 years ago

git checkout OSMBuildings

kekscom commented 4 years ago

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.

All4Gis commented 4 years ago

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

All4Gis commented 4 years ago

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/