Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have layers in a postgis database that I can load in a MapWindows Control (ocx) using a npgsql connection and creating a shapefile using the geometry field in a Visual Studio .Net 2010 (C#) application, but this is really slow when the layer contains too many features.

I have seen that QGIS loads postgis layers very fast and I want to know if is possible to use the QGIS functionality in any way in a Forms Application using C#, like a DLL or an ocx control. I need to load postgis layers in a display control with legend and be able to change colors, symbology, labels, etc. Also, I need to save any changes in the layer to the postgis database.

Any help will be appreciated.



Unicoletti, thanks for your reply.

I don't see the way to use swig to open a postgis layer and show it in a windows forms. I was wondering if there is any way to encapsullate qgis functionality to do that.

I want to have a control in a form and programatically open a postgis layer on it and, later, manage the properties of that layer, line color, fill color, legends,... Right now I'm using MapWindows ocx but loading postgis layers is really slow, as it's made creating a shapefile and adding shapes to it one by one (using feature data objects).

If you know where to find a complete application example that loads a postgis layer using QGis functionality in c# or even in c++, it would be very appreciated.

Thanks, and sorry for my bad english.

share|improve this question

Have you tried SharpMap ( or DotSpatial ( Both are native CLR libraries that can access and render PostGIS data (among others).


share|improve this answer

While it doesn't mention C# specifically Section 2 of the QGIS Coding and Compilation Guide shows how to embed a Qgis component in a C++ application.

I don't know if C# provides an easy way to wrap C++ code, but if it doesn't you could try wrapping it with swig.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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