Using NetTopologySuite.IO.PostGisReader I try to create a NetTopologySuite.Geometries.Geometry (or a GeoAPI.Geometries.IGeometry)
I have that :
public void LotFromArchive(string nolot)
{
string lotsql = string.Format(@"SELECT nouv_lot, st_srid(geom) AS srid, st_astext(geom) AS wnt, st_asbinary(geom) AS wnb FROM lots WHERE nouv_lot = '{0}';", nolot);
NpgsqlConnection conn = new NpgsqlConnection(connexionString);
using (Npgsql.NpgsqlDataAdapter adapter = new Npgsql.NpgsqlDataAdapter(lotsql, conn))
{
conn.Open();
System.Data.DataSet ds2 = new System.Data.DataSet();
adapter.Fill(ds2,"lots");
conn.Close();
NetTopologySuite.IO.PostGisReader pgReader = new NetTopologySuite.IO.PostGisReader();
if (ds2.Tables.Count > 0)
{
foreach (System.Data.DataRow dr in ds2.Tables[0].Rows)
{
this.GeometrieFromWNB((byte[])dr["wnb"], (int)dr["srid"]);
NetTopologySuite.Features.Feature feature = new NetTopologySuite.Features.Feature();
pgReader.Read((byte[])dr["wnb"]);
GeoAPI.Geometries.IGeometry Geom = pgReader.Read((byte[])dr["wnb"]);
}
}
}
}
If dr["wnt"] = "POLYGON((215644.2216 5360088.222,215651.46 5360069.7822,215670.2543 5360075.8526,215663.2397 5360094.3951,215644.2216 5360088.222))"
it works fine
but if dr["wnt"] = "CURVEPOLYGON(COMPOUNDCURVE((215644.2216 5360088.222,215651.46 5360069.7822),(215651.46 5360069.7822,215670.2543 5360075.8526),(215670.2543 5360075.8526,215663.2397 5360094.3951),(215663.2397 5360094.3951,215644.2216 5360088.222)))"
I receive the argument exception "Geometry type not recognized. GeometryCode: 10" on line "pgReader.Read((byte[])dr["wnb"]);"
The problem seems to comes from the CURVEPOLYGON(COMPOUNDCURVE but how to do to use curvepolygon and coupoundcurve from PostGIS in NetTopologySuite ?
Thanks,
JM