Giter Site home page Giter Site logo

Comments (5)

ahocevar avatar ahocevar commented on June 15, 2024

Before digging into details: is there any reason why you're using Overlays for your icons? These could just as well be point features in a vector layer.

from openlayers.

lawyer888 avatar lawyer888 commented on June 15, 2024

Before digging into details: is there any reason why you're using Overlays for your icons? These could just as well be point features in a vector layer.

In my project, there are many features, and there are complex filtering and judging requirements for the interaction of many states and data. There will be thousands of features, especially many line segments, each with different properties and statuss,and there will be requests and communication involved as well. If I put the icons into the feature system, Every time I write logic, I have to consider excluding these icons, making it difficult to avoid the integration of icon logic with features as a whole,On the other hand, the separate overlay system only has a few of nodes, Static information does not involve communication, so I can manage these overlays separately, which is relatively easy. Even if there are changes, I don't need to adjust them in the logic of the feature system.

from openlayers.

lawyer888 avatar lawyer888 commented on June 15, 2024

Before digging into details: is there any reason why you're using Overlays for your icons? These could just as well be point features in a vector layer.

this is my personal opinion, but indeed using features can facilitate interaction. I just didn't consider that in cases with very limited interaction, such issues may arise. It can be considered a minor issue. For example, an icon only has one interaction, which is to click and display static information, so I didn't think much and just used it.
Besides ,I agree with what you said.

from openlayers.

ahocevar avatar ahocevar commented on June 15, 2024

If I put the icons into the feature system, Every time I write logic, I have to consider excluding these icons

Not if you put your icons on a separate layer and use Layer.getFeatures(pixel) or Map.getFeaturesAtPixel() with a layer filter. Then you have a clear separation. Also, there is https://www.npmjs.com/package/ol-marker-feature, if you want to combine the convenience of an Overlay with the convenience of a Feature.

from openlayers.

lawyer888 avatar lawyer888 commented on June 15, 2024

If I put the icons into the feature system, Every time I write logic, I have to consider excluding these icons

Not if you put your icons on a separate layer and use Layer.getFeatures(pixel) or Map.getFeaturesAtPixel() with a layer filter. Then you have a clear separation. Also, there is https://www.npmjs.com/package/ol-marker-feature, if you want to combine the convenience of an Overlay with the convenience of a Feature.

OK, I understand. Actually, I had considered placing them on different layers before, but at the beginning of the project, I didn't think that a few icons would have a significant impact, so I didn't do that, and I didn't consider the limitations of overlays. Thank you for your response.

from openlayers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.