lolochristen / OpenLayers.Blazor

An Map component for Blazor based on OpenLayers with support for swisstopo swiss maps.
MIT License
42 stars 15 forks source link

how to add a featue to the layer #52

Closed xiaozhu1988 closed 6 months ago

xiaozhu1988 commented 7 months ago

First,you code add all features to FeaturesList, I want to add the feature to the specific layer。 Second,the map componet has call_back ShapeStyleCallback,but it applies to all the shape added to the map. I want to add a image(http url) to the layer ,need some demo.Thanks I copy code from your demo GeoJsonDemo,but i can't add geojson to the map。

lolochristen commented 7 months ago
  1. You can not add a feature to specific layer because the layer must be a vector layer. All features are internally added to a internally managed vector layer.
  2. ShapeStyleCallback does only work with Blazor WebAssembly, not with Server because the callback is in Server only async but openlayers library requires a sync feedback to apply styles. I didn't found a solution yet.
  3. Image can be added as marker. See markers demo. The image is the over the map and scales with map. To have an image as a layer is not supported yet. This might come later.
xiaozhu1988 commented 7 months ago

Thanks for your replay,hope your components will be more powerful。 Now i spend more time on learning openlayers,and try to solve the issues with js

---Original--- From: "Laurent @.> Date: Sun, Mar 31, 2024 00:59 AM To: @.>; Cc: @.**@.>; Subject: Re: [lolochristen/OpenLayers.Blazor] how to add a featue to the layer(Issue #52)

You can not add a feature to specific layer because the layer must be a vector layer. All features are internally added to a internally managed vector layer.

ShapeStyleCallback does only work with Blazor WebAssembly, not with Server because the callback is in Server only async but openlayers library requires a sync feedback to apply styles. I didn't found a solution yet.

Image can be added as marker. See markers demo. The image is the over the map and scales with map. To have an image as a layer is not supported yet. This might come later.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>