ichim / LeafletForBlazor-NuGet

LeafletForBlazor NuGet Package - You can quickly add a map control to your Blazor application - 2.2.2.2 version. #12 issue, StreamLegend customization
https://www.nuget.org/packages/LeafletForBlazor#versions-body-tab
74 stars 9 forks source link

calibrate image map #16

Open Thord82 opened 9 months ago

Thord82 commented 9 months ago

Hello, thank you very much for creating this package. I would like to ask a question, I am currently using a custom image as a map, and I would like to know how I could calibrate it, that is, for example, that its upper right corner be (10,10) and the lower left corner (-10,-10). I have reviewed the loadMap class, basemap ect, and I have not found something to be able to set. Thank you so much.

ichim commented 9 months ago

Hello sir,

The only possibility to calibrate the image on the map is to specify the lower left corner (southWest) and the upper right corner (northEast) in map coordinates.

Ex.

       new Map.ImagesAndBoundsCoordinates()
            {
                url = "http://localhost:5116/romana.png",
                map_bounds = new Map.MapBounds()
                {   
                    _southWest = new Map.Location()
                    {
                        longitude = 26.0964848,
                        latitude=44.4465985
                    },
                    _northEast = new Map.Location()
                    {
                        longitude = 26.0983148,
                        latitude=44.4475250
                    }
                }
            }

You cannot use screen coordinates (pixels).

Respectfully

Thord82 commented 9 months ago

Thanks for your reply. As far as I've been able to test Map.ImagesAndBoundsCoordinates() is only used for the Map.Overlays property that overlays an image on the map. In the case I am dealing with, what I need is to use and calibrate an image as a map (for example the plan of a house) Using Map.BasemapConfigLayer() the url property, I have been able to set the plane image as a map, but I can't find a way to set the bound properties or something similar

ichim commented 9 months ago

I'm sorry, but I'm not sure I understood correctly. Do you want the plan of the house to be scaled with the image of the map, that is, the plan of the house to have a dynamic scale...change the plan of the house with map?

Thord82 commented 9 months ago

hello. I finally found the solution as you told me. I put new Map.BasemapConfigLayer() { url = "", ...} With this I managed to prevent any map from loading, then I configured images = new Map.ImageOverlay() { images_and_bounds = new List() { new Map.ImagesAndBoundsCoordinates() { url = "https://../myimage.svg", map_bounds = new Map.MapBounds() { _southWest = new Map.Location() { longitude = 698, latitude=237 }, _northEast = new Map.Location() { longitude = -371, latitude=-307 } By making these configurations I was able to establish an image as a map as I was looking for, the problem now is that I migrated to RealTimeMap since I need to make some point movements in real time similar to the examples that appear in the project, and I have been able to observe that RealTimeMap does not have the MapOverlays property or a similar one to be able to perform ImagesAndBoundsCoordinates, Is there a way in RealTimeMap to be able to establish an image at the desired coordinates? thank you so much

ichim commented 9 months ago

Hello sir,

You are right sir, RealTimeMap does not have this functionality yet. In the shortest time I will add this functionality to RealTimeMap.