Articles in this section
Category / Section

How to show the map using online GeoJson file using the .NET MAUI Maps (SfMaps)?

3 mins read

This article describes how to display a map using an online GeoJSON file in the Syncfusion® .NET MAUI Maps control.

 

Step 1: Create the maps control by referring to this Syncfusion® .NET MAUI Maps documentation.

 

Step 2: Load the map shape using a URI source. The MapSource.FromUri method accepts a Uri object and returns a new MapSource that loads shape data from the specified URI. String-based URIs are also implicitly converted to  MapSource.

 

The following code snippet demonstrates how to provide a URI shape source in XAML.

<map:SfMaps>
    <map:SfMaps.Layer>
        <map:MapShapeLayer ShapesSource="https://cdn.syncfusion.com/maps/map-data/world-map.json" />
    </map:SfMaps.Layer>
</map:SfMaps>

The following code snippet demonstrates how to provide a URI shape source in C#.

SfMaps map = new SfMaps();
MapShapeLayer layer = new MapShapeLayer();
layer.ShapesSource = MapSource.FromUri(new Uri("https://cdn.syncfusion.com/maps/map-data/world-map.json"));
map.Layer = layer;

Download the complete sample on GitHub.

Output

 

Syncfusion .NET MAUI map using URI ShapeSource.

 

Conclusion

I hope you enjoyed learning how to show the map using an online GeoJSON file in the .NET MAUI Maps (SfMaps).

You can refer to our .NET MAUI Map feature tour page to learn about its other groundbreaking feature representations.

For current customers, check out our .NET MAUI components from the License and Downloads page. If you are new to Syncfusion®, try our 30-day free trial to check out our .NET MAUI Maps and other .NET MAUI components.

Please let us know in the comments section if you have any queries or require clarification. Contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied