tsilb
tsilb

Reputation: 8037

Interactive Google maps on a C# winform

I have an application with Google maps in it. Currently the maps are rendered in a WebBrowser via the Maps Javascript API.

I have a requirement to make the map interact with the application. Specifically, I have placed markers on the map. The winform needs to register when one of them is clicked, double clicked, etc. and know which one it was. If the user right-clicks on a blank area on the map, I need some way of registering both where to draw the context menu and the lat/long that pixel represents geospatially.

I don't care whether the map remains in a webbrowser control or is replaced with something else. If needed, I can tear the whole thing out and put a new map in there - but it should be Google (because we have the expensive enterprise API) and it absolutely has to remain inside the winform.

How can I accomplish this interactivity?

Upvotes: 7

Views: 23450

Answers (2)

Marcel N.
Marcel N.

Reputation: 13976

Almost missed the part where you said you're willing to replace the web version with something else.

Have a look at Great Maps - for Windows Forms and WPF. It is a custom WinForms control you can drop on a form.

It supports a lot of map providers, Google Maps included. They have a demo with which you can play and see how it works and how it can be integrated.

From experience, I can say that it is possible (quite easily) to bind to map events (marker clicked, double clicked as well).

Something worth noting is that using Google Maps with it might violate Google's terms of use (you also get a warning in the demo app). You can always explore some of the free providers, like OpenStreetMap.

Upvotes: 11

Pat
Pat

Reputation: 1

I would not use Great Maps for windows forms and wpf (GMap.Net) because it violates Google Map Usage Terms by accessing Google Map Tiles directly.

You can host one by yourself if you follow this link: https://github.com/mchall/GoogleMapsApi.

Or you can use one free WPF control at: https://archive.codeplex.com/?p=wpfgooglemap.

We use GDS Google Map. It is not free, but affordable. It does what we need.

Upvotes: 0

Related Questions