This documentation outlines the steps to create a C# .NET Framework 4.6 console application that generates KML files from comma-separated latitude and longitude data. The application will utilize the SharpKML library and AspMapNET.dll.
- Development Environment: Visual Studio or any C# IDE.
- NuGet Packages:
- SharpKml 1.1.0
- SharpKml.Core 5.2.0
- Additional DLL:
- AspMapNET.dll
- Open Visual Studio.
- Create a new project:
File -> New -> Project. - Select
Console App (.NET Framework). - Name your project and choose the .NET Framework version 4.6.
- Right-click on the project in the Solution Explorer.
- Select
Manage NuGet Packages. - Search for
SharpKmland install version 1.1.0. - Search for
SharpKml.Coreand install version 5.2.0.
- Download
AspMapNET.dllfrom the appropriate source. - Right-click on the project and select
Add -> Reference. - Click
Browseand navigate to the location ofAspMapNET.dll. - Select the DLL and click
Add.
-
local method Reading:
- The LatLonData.Data() method reads the latitude and longitude values.
- Ensure your latitude and longitude separated by a comma.
-
KML File Creation:
- The
CreateKmlFilemethod creates a KML document and adds placemarks for each coordinate. - The SharpKml library is used to construct and save the KML file.
- The
- Place your latitude and longitude data in LatLonData.Data() method.
- Build and run the application.
- The KML file will be created at the specified output path.
This application provides a simple way to convert latitude and longitude data from a local string into a KML file. By following the steps and using the provided code, you can easily generate KML files for use with mapping applications.