|
Query |
Details | |
|
Can you tell me which types it does and does not support? |
The Maps component supports the polygon, multi-polygon, and point geometric types in the GeoJSON file for geometric map rendering. | |
|
Also I suggest that the control should throw an error if it is passed an unsupported type rather than silently ignoring it. |
At present, we do not handle any error for the unsupported geometry types. However, we will check consider your suggestion as improvement for the maps component. | |
|
The 'MapsNavigationLines' might be a possible solution if you can show me how it is possible to use MapsNavigationLines in a situation where a variable number of lines need to be drawn at runtime, i.e. I am getting the shape data from a database and do not know in advance how many lines there will be in a shape until I need to display it. |
At present, we need to know the exact number of lines to be drawn as navigation lines in Maps component using MapsNavigationLines class. We have already analyzed to add the navigation lines dynamically. To achieve this, we need to implement declarative syntax for the MapsNavigationLines class. With this feature, we can provide the navigation lines in a @for loop and render the same. We have logged a feature request for the same. We will include this implementation in any of our future releases.
Please find the below feedback link to keep track of the implementation.
| |
|
Is it possible to supply GeoJson data direct to the Map control instead of having to supply a file reference? |
As we mentioned earlier, we do not support line string geometric type in the Maps component. Line string type is used to render the navigation lines from the GeoJSON file. |
|
private string connectionString = "Yours DataBase Connection Name";
public async Task<string> GetWorldMap()
{
SqlConnection connection = new SqlConnection(connectionString);
var query = "Select Data from [Table] where Id='WorldMap'";
SqlCommand command = new SqlCommand(query);
command.Connection = connection;
connection.Open();
SqlDataReader read = command.ExecuteReader();
string dataValue = "";
if (read.Read())
{
dataValue = dataValue + read[0];
}
return await Task.FromResult(JsonConvert.DeserializeObject(dataValue).ToString());
} |
|
services.AddSingleton<DataServiceAccess>(); |
|
protected override async Task OnInitializedAsync()
{
WorldMap = await DataService.GetWorldMap();
} |
Hello!
I have question about the same topic.
I have valid Geojson string.
I want to use it directly on the maps, but i can't get it working.
simple example geojson:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[ 0.0, 100.0 ],
[ 100.0, 100.0 ],
[ 100.0, 0.0 ],
[ 0.0, 0.0 ],
[ 0.0, 100.0 ]
]
]
]
},
"properties": { "kadno": "88880004444" }
}
]
}
Code i am trying to use GeoJson string property contains previously mentioned geojson:
<SfMaps>
<MapsLayers>
<MapsLayer ShapeData="@GeoJson" TValue="string"></MapsLayer>
</MapsLayers>
</SfMaps>
If i save this file and load it using dataOptions it works, but i want to pass this geojson to component on the fly.
public MapDataSettings MapShapeData = new MapDataSettings
{
async = true,
type = "GET",
dataOptions = "js/test.json"
};
And also these ShapeData properties i saw in youtube video, but could'nt find any information about it in api documentation which is frustrating.
https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Maps.MapsLayer-1.html
|
<SfMaps>
<MapsLayers>
@* To load shape data *@
<MapsLayer ShapeData='@data' TValue="string">
</MapsLayer>
</MapsLayers>
</SfMaps>
<button @onclick="MapChange">Click Me</button>
@code
{
public object data = new {dataOptions= "africa.json"};
private void MapChange()
{
data = new {dataOptions= "simplegeo.json"};
}
} |
Thank you for information!
Situation is, i have in database Land Units with Geometry saved using Postgis.
I wanted to show in Land Unit details view how this Land Units geometry looks using SfMaps .
I have this LandUnit class with Polygon property with type MultiPolygon (From NetTopologysuite nuget)
I can convert this Polygon to GeoJson but this would mean i would have to create .json file for each Land units details view.
As i understand SfMaps is more about showing Summaries on maps.
I think for this above mentioned functionality i can use Leafletjs.
|
@if (MapShapeData != null)
{
<SfMaps>
<MapsLayers>
<MapsLayer TValue="string" ShapeData="MapShapeData"></MapsLayer>
</MapsLayers>
</SfMaps>
}
@code {
public object MapShapeData { get; set; }
protected override async Task OnInitializedAsync()
{
string fileText = System.IO.File.ReadAllText("wwwroot/world-map.json");
//TODO: In your case, convert the result from Postgris into string and assign it to "MapShapeData".
MapShapeData = Newtonsoft.Json.JsonConvert.DeserializeObject(fileText);
}
} |