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

How can i get my markers from SQL Database #13

Open martinx1941 opened 9 months ago

martinx1941 commented 9 months ago

Hi, how can i get my markers from SQL Database. You provide here a Sample with Json File. But can i also get Data from a SQL Server Database where i have my geolocations in a Table?

ichim commented 9 months ago

Hello sir, From the query cursor you must get the coordinates (latitude, longitude) of the points. With these coordinates you can use:

    <Map
        width="800px"
        height="600px"
        Parameters="@parameters"
        GeoJSON_strings="@date_geojson.ToArray()"
    ></Map>

and:

        List<string> date_geojson = new List<string>()
        {
           "[{\"type\":\"Feature\",\"geometry\":{\"type\":\"Point\",\"coordinates\":[26.097369,44.444941]},\"properties\":{\"name\":\"Beautiful Memories Store\"}}]"
        };

if your points are dynamic, you can use RealTimeMap and the Geometric.Points class.

martinx1941 commented 9 months ago

Thank you. i would aprox. 10000 markers display on the map (all over europe) what did you mean, should i load and display them on start ? or load them asyncron?

ichim commented 9 months ago

Hello sir, If you have many points, it is good to use the RealTimeMap control and the Geometric.Points class:

await realTimeMap.Geometric.Points.upload(new InputData().input);

where input is:

List<RealTimeMap.StreamPoint> input = new List<RealTimeMap.StreamPoint>(){};

This class is optimized to load many points in a short time. The Geometric.Points class is optimized, loads the points on separate threads based on the type property.

However, the rendering of points in the leaflet map is slow...