lolochristen / OpenLayers.Blazor

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

How to display text on a Line? #57

Closed DenisPolagaev closed 1 month ago

DenisPolagaev commented 5 months ago

I want to draw text with a distance in the middle How can I do it? https://openlayers.org/en/latest/examples/vector-labels.html

<Line Label="@task.Interval!.ArrivalTime.TotalMinutes.ToString()"
      Title="@task.Interval!.ArrivalTime.TotalMinutes.ToString()"
      Content="@task.Interval!.ArrivalTime.TotalMinutes.ToString()"
      TextScale="10"
      BorderSize="7"
      Points="new []{new Coordinate(prevTask.Task.AddressLocation.Longitude, prevTask.Task.AddressLocation.Latitude), new Coordinate(task.Task.AddressLocation.Longitude, task.Task.AddressLocation.Latitude)}"
      BackgroundColor="@employeeColor"
      BorderColor="@employeeColor"></Line>

image

lolochristen commented 2 months ago

Latest release 2.0 supports proper text labels on shapes. See demo for shapes....