I'm having issues using zipGIS to programatically get data from
PostGIS and load it into ArcMap. I've used the following code, look
closely at the comments towards the end as you'll see I've tried
variations that haven't worked.
m_mapControl = (IMapControl3)axMapControl1.Object;
//disable the Save menu (since there is no document yet)
menuSaveDoc.Enabled = false;
IWorkspaceFactory wksf = new PostGisWorkspaceFactory();
//Open the PostGIS Workspace from a from IPropertySet (in
the SDEWorkspaceFactory fashion)
IPropertySet ps = new PropertySetClass();
//specify the configfile property if you want to log
zigGis actions for debugging
IWorkspace ws = wksf.Open(ps, 0);
//Alternatively you can open the PostGIS Workspace from a
//ws = wksf.OpenFromFile(@"C:\ziggis\ZigGis\example.zig",
//Open the PostGIS feature class
IFeatureWorkspace fwks = ws as IFeatureWorkspace;
IFeatureClass fc =
//Create the new layer (default renderer is
IFeatureLayer layer = new PostGisFeatureLayer();
layer.FeatureClass = fc;
layer.Name = fc.AliasName;
//Add the layer to the Map Control
This code is taken from http://www.paolocorti.net/2007/02/21/iworkspacefactory-wksf-new-postgisworkspacefactory/
which is obviously outdated, but I was in the hope it'd work. As for
OpenFeatureClass having that format, if you don't specify exactly four
layers semi-colon separated then it doesn't work at all.
This is the last feature we require in order to determine if we are to
buy a license of zipGIS. I wasn't sure if it was because we don't
have a full license?
Many thanks in advance.