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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

ThierrySysAdminCommented:
0
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.