Skip to content

Questions about ol-interaction-modify compnent #421

@iboates

Description

@iboates

I have a vector layer of features that I can add to and remove from. I want to be able to modify the geometry, but I can't figure out how to specify it.

  <!-- Wind farm site features layer -->
  <ol-vector-layer>

    <ol-source-vector :projection="projection" ref="vectorLayerTemplateRef">
      <ol-feature
        v-for="(windFarmSiteFeature, index) in windFarmSiteFeatures"
        :key="index"
        :properties="windFarmSiteFeature.properties"
        :ref="'windFarmOlFeature_' + windFarmSiteFeature.properties.windFarmSiteId"
      >
        <ol-geom-polygon :coordinates="windFarmSiteFeature.geometry.coordinates" />
      </ol-feature>
      <ol-interaction-modify />
    </ol-source-vector>

    <!-- Doesn't work -->
    <!-- <ol-interaction-modify
      :source="vectorLayerTemplateRef"
    /> -->

    <ol-style>
      <ol-style-stroke color="blue" :width="2"></ol-style-stroke>
      <ol-style-fill color="rgba(255,255,255,0.5)"></ol-style-fill>
    </ol-style>
  </ol-vector-layer>

  <!-- Doesn't work -->
  <!-- <ol-interaction-modify
    :source="vectorLayerTemplateRef"
  /> -->

The ones marked with <!-- Doesn't work -_> just crash the application.

I have it placed inside the ol-source-vector component, but I still get this error in the console:

[Vue3-OpenLayers Error] OlInteractionModify: Modify interactions needs either a source or features to work.
      Please provide either the props 'source' or 'feature' or use the component with an '<OlSourceVector>' component.

I don't understand how this is supposed to work, can somebody please provide me with an example of how you are supposed to actually link this to the ol-source-vector component?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions