How To Use Geographic Maps in Visual Studio Applications
How To Use Geographic Maps in Visual Studio Applications
We show in this tutorial how to insert a geographical map into our Visual Studio .NET application.
We indicate which free component to use (GMap.NET), how to install it in Visual Studio .NET Community
2015 and how to add this visual component to the form of our application. We also explain a
Example of using GMap.NET to change the type of map (Google Satellite, Google Hybrid, Open Street)
Map, Open Cycle Map, etc.) and how to upload a polyline (route or GPS track).
Video tutorial Insert geographic map in Visual Studio .NET C# for free.
Download and installation of GMap.NET in Microsoft Visual Studio .NET Community 2015.
Video tutorial on how to incorporate a geographic map into our applications developed in Visual Studio
.NET C# C Sharp. We show in this video tutorial how to add maps to our applications in a way
free using the GMap.NET component. We explain how to load a map and how to install and reference it.
In order to use geographic maps (Google Maps, satellite view, hybrid, Open Street Map, Open Cycle Map,
etc.) in our .NET applications (both C# and Visual Basic .NET) we will logically need to have,
from Visual Studio .NET, in the following link we show how to download and install this development IDE:
We will also need a device with an Internet connection to download the free component GMap.NET.
Download and install GMap.NET in Microsoft Visual Studio .NET Community
2015
We will access the official website of the component, currently at the link:
The provided text is a URL and does not contain any translatable text.
We will now open Visual Studio .NET Community 2015 and create a new project, for this we will access
"Windows" and on the right we will select "Windows Forms Application". We will enter a name for
initial form
After the creation of the project, what we will do now is add the GMap.NET libraries to our project.
the necessary references. To do this, we will access the folder where we have used Windows Explorer.
Unzip the GMap.NET file and we will copy all the dll libraries from GMap.NET and the files.
Configuration XML:
We will take the copied files in the folder of our project, specifically in the folder bin/debug.
DLL deGMap.
After placing the GMap.NET libraries in the same folder as the application executable, the following
The next step will be to add the reference to GMap.NET in our Visual Studio .NET project. To do this, from Visual
Studio, with our open project, we will click on the 'Project' menu - 'Add reference':
In the References Manager window, we will click on 'Browse':
We will navigate to the folder of our project, to the folder…/bin/Debug, we will select the
it appears we can show it from the menu "View"–"Toolbox"), in the pop-up menu
library GMap.NET.WindowsForms.dll which contains the visual control GMapControl and we will press 'Open':
It will show us a security warning, we will press 'Yes':
—————————
—————————
Security warning: probably 'C:/Users/AjpdSoft/Documents/Visual Studio
2015/Projects/AjpdSoftMapaCSharp/AjpdSoftMapaCSharp/bin/Debug/GMap.NET.WindowsForms.dll' is
downloaded from a network location and could harm the equipment. Only load assemblies from publishers in the
that he trusts.
—————————
Yes
—————————
After adding 'GMapControl' to the .NET Framework components, we will click 'OK':
Once added, in the Toolbox, in the 'Common Controls' group we will have
Once installed and the reference to GMap.NET added, we can use the visual component, for this, from
"Toolbox", in "Common Controls" we will press on GMapControl and we will click on the
application form for you to add the component. Once added, we will stretch it until it is left at
to be able to use it, therefore, from the source code of our form, we will add the following lines:
using GMap.NET.MapProviders;
using GMap.NET;
We will add a button so that when pressed, the map loads at a specific latitude and longitude.
Hello, in the eventClick of the button we will add the following code (taking into account that to
OpenStreetMap.
OpenClycleMap.
GPX is a GPS data exchange format, it is an XML scheme intended for transferring GPS data between
applications. It can be used to describe points (waypoints), routes (tracks), and paths (routes). A
Below we show a source code in C# that will allow us to equip our applications in Visual
Studio .NET C Sharp option to load a GPX file and display the route taken on the map. For the
Next, we will need a component of type System.Windows.Forms.OpenFileDialog.
we will add to our form from the Toolbox, we will call this component 'dlg':
We will logically add a button so that when the user presses it, the selection window is displayed.
GPX document and once selected, load it on the map. Therefore, the code for the 'Click' event of
(satellite, hybrid, street, etc.). To do this, we will add a dropdown to the form.
(System.Windows.Forms.ComboBox). We will call the dropdown 'lsMapas' and in its 'Items' property
we will add:
OpenStreetMap
OpenClycleMap
So that the user can choose the type of map to display. We will add a button to show the
map and in the 'Click' event we will introduce the following code:
C#
Next, we show an application developed in C Sharp .NET in operation that uses the