Git Product home page Git Product logo

Comments (3)

ahocevar avatar ahocevar commented on June 17, 2024 1

The rendered result you're seeing is correct and intentional. If you want the points of a feature with a MultiPoint geometry rendered as if they were distinct features with Point geometries, you'd have to use a style like this:

const pointStyle = (geometry) => [
  new Style({
    geometry,
    image: new Circle({
      radius: 10,
      fill: new Fill({color: '#000'}),
      stroke: new Stroke({color: '#f00', width: 2}),
    }),
  }),
  new Style({
    geometry,
    image: new Circle({radius: 6, fill: new Fill({color: '#fff'})}),
  }),
];

layer.setStyle((feature) =>
  feature
    .getGeometry()
    .getPoints()
    .map((point) => pointStyle(point))
    .flat()
);

from openlayers.

ahocevar avatar ahocevar commented on June 17, 2024

@levelost Can you please explain in more detail (or provide a mock image) of what you'd expect to see? The above image looks correct to me. Also, it would be good if you could share the code that produced the above image, to make sure we're talking about the same thing.

from openlayers.

levelost avatar levelost commented on June 17, 2024
const styles = [
  new Style({
    image: new CircleStyle({
      radius: 10,
      fill: new Fill({color: '#000'}),
      stroke: new Stroke({color: '#f00', width: 2})
    })
  }),
  new Style({
    image: new CircleStyle({radius: 6, fill: new Fill({color: '#fff'})})
  })
];

const layer = new VectorLayer({
    source: new Vector({
      features: [
        new Feature({geometry: new Point([-100000, -100000])}),
        new Feature({geometry: new Point([100000, -100000])}),
        new Feature({geometry: new Point([100000, 100000])}),
        new Feature({geometry: new Point([-100000, 100000])})
      ]
    }),
    style: () => styles
});

1

const layer = new VectorLayer({
  source: new Vector({
    features: [
      new Feature({
        geometry: new MultiPoint([
          [-100000, -100000],
          [100000, -100000],
          [100000, 100000],
          [-100000, 100000]
        ])
      })
    ]
  }),
  style: () => styles
});

2

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.