[GIS] Loading Postgis Layers in a desktop application using C#

cpostgis

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.

Thanks.


Update:

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.

Best Answer

Have you tried SharpMap (http://sharpmap.codeplex.com/) or DotSpatial (http://dotspatial.codeplex.com/)? Both are native CLR libraries that can access and render PostGIS data (among others).

Bill