VB NET Windows Application with Maps

Hi,

I would like some advice on creating a windows application that includes Maps where users can search for locations and generate directions between locations.

Currently I have created the app with a web browser that points to Google maps where the user can then enter the information required. However, this also includes all the extras that comes with the website, which I don't really want.

The next approach could be to add a mapping API, preferably Google but I need it to be free... Is this possible? If so how should I start.

The app that I am creating is for internal business use, for basically locking down a PC so the users can only use the mapping website.

Thanks, Greg
spen_langAsked:
Who is Participating?
 
Snarf0001Commented:
Or use the Bing maps extention in Visual studio:
I've used this a few times, and it's very quick and easy to implement.  On web apps I pretty much always use Google, but for windows apps I always pick the Bing control, as the native integration is far smoother and better than embedding a webbrowser.

If you're using WinForms and not WPF, you can still jump through a couple hoops to put a WPF control in,

Basic Bing key is free, but the request limits are lower than Google.
1
 
Pawan KumarDatabase ExpertCommented:
We can use below..Google API  ...you can get upto 25k maps per day.
you also have to register for it to get the key.

https://www.codeproject.com/Tips/889136/Csharp-Google-Maps-in-WinForm-with-WebBrowser-and

you can convert the c# above from below to VB.NET

http://converter.telerik.com/
0
 
spen_langAuthor Commented:
OK thanks, I thought it was only free for Android Apps?
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
Pawan KumarDatabase ExpertCommented:
See the entire collection from google.

https://developers.google.com/places/android-api/

Google Maps Android API
Google Maps Directions API
Google Maps Distance Matrix API
0
 
ThierrySysAdminCommented:
0
 
spen_langAuthor Commented:
Thanks Snarf0001, do you have any examples or places to start?
0
 
Snarf0001Commented:
Best place would be here to start:
https://msdn.microsoft.com/en-us/library/hh745791.aspx

Runs you through getting a key, what you need, and creating the first app.
Links to full development resources / docs as well.
0
 
spen_langAuthor Commented:
Hi, how do I add this to an existing Windows App? I have tried adding a new User Control (WPF) but when I then try to add teh control to a new Windows Form in my existing app I get teh error: "Value cannot be null. Parameter name: objectType".

<UserControl x:Name="BingMaps" x:Class="BingMaps"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:m="clr-namespace:Microsoft.Maps.MapControl.WPF;assembly=Microsoft.Maps.MapControl.WPF" 
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:KioskMode"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <m:Map CredentialsProvider="MyKey" Mode="AerialWithLabels" />
    </Grid>
</UserControl>

Open in new window

0
 
Snarf0001Commented:
How did you add the control, did you try to add it directly or through an ElementHost?
0
 
Snarf0001Commented:
If you can post more code I can try to see what the problem is, just made a quick and dirty WinForm version myself and it worked properly, so would need more details from you.

Even stacktrace and inner exceptions from the error you mentioned would help.
0
 
spen_langAuthor Commented:
Thank you, I have just this moment worked it out, I forgot to rebuild my app before adding the WPF ElementHost and therefore it was still referencing the older WPF control I created.
0
 
spen_langAuthor Commented:
How would I do this within the control?

 Public Sub New()
        InitializeComponent()
        'Set the map mode to Aerial with labels
        myMap.Mode = New AerialMode(True)
    End Sub
0
 
Snarf0001Commented:
Exactly like you have it should work.

Both within the xaml like you had earlier, "<m:Map CredentialsProvider="MyKey" Mode="AerialWithLabels" />", as well as the code snippet directly above "myMap.Mode = New AerialMode(True)".

What's not working?
0
 
spen_langAuthor Commented:
Is It possible to add the "directions" feature to the map control?

For example I would like users to be able to search the map for places and get direction between two locations...

Thanks, Greg
0
 
Snarf0001Commented:
Yes, you need to use the "Routes API" for that.
https://msdn.microsoft.com/en-us/library/ff701705.aspx

Once you get the data, you can draw on the map with Polylines, and display the text steps however you see fit.

Link with a bit more detail (for silverlight, but basically the same thing):
https://social.msdn.microsoft.com/Forums/en-US/d7b0b272-35f3-4724-8546-dce9bd8b1e3d/wpf-bing-map-control-how-to-draw-route-lines?forum=bingmapssilverlightwpfcontrols


One important thing to note, when you're using the rest services, make sure you initialize the call with the map's SESSION key as outlined here (Making use of Sessions):
https://msdn.microsoft.com/en-us/library/jj819168.aspx

Otherwise you'll incur more instance charges since it thinks each one is a new request.
0
 
spen_langAuthor Commented:
Both comments helped
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.