static public ISpatialReference setEsriSpatiaReferenceFromSrText(int srid, Connection conn) { ISpatialReference sr = new UnknownCoordinateSystemClass(); string srText = ""; int i = 0; try { //Bill: query srtext associated with srid AutoDataReader dr = conn.doQuery("select * from spatial_ref_sys where srid = " + srid.ToString()); if (dr.Read()) { srText = dr["srtext"] + ""; ISpatialReferenceFactory2 srf = new SpatialReferenceEnvironmentClass(); if (srText == "") { sr = new UnknownCoordinateSystemClass(); } else { //use srText to construct SR. srf.CreateESRISpatialReference(srText, out sr, out i); } } return(sr); } catch { //PostGis srid is not implemented as an Esri Factory Code sr = new UnknownCoordinateSystemClass(); return(sr); } }
/// <summary> /// Create a SelectionSet from a dataReader /// </summary> /// <param name="postGisFeatureClass"></param> /// <param name="dataReader"></param> public PostGisSelectionSet(PostGisFeatureClass postGisFeatureClass, AutoDataReader dataReader) { System.Diagnostics.Debug.WriteLine("NOT-Empty PostGisSelectionSet..."); m_featClass = postGisFeatureClass; //oids.Add(1); m_dr = dataReader; if (dataReader != null) { while (dataReader.Read()) { oids.Add((object)dataReader[PostGisConstants.idField]); } dataReader.Close(); } }