ghettovoice / vuelayers

Web map Vue components with the power of OpenLayers
https://vuelayers.github.io/
MIT License
683 stars 229 forks source link

Compatibility with OsmBuildings? #384

Closed chrisamow closed 3 years ago

chrisamow commented 3 years ago

Hi GhettoVoice - thanks for your work here, it looks great!

Have you seen it work with osmbuildings ? I see that it supports osmlayers, but I've had troubles in the past with libraries that work directly with other libraries that vue is built on top of (e.g. they do a lot of dom manipulation that is not very vue-like and it gets messy quickly.)

ghettovoice commented 3 years ago

Hello @chrisamow ,

I'm not sure is it support openlayers v5/v6. In my test demo I can't setup it https://jsfiddle.net/ghettovoice/vsg468od/144/.
I'm actually tried to reproduce their example from here https://github.com/kekscom/osmbuildings/blob/master/dist/index-OpenLayers.html Frankly speaking I see this tool for the first time, maybe I just missed something... VueLayers is based on OpenLayers, so if OSMBuildings is not supporting OpenLayers v5/v6 then it is not supported by VueLayers.

As for DOM issues, Vue currently doesn't support something like fully virtual components without any dom representation. So vuelayers supports several use cases to work with vector features:

  1. vl-feature and vl-geom-* components. This components like any other Vue components append some html element to the dom (<i> or <!---->), because this is required by Vue engine. So I always recommend use them only for simple cases, like show fpr example show search marker or user geolocation where you need only one feature.
  2. Features as array of GeoJSON encoded features. This should be always used by default to load/show any vector data. No DOM created for features, only vl-layer-vector and vl-source-vector bound to DOM elements, features are just an reactive array.
  3. Sometimes there is can be special use cases, when reactive array of features (if there are a huge number of features) can be very slow too, because Vue traverse all elements, append to them observers and so on. Also when features are changing very often, for example real time vehicle gps trackers. In this case you can still configure layer/source through VueLayers components, but work with features through OpenLayers api. There was several issues about such use cases and possible solutions:
chrisamow commented 3 years ago

Thanks @ghettovoice ! I meant to do a proof of concept on this by now, but it will have to wait until early next year - I'd really like to switch over to vuelayers - it is a more elegant way to do things than many of the options out there. Appreciate the detailed ideas too! I'll close this and reopen if I have a more specific question. Take care.