Has anybody ever tried to show and interact with a QGIS map from a DotNet language like C#? What I have in mind is, to write a desktop application with C#, and show an embedded map with the QGIS-API on a form.

The most useful document I found, is this Coding Guide, and it seems that QGIS supports exclusively C++ and Python to write applications/plugins. So my question, is it doable to create DotNet wrappers in C++, and use them in a managed language (with a reasonable amount of work)? Any positive or negative experience?


I have investigated this and while it might be possible at some level by writing wrappers in C++ using them in .NET it is a hell of a lot of work because you also have to wrap the Qt framework at the same time. There might be hacks that you could use to get it to work but they will always be hacks.

My advice: Learn Qt C++ or/and PyQt Python. Qt makes life a lot easier in C++ and while you do still have to understand things like pointers and references it is really not that bad. Qt Creator is a great IDE which includes help for the full Qt framework; a UI designer; built-in quick templates; etc.

If you don't want to go down the C++ route, you can make some pretty impressive stuff with PyQt in Python. It's all just the Qt framework plus all of Pythons awesomeness.

As QGIS is written in Python and C++ you are going to get the most support on those areas if you get stuck.

I was a .NET before joining the QGIS project and while it was a little different at first C++ and Python don't take that long to pick up.

  • Thanks so much for your advice. I'm a bit reluctant to investigate in 2 new environments at once (QGIS and C++), but maybe i should give it a try. If one could automate the building of the wrappers, a lot of other people could benefit from them, but if that includes the Qt-framework… – martinstoeckli Jun 26 '13 at 11:39
  • You could try code.google.com/p/qt4dotnet however I'm not sure how far you will get with it and it isn't going to be supported. I would recommend Python if you don't want to try C++ just yet. – Nathan W Jun 26 '13 at 11:44
  • 1
    if you want to write a standalone app in dotnet dotspatial.codeplex.com might be a solution too. I agree Writing a dotnet plugin for qgis is not good idea. – warrieka Jun 26 '13 at 11:58
  • @warrieka - Thanks for the link, i will investigate more on this project, it could be a real alternative. – martinstoeckli Jun 26 '13 at 12:11
  • have you tried something? If yes then do please share it – user2174920 Nov 22 '15 at 12:59

It is possible to create embed a map on any kind of Web Application, without any server-side technology.

There is a plugin called QGIS2Web which is a great way to publish GIS data and make it accessible to users.

Running example: https://storage.googleapis.com/qgis-tutorials/qgis2web/index.html

Full tutorial: http://www.qgistutorials.com/en/docs/web_mapping_with_qgis2web.html

  • Thanks for the link, this could be a solution for future projects. It schould be possible to show it in a webview inside the DotNet application. – martinstoeckli Apr 24 '17 at 8:39
  • Yes definitely.. I've also read about a C library called MapServer that can be embedded on any web application (regardless of the technology).. I'm not sure how big the effort would be to integrate with ASP.NET / Other technologies, but it looks like a very powerful library. Take a look at their examples. mapserver.org – Bartho Bernsmann Apr 25 '17 at 0:14

There are two opensource possibilities if you want to embed a map with GIS capabilities using C# or VB.NET. One is MapWindow and the other is SharpMap. Here is a link:

MapWindow http://www.mapwindow.org/

SharpMap https://github.com/SharpMap

They are absolutely great libraries if the size of your data is limited. The map rendering is inversely proportional to the size, I mean literally. With my experience, I haven't gone ahead rendering a map which is above 10 MB.

MapWindow is much more stable with its Desktop libraries than SharpMap. On the other hand, SharpMap is a good choice for web map rendering using ASP.NET. Both are good with their respective capabilities provided the data size is limited.

MapWindow provides for building and embeding a map viewer with its MapWinGIS.ocx (An ActiveX component). this can be used to embed a map in a Windows Forms Application.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.